A SolusVM Admin API Wrapper
This module can be install via npm:
$ npm install --save solusvm
The solusvm.call()
method accepts three arguments:
- The name of the SolusVM API action to call
- An object with the variables for the API call
- An optional callback function
If no callback function is passed to the call then a promise is returned. To use a callback instead, pass a callback function as the third argument.
var solusvm = require('solusvm');
//Configrure the API client with the URL, API ID and API KEY of the SolusVM Master Instance
solusvm.configure('url', 'apiId', 'apiKey');
//Example of a promise-based call to the client
solusvm.call('node-idlist', {
type: 'openvz'
})
.then(function(data) {
console.log(data);
})
.catch(function(err) {
console.log(err);
});
//Example of a callback-based call to the client
solusvm.call('node-idlist', {
type: 'openvz'
}, function(err, data) {
if (err) {
console.log(err);
} else {
console.log(data);
}
});