|
|
|
@ -5,6 +5,15 @@ var tag_api = function(){}; |
|
|
|
|
|
|
|
|
|
|
|
tag_api.prototype.all_tags = function(source, callback){ |
|
|
|
/* |
|
|
|
* tag_api.all_tags([[source], callback]) |
|
|
|
* |
|
|
|
* method to get all the tags in datadog |
|
|
|
* |
|
|
|
* `source` a source to limit to |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(arguments.length < 2 && v8type.is(arguments[0], v8type.FUNCTION)){ |
|
|
|
callback = arguments[0]; |
|
|
|
source = undefined; |
|
|
|
@ -19,6 +28,16 @@ tag_api.prototype.all_tags = function(source, callback){ |
|
|
|
}; |
|
|
|
|
|
|
|
tag_api.prototype.host_tags = function(host, source, callback){ |
|
|
|
/* |
|
|
|
* tag_api.host_tags(host, [[source], callback]) |
|
|
|
* |
|
|
|
* method to get the tags associated with a given `host` |
|
|
|
* |
|
|
|
* `host` the hostname or id to get tags for |
|
|
|
* `source` a source to limit the results to |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(arguments.length < 3 && v8type.is(arguments[1], v8type.FUNCTION)){ |
|
|
|
callback = arguments[1]; |
|
|
|
source = undefined; |
|
|
|
@ -33,6 +52,16 @@ tag_api.prototype.host_tags = function(host, source, callback){ |
|
|
|
}; |
|
|
|
|
|
|
|
tag_api.prototype.host_tags_by_source = function(host, source, callback){ |
|
|
|
/* |
|
|
|
* tag_api.host_tags_by_source(host, [[source], callback]) |
|
|
|
* |
|
|
|
* method to return the tags associated with a host, arranged by source |
|
|
|
* |
|
|
|
* `host` the hostname of id to get tags for |
|
|
|
* `source` a source to limit the lookup for |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(arguments.length < 3 && v8type.is(arguments[1], v8type.FUNCTION)){ |
|
|
|
callback = arguments[1]; |
|
|
|
source = undefined; |
|
|
|
@ -48,6 +77,17 @@ tag_api.prototype.host_tags_by_source = function(host, source, callback){ |
|
|
|
}; |
|
|
|
|
|
|
|
tag_api.prototype.add_tags = function(host, tags, source, callback){ |
|
|
|
/* |
|
|
|
* tag_api.add_tags(host, tags, [[source], callback]) |
|
|
|
* |
|
|
|
* add new tags to given `host` |
|
|
|
* |
|
|
|
* `host` the hostname or id of the machine to add tags for |
|
|
|
* `tags` an array of tags to add to the `host` |
|
|
|
* `source` the source to associate the tags with, default: user |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(!v8type.is(tags, v8type.ARRAY)){ |
|
|
|
throw new Error('`tags` parameter must be an array'); |
|
|
|
} |
|
|
|
@ -70,6 +110,17 @@ tag_api.prototype.add_tags = function(host, tags, source, callback){ |
|
|
|
}; |
|
|
|
|
|
|
|
tag_api.prototype.update_tags = function(host, tags, source, callback){ |
|
|
|
/* |
|
|
|
* tag_api.update_tags(host, tags, [[source], callback]) |
|
|
|
* |
|
|
|
* update the tags associated with the given `host` |
|
|
|
* |
|
|
|
* `host` is the hostname or id of the machine to update tags for |
|
|
|
* `tags` an array of tags to associate with the `host` |
|
|
|
* `source` the source to associate the tags with, default: user |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(!v8type.is(tags, v8type.ARRAY)){ |
|
|
|
throw new Error('`tags` parameter must be an array'); |
|
|
|
} |
|
|
|
@ -92,6 +143,16 @@ tag_api.prototype.update_tags = function(host, tags, source, callback){ |
|
|
|
}; |
|
|
|
|
|
|
|
tag_api.prototype.detach_tags = function(host, source, callback){ |
|
|
|
/* |
|
|
|
* tag_api.detach_tags(host, [[source], callback]) |
|
|
|
* |
|
|
|
* method to remove tags for a given `host` |
|
|
|
* |
|
|
|
* `host` the hostname or id of the machine to remove the tags for |
|
|
|
* `source` the source of the tags |
|
|
|
* `callback` is an optional function to call with the results of the api call |
|
|
|
* callback(error, result, status_code) |
|
|
|
*/ |
|
|
|
if(arguments.length < 3 && v8type.is(arguments[1], v8type.FUNCTION)){ |
|
|
|
callback = arguments[1]; |
|
|
|
source = undefined; |
|
|
|
|