summaryrefslogtreecommitdiff
path: root/controller/zt1-controller-client/index.js
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-16 16:09:28 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-16 16:09:28 -0700
commita187d290f15ed2191e994852a6778bf4aa0f083b (patch)
treec33f5c43b6b5dec857a5b8670ed570ea56d96b74 /controller/zt1-controller-client/index.js
parent27c5f04d68003774b9a85eb7047c683cbb64f0df (diff)
downloadinfinitytier-a187d290f15ed2191e994852a6778bf4aa0f083b.tar.gz
infinitytier-a187d290f15ed2191e994852a6778bf4aa0f083b.zip
Fixes to control plane, API, eliminate problematic inheritance pattern, and start on a NodeJS class for talking to the network controller.
Diffstat (limited to 'controller/zt1-controller-client/index.js')
-rw-r--r--controller/zt1-controller-client/index.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/controller/zt1-controller-client/index.js b/controller/zt1-controller-client/index.js
new file mode 100644
index 00000000..b1e07e81
--- /dev/null
+++ b/controller/zt1-controller-client/index.js
@@ -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;