-
Notifications
You must be signed in to change notification settings - Fork 0
/
verifyCloudContainer.js
42 lines (33 loc) · 1.01 KB
/
verifyCloudContainer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var CONTAINER = "WIContainer1";
var containerStatus = function (token, receivedUrl) {
var
https = require('https'),
url = require('url'),
newUrl = url.parse(receivedUrl),
options = {
host : newUrl.host,
method : 'GET',
port : 443,
path : newUrl.pathname + '/' + CONTAINER,
headers : {
"X-Auth-Token" : token
}
};
console.log("Containerstatus called with: " + token);
console.log("Url: " + receivedUrl);
var req = https.request(options, function (res) {
console.log('Number of objects: ' + res.headers['x-container-object-count']);
console.log('Bytes used: ' + res.headers['x-container-bytes-used']);
res.on('data', function (chunk) {
//console.log('Content of the container: ' + chunk);
});
res.on('end', function () {
console.log('All done');
});
});
req.on('error', function (e) {
console.log('error ' + e);
});
req.end();
};
require('getToken')(containerStatus);