Set VM USB Redirect Switch
Headers
Authorization: OAuth the-session-uuidBody
{
"setVmUsbRedirect": {
"enable": true
},
"systemTags": [],
"userTags": []
}The systemTags and userTags fields can be omitted in the above example. They are listed to indicate that the body can contain these two fields.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setVmUsbRedirect":{"enable":true}}' \
http://localhost:8080/zstack/v1/vm-instances/ceeca8ab8c6b33fab9bdc143dec13211/actionsParameter List
Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
uuid | String | url | UUID of the resource, uniquely identifies the resource |
| 2.1 |
enable | boolean | body(contained in setVmUsbRedirect structure) | Set to true to enable the switch, set to false to disable the switch |
| 2.1 |
systemTags (Optional) | List | body |
|
| 2.1 |
userTags (Optional) | List | body |
|
| 2.1 |
API Response
On success, this API returns an empty JSON structure {}. On error, the returned JSON structure contains an error field, for example:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Examples
Java SDK
SetVmUsbRedirectAction action = new SetVmUsbRedirectAction();
action.uuid = "ceeca8ab8c6b33fab9bdc143dec13211";
action.enable = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmUsbRedirectAction.Result res = action.call();Python SDK
SetVmUsbRedirectAction action = SetVmUsbRedirectAction()
action.uuid = "ceeca8ab8c6b33fab9bdc143dec13211"
action.enable = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetVmUsbRedirectAction.Result res = action.call()