SetVmRDP
API Request
URLs
PUT zstack/v1/vm-instances/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"setVmRDP": {
"enable": true
},
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setVmRDP":{"enable":true}}' \
http://localhost:8080/zstack/v1/vm-instances/f523cb5736b630acb643dda6d31be5a0/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 2.2 | |
| enable | boolean | body (contained in the setVmRDP structure) | Whether the RDP switch is enabled for the VM instance. That is, whether the VM instance can be accessed through RDP. | 2.2 | |
| systemTags | List | body | Optional. The system tags. | 2.2 | |
| userTags | List | body | Optional. The user tags. | 2.2 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes 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 Sample
Java
SDK
SetVmRDPAction action = new SetVmRDPAction();
action.uuid = "e2889e09bb0a4f1b9f2757d8bd0c1fc6";
action.enable = true;
action.sessionId = "595b40e65a1f4755a68573ab9ef6802c";
SetVmRDPAction.Result res = action.call();Python
SDK
SetVmRDPAction action = SetVmRDPAction()
action.uuid = "dc71514a6e1a490b9985b1dcb4faff11"
action.enable = true
action.sessionId = "aee17676e2604d9ab50a4b8907c31568"
SetVmRDPAction.Result res = action.call()