Fixes to control plane, API, eliminate problematic inheritance pattern, and start on a NodeJS class for talking to the network controller.

This commit is contained in:
Adam Ierymenko 2015-05-16 16:09:28 -07:00
commit a187d290f1
11 changed files with 109 additions and 143 deletions

View file

@ -0,0 +1,26 @@
'use strict'
var request = require('request');
function ZT1ControllerClient(url,authToken)
{
this.url = url;
this.authToken = authToken;
}
ZT1ControllerClient.prototype.status = function(callback)
{
request({
url: this.url + 'controller',
method: 'GET',
headers: {
'X-ZT1-Auth': this.authToken
}
},function(error,response,body) {
if ((error)||(response.statusCode !== 200))
return callback(error,{});
return callback(null,JSON.parse(body));
});
};
exports.ZT1ControllerClient = ZT1ControllerClient;