Skip to content
A Node.js Library for SAKURA Internet Cloud API.
JavaScript
Branch: master
Clone or download
kanreisa @0.1.0
CLI: feature removed. -> use `usacloud` https://github.com/sacloud/usacloud .
Latest commit 4e6d9b5 Aug 17, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib @0.1.0 Aug 16, 2017
.gitignore たぶんこんなかんじ Feb 28, 2013
LICENSE Added: LICENSE Apr 10, 2013
README.md @0.1.0 Aug 16, 2017
index.js first commit Feb 28, 2013
package.json @0.1.0 Aug 16, 2017

README.md

node-sacloud (sacloud)

A node.js library for SAKURA Internet Cloud API.

Install

npm install --save sacloud

Getting started

Load and create a client instance:

const sacloud = require("sacloud");

const client = sacloud.createClient({
  accessToken        : 'account_access_token_here',
  accessTokenSecret  : '********',
  disableLocalizeKeys: false,// (optional;default:false) false: lower-camelize the property names in response Object
  debug              : true// (optional;default:false) output debug requests to console.
});

// select zone
const zone = "tk1a";
client.opt.apiRoot = `https://secure.sakura.ad.jp/cloud/zone/${zone}/api/cloud/1.1/`;

Get Servers:

client.createRequest({
  method: 'GET',
  path  : 'server'
}).send((err, result) => {
  
  if (err) {
    throw new Error(err);
  }
  
  console.log( JSON.stringify(result, null, '  ') );
});
Create Server:
const request = client.createRequest({
  method: 'POST',
  path  : 'server',
  body  : {
    Server: {
      Zone       : { ID: 31001 },
      ServerPlan : { ID: 1 },
      Name       : 'test-server',
      Description: 'blah blah blah...',
      Tags       : ['test']
    }
  }
});

request.send((err, result) => {
  
  if (err) {
    throw new Error(err);
  }
  
  console.log(`created successfully! serverId=${result.response.server.id}`);
});

CLI

has been removed on @0.1.0. use usacloud.

API Documentation

see: http://developer.sakura.ad.jp/cloud/api/1.1/

You can’t perform that action at this time.