Browse Source

rename api/infrastructure to api/tag

pull/2/merge
Brett Langdon 13 years ago
parent
commit
dcd94c59ec
3 changed files with 67 additions and 31 deletions
  1. +0
    -29
      lib/api/infrastructure.js
  2. +65
    -0
      lib/api/tag.js
  3. +2
    -2
      lib/index.js

+ 0
- 29
lib/api/infrastructure.js View File

@ -1,29 +0,0 @@
var infrastructure_api = function(){
};
infrastructure_api.prototype.search = function(query, callback){
this.request('GET', '/search', query, callback);
};
infrastructure_api.prototype.all_tags = function(){
};
infrastructure_api.prototype.host_tags = function(){
};
infrastructure_api.prototype.add_tags = function(){
};
infrastructure_api.prototype.change_tags = function(){
};
infrastructure_api.prototype.detach_tags = function(){
};
return module.exports = infrastructure_api;

+ 65
- 0
lib/api/tag.js View File

@ -0,0 +1,65 @@
var util = require('util');
var v8type = require('v8type');
var tag_api = function(){};
tag_api.prototype.search = function(query, callback){
this.request('GET', '/search', {query: {'q': query}}, callback);
};
tag_api.prototype.all_tags = function(source, callback){
if(arguments.length < 2 && v8type.is(arguments[0], v8type.FUNCTION)){
callback = arguments[0];
source = undefined;
}
params = {
query: {
source: source
}
};
this.request('GET', '/tags/hosts', params, callback);
};
tag_api.prototype.host_tags = function(host, source, callback){
if(arguments.length < 3 && v8type.is(arguments[1], v8type.FUNCTION)){
callback = arguments[1];
source = undefined;
}
params = {
query: {
source: source,
}
};
this.request('GET', util.format('/tags/hosts/%s', host), params, callback);
};
tag_api.prototype.host_tags_by_source = function(host, source, callback){
if(arguments.length < 3 && v8type.is(arguments[1], v8type.FUNCTION)){
callback = arguments[1];
source = undefined;
}
params = {
query: {
source: source,
by_source: true,
}
};
this.request('GET', util.format('/tags/hosts/%s', host), params, callback);
};
tag_api.prototype.add_tags = function(){
};
tag_api.prototype.change_tags = function(){
};
tag_api.prototype.detach_tags = function(){
};
return module.exports = tag_api;

+ 2
- 2
lib/index.js View File

@ -4,7 +4,7 @@ var http_client = require('./http_client.js');
var alert_api = require('./api/alert.js'); var alert_api = require('./api/alert.js');
var dash_api = require('./api/dash.js'); var dash_api = require('./api/dash.js');
var event_api = require('./api/event.js'); var event_api = require('./api/event.js');
var infrastructure_api = require('./api/infrastructure.js');
var tag_api = require('./api/tag.js');
var metric_api = require('./api/metric.js'); var metric_api = require('./api/metric.js');
var dogapi = function(options){ var dogapi = function(options){
@ -16,7 +16,7 @@ extend(dogapi.prototype,
alert_api.prototype, alert_api.prototype,
dash_api.prototype, dash_api.prototype,
event_api.prototype, event_api.prototype,
infrastructure_api.prototype,
tag_api.prototype,
metric_api.prototype); metric_api.prototype);
return module.exports = dogapi; return module.exports = dogapi;

Loading…
Cancel
Save