feat(network): add defaultIsLocked to API (#385)

This commit is contained in:
Olivier Lambert 2016-09-01 08:49:20 -04:00 committed by Julien Fontanet
parent 63c676ebfe
commit 7d1f9e33fe
3 changed files with 16 additions and 3 deletions

View File

@ -31,11 +31,13 @@ export async function set ({
name_description: nameDescription,
name_label: nameLabel,
defaultIsLocked,
id
}) {
await this.getXapi(network).setNetworkProperties(network._xapiId, {
nameDescription,
nameLabel
nameLabel,
defaultIsLocked
})
}
@ -50,6 +52,10 @@ set.params = {
name_description: {
type: 'string',
optional: true
},
defaultIsLocked: {
type: 'boolean',
optional: true
}
}

View File

@ -483,6 +483,7 @@ const TRANSFORMS = {
network (obj) {
return {
bridge: obj.bridge,
defaultIsLocked: obj.default_locking_mode === 'disabled',
MTU: +obj.MTU,
name_description: obj.name_description,
name_label: obj.name_label,

View File

@ -384,11 +384,17 @@ export default class Xapi extends XapiBase {
async setNetworkProperties (id, {
nameLabel,
nameDescription
nameDescription,
defaultIsLocked
}) {
let defaultLockingMode
if (defaultIsLocked != null) {
defaultLockingMode = defaultIsLocked ? 'disabled' : 'unlocked'
}
await this._setObjectProperties(this.getObject(id), {
nameLabel,
nameDescription
nameDescription,
defaultLockingMode
})
}