cacapi
v1.0.6
Published
CloudAtCost API Wrapper
Downloads
1
Readme
#Cacapi
A Node.Js wrapper for CloudAtCost API
#Installation
npm install cacapi
#C@C Configuration go to https://panel.cloudatcost.com/ -> Settings -> API Access IP:
#Examples
Every function returns with a callback two parameters: error
and result
.
var Cacapi = require('cacapi');
var api = new Cacapi(apikey, loginEmail);
###List servers
api.listServers(function(err, res) {
(!err) ? console.log(res) : console.log(err);
});
###List templates
api.listTemplates(function(err, res) {
console.log(res["status"]);
// if the result has been processed correctly
// should print "ok"
});
###List tasks
api.listTasks(function(err, res) {
console.log(res["data"][0].action);
// res is an Object
});
###Power operations
api.powerOp(sid, 'poweron', function(err, res) {
// first argument is the ServerId
// the second one must be 'poweron' || 'poweroff' || 'reset'
});
###Run mode
api.runMode(sid, 'safe', function(err, res) {
// first argument is the ServerId
// the second one must be 'normal' || 'safe'
});
###Rename server
api.renameServer(sid, 'My VPS', function(err, res) {
// first argument is the ServerId
// the second one is the new Name
});
###Modify reverse DNS
api.modifyReverseDNS(sid, 'localhost.domain.com', function(err, res) {
// first argument is the ServerId
// the second one is the new HostName
});
###Console
api.console(sid, function(err, res) {
// the only argument is the ServerId
});
#CloudPro Actions
###Build server
api.createServer(1, 512, 11, 27, function(err, res) {
// Arguments:
// number of CPU's
// RAM in MB
// storage in GB
// OS number ( see List templates )
});
###Delete server
api.deleteServer(sid, function(err, res) {
// the only argument is the ServerId
});
###Resources
api.resources(function(err, res) {
console.log(res["data"].total)
// { cpu_total: '1', ram_total: '512', storage_total: '11' }
// I have a very small VPS ;)
});
#License This software is under ISC