Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scaleway

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scaleway - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

5

lib/config.js
var config = require('rc')('node_scaleway', {
api_endpoint: 'https://api.scaleway.com/',
dry_run: false,
organization: null,
token: null
});
if (config['dry-run']) {
config.dry_run = config['dry-run'];
}

@@ -8,0 +13,0 @@ // FIXME: data validation

@@ -64,2 +64,7 @@ var rp = require('request-promise'),

if (client.config.dry_run) {
console.error('dry-run, should call "' + options.method
+ ' ' + options.url + '", exiting...');
process.exit(1);
}
return rp(options).promise().nodeify(cb);

@@ -85,2 +90,65 @@ };

// Helpers
/**
* Create a Server.
* You must have a root volume, it can be an image, or a volume.
*
* @param {Object} data
* - {String} name (optional) The name of the new server
* - {String} bootscript (optional) UUID of the bootscript to use
* - {Array} tags (optional) List of tags to add
* - {String} root_volume (optional) UUID of the volume to use for NBD0
* - {String} image (optional) UUID of the image to use for NBD0
* - {Array} volumes (optional) List of UUID to use for NBD1 -> NBD16
* @param {Object} options Request options
* @param {FUnction} fn Callback
*/
this.createServer = function(data, options, fn) {
var postData = {
organization: data.organization || this.config.organization,
name: data.name
};
if (data.image) {
postData.image = data.image;
}
if (data.bootscript) {
postData.bootscript = data.bootscript;
}
if (data.root_volume) {
postData.volumes = postData.volumes || {};
postData.volumes['0'] = data.root_volume;
}
if (data.volumes && data.volumes.length) {
postData.volumes = postData.volumes || {};
data.volumes.forEach(function(volume, idx) {
postData.volumes[(idx + 1).toString()] = volume;
});
}
if (data.env) {
postData.tags = data.env;
}
return this.post('/servers', postData, options, fn);
};
/**
* Create a Volume.
*
* @param {Object} data
* - {String} name (optional) The name of the new volume
* - {Integer} size The size of the new volume
* - {String} [l_ssd] volume_type The type of the new volume
* @param {Object} options Request options
* @param {FUnction} fn Callback
*/
this.createVolume = function(data, options, fn) {
var postData = {
organization: data.organization || this.config.organization,
name: data.name || data.size,
size: parseInt(data.size),
volume_type: data.volume_type || 'l_ssd'
};
return this.post('/volumes', postData, options, fn);
};
}).call(Client.prototype);

2

package.json
{
"name": "scaleway",
"version": "0.5.0",
"version": "0.6.0",
"description": "Scaleway.com API client",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -70,3 +70,3 @@ # node-scaleway

- Official Python SDK: [online-labs/ocs-sdk](https://github.com/online-labs/ocs-sdk)
- Official Python SDK: [scaleway/python-scaleway](https://github.com/scaleway/python-scaleway)
- Cloudformation plugin, with API client in Node.js: [resin-io/scaleway-cloudformation](https://github.com/resin-io/scaleway-cloudformation)

@@ -73,0 +73,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc