update to pass networks correctly when calling CreateVolume

This commit is contained in:
Josh Wilsdon 2017-05-16 17:23:16 -07:00
parent 348db1ebcc
commit 0d271cb7e2

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright 2015 Joyent, Inc.
* Copyright 2017 Joyent, Inc.
*
* Client library for the SmartDataCenter Cloud API (cloudapi).
* http://apidocs.joyent.com/cloudapi/
@ -2318,17 +2318,27 @@ CloudApi.prototype.createVolume = function createVolume(options, cb) {
assert.object(options, 'options');
assert.optionalString(options.name, 'options.name');
assert.optionalNumber(options.size, 'options.size');
assert.optionalArrayOfUuid(options.networks, 'options.networks');
assert.optionalArrayOfObject(options.networks, 'options.networks');
assert.string(options.type, 'options.type');
assert.func(cb, 'cb');
// options.networks is an array of objects that looks like:
// [{
// "id":"2456155a-6459-47ba-9c9a-a77b4e781a5b",
// "name":"sdc_nat",
// "public":true
// }]
var networkList = options.networks.map(function _mapNetworks(network) {
return network.id
});
this._request({
method: 'POST',
path: format('/%s/volumes', this.account),
data: {
name: options.name,
size: options.size,
networks: options.networks,
networks: networkList,
type: options.type
}
}, function (err, req, res, body) {