Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions lib/nova.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ Nova.prototype.getRequestOptions = function(path, json_value)
// ----------------
// Server methods
// ----------------
//NOTE: options is an optional hash that lets you specify filters on the listing call ie: {limit: 1}

//List Servers
Nova.prototype.listServers = function(options, cb)
{
//first a little param tweaking to actually make options optional (at least until we require node8 and can just default options to {}
Expand All @@ -111,7 +112,7 @@ Nova.prototype.listServers = function(options, cb)

//now on with the show
var self = this;
var request_options = this.getRequestOptions('/servers/detail', true);
var request_options = this.getRequestOptions('/servers', true);
request_options.metricPath = 'remote-calls.nova.servers.list';
request_options.validateStatus = true;
request_options.requireBodyObject = 'servers';
Expand All @@ -137,6 +138,42 @@ Nova.prototype.listServers = function(options, cb)
});
};

//NOTE: options is an optional hash that lets you specify filters on the listing call ie: {limit: 1}
Nova.prototype.listDetailsServers = function(options, cb)
{
//first a little param tweaking to actually make options optional (at least until we require node8 and can just default options to {}
var args = osutils.getArgsWithCallback(this.listServers.length, arguments);
options = args[0] || {};
cb = args[1];

//now on with the show
var self = this;
var request_options = this.getRequestOptions('/servers/detail', true);
request_options.metricPath = 'remote-calls.nova.servers.details.list';
request_options.validateStatus = true;
request_options.requireBodyObject = 'servers';
request_options.qs = options;

this.request.get(request_options, function(error, response, body){
var servers_array = [];
var n = 0;

if(error)
{
cb(error);
return;
}
//else

for(n = 0; n < body.servers.length; n++)
{
servers_array[n] = self.mangleObject('Server', body.servers[n]);
}

cb(null, servers_array);
});
};



Nova.prototype.getServer = function(id, cb)
Expand Down
Loading