feat(xo-cli): support REST PUT method
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
- @xen-orchestra/cr-seed-cli major
|
||||
- @xen-orchestra/vmware-explorer patch
|
||||
- xen-api major
|
||||
- xo-cli minor
|
||||
- xo-server minor
|
||||
- xo-server-netbox minor
|
||||
- xo-vmdk-to-vhd patch
|
||||
|
||||
@@ -50,6 +50,7 @@ Usage:
|
||||
|
||||
Examples:
|
||||
xo-cli rest del tasks/<task id>
|
||||
xo-cli rest del vms/<vm id>/tags/<tag>
|
||||
|
||||
xo-cli rest get <collection> [fields=<fields>] [filter=<filter>] [limit=<limit>]
|
||||
List objects in a REST API collection.
|
||||
@@ -122,6 +123,18 @@ Usage:
|
||||
Examples:
|
||||
xo-cli rest post tasks/<task id>/actions/abort
|
||||
xo-cli rest post vms/<VM UUID>/actions/snapshot name_label='My snapshot'
|
||||
|
||||
xo-cli rest put <collection>/<item id> <name>=<value>...
|
||||
Put a item in a collection
|
||||
|
||||
<collection>/<item id>
|
||||
Full path of the item to add
|
||||
|
||||
<name>=<value>...
|
||||
Properties of the item
|
||||
|
||||
Examples:
|
||||
xo-cli rest put vms/<vm id>/tags/<tag>
|
||||
```
|
||||
|
||||
#### Register your XO instance
|
||||
|
||||
@@ -68,6 +68,7 @@ Usage:
|
||||
|
||||
Examples:
|
||||
xo-cli rest del tasks/<task id>
|
||||
xo-cli rest del vms/<vm id>/tags/<tag>
|
||||
|
||||
xo-cli rest get <collection> [fields=<fields>] [filter=<filter>] [limit=<limit>]
|
||||
List objects in a REST API collection.
|
||||
@@ -140,6 +141,18 @@ Usage:
|
||||
Examples:
|
||||
xo-cli rest post tasks/<task id>/actions/abort
|
||||
xo-cli rest post vms/<VM UUID>/actions/snapshot name_label='My snapshot'
|
||||
|
||||
xo-cli rest put <collection>/<item id> <name>=<value>...
|
||||
Put a item in a collection
|
||||
|
||||
<collection>/<item id>
|
||||
Full path of the item to add
|
||||
|
||||
<name>=<value>...
|
||||
Properties of the item
|
||||
|
||||
Examples:
|
||||
xo-cli rest put vms/<vm id>/tags/<tag>
|
||||
```
|
||||
|
||||
#### Register your XO instance
|
||||
|
||||
@@ -274,6 +274,7 @@ const help = wrap(
|
||||
|
||||
Examples:
|
||||
$name rest del tasks/<task id>
|
||||
$name rest del vms/<vm id>/tags/<tag>
|
||||
|
||||
$name rest get <collection> [fields=<fields>] [filter=<filter>] [limit=<limit>]
|
||||
List objects in a REST API collection.
|
||||
@@ -347,6 +348,18 @@ const help = wrap(
|
||||
$name rest post tasks/<task id>/actions/abort
|
||||
$name rest post vms/<VM UUID>/actions/snapshot name_label='My snapshot'
|
||||
|
||||
$name rest put <collection>/<item id> <name>=<value>...
|
||||
Put a item in a collection
|
||||
|
||||
<collection>/<item id>
|
||||
Full path of the item to add
|
||||
|
||||
<name>=<value>...
|
||||
Properties of the item
|
||||
|
||||
Examples:
|
||||
$name rest put vms/<vm id>/tags/<tag>
|
||||
|
||||
$name v$version`.replace(/<([^>]+)>|\$(\w+)/g, function (_, arg, key) {
|
||||
if (arg) {
|
||||
return '<' + chalk.yellow(arg) + '>'
|
||||
|
||||
@@ -112,6 +112,18 @@ const COMMANDS = {
|
||||
|
||||
return stripPrefix(await response.text())
|
||||
},
|
||||
|
||||
async put([path, ...params]) {
|
||||
const response = await this.exec(path, {
|
||||
body: JSON.stringify(parseParams(params)),
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
method: 'PUT',
|
||||
})
|
||||
|
||||
return stripPrefix(await response.text())
|
||||
},
|
||||
}
|
||||
|
||||
export async function rest(args) {
|
||||
|
||||
Reference in New Issue
Block a user