aoc-softlayer v0.0.3
aoc-softlayer
A simple nodeJS wrapper module to invoke Softlayer APIs. Read the motivation behind this library
Installation
npm install --save aoc-softlayer
Usage
Create a reference to aoc-softlayer as follows:
var sl = require('aoc-softlayer');
var client = new sl();
Example:
var sl = require('aoc-softlayer');
var client = new sl();
client.auth("user1", "key12345");
client.resultLimit(0, 500);
client.account().path('getAllTopLevelBillingItems').get(function (err, result) {
console.log("Bills: " + JSON.stringify(err) + ": " + JSON.stringify(result));
});
Ensure you have enabled API keys for your IBM Softlayer account and the keys are passed via auth method.
Refer to (ObjectFilters)https://sldn.softlayer.com/article/object-filters and (SoftLayer Services)http://sldn.softlayer.com/reference/services/ which are essential concepts to build your application using softlayer APIs.
get()
get() invokes http GET call on the formed URL with the specific Softlayer service and object.
client.get(function(err, result) {
//result contains the result of the request
});
post()
post() invokes http POST call to create objects on Softlayer
client.virtualGuest().params(cmdargs).post(
function (err, response) {
if (err) {
logger.error("Create VM failed : " + err);
}
});
delete()
delete() invokes http DELETE call to delete objects on Softlayer
client.virtualGuest().id(key).delete(
function (err, response) {
if (err) {
logger.error("Delete VM failed : " +err);
}
});
put() - Not implemented yet.
put() invokes http PUT call to modify objects on Softlayer
Tests
In progress.