SetVmCleanTraffic
API Request
URLs
PUT zstack/v1/vm-instances/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"setVmCleanTraffic": {
"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 '{"setVmCleanTraffic":{"enable":true}}' http://localhost:8080/zstack/v1/vm-instances/db90c27c8cc743e39ea7fa97a91617ba/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 3.1.0 | |
| enable | boolean | body (contained in the setVmCleanTraffic structure) | Whether to enable clean-traffic for the VM instance. |
|
3.1.0 |
| systemTags | List | body | Optional. The system tags. | 3.1.0 | |
| userTags | List | body | Optional. The user tags. | 3.1.0 |
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
SetVmCleanTrafficAction action = new SetVmCleanTrafficAction();
action.uuid = "1e62596491bb4a708e737f1ec626a08e";
action.enable = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetVmCleanTrafficAction.Result res = action.call();Python
SDK
SetVmCleanTrafficAction action = SetVmCleanTrafficAction()
action.uuid = "69294c4a4e654535bbfd7fd92f4b52e9"
action.enable = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetVmCleanTrafficAction.Result res = action.call()