feat(network): add network.set method

This commit is contained in:
Olivier Lambert 2016-08-08 14:54:23 +02:00
parent 33702c09a6
commit 8ed2e51dde
2 changed files with 45 additions and 0 deletions

View File

@ -24,6 +24,41 @@ create.permission = 'admin'
// ================================================================= // =================================================================
// ===================================================================
export async function set ({
network,
name_description: nameDescription,
name_label: nameLabel,
id
}) {
await this.getXapi(network).setNetworkProperties(network._xapiId, {
nameDescription,
nameLabel
})
}
set.params = {
id: {
type: 'string'
},
name_label: {
type: 'string',
optional: true
},
name_description: {
type: 'string',
optional: true
}
}
set.resolve = {
network: ['id', 'network', 'administrate']
}
// =================================================================
export async function delete_ ({ network }) { export async function delete_ ({ network }) {
return this.getXapi(network).deleteNetwork(network._xapiId) return this.getXapi(network).deleteNetwork(network._xapiId)
} }

View File

@ -379,6 +379,16 @@ export default class Xapi extends XapiBase {
}) })
} }
async setNetworkProperties (id, {
nameLabel,
nameDescription
}) {
await this._setObjectProperties(this.getObject(id), {
nameLabel,
nameDescription
})
}
// ================================================================= // =================================================================
async addTag (id, tag) { async addTag (id, tag) {