SetVmCleanTraffic
API Request
URLs
PUT zstack/v1/vm-instances/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"setVmCleanTraffic": {
"enable": true
},
"systemTags": [],
"userTags": []
}
Note: In the example above, systemTags and userTags fields can be omitted. 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 '{"setVmCleanTraffic":{"enable":true}}' http://localhost:8080/zstack/v1/vm-instances/db90c27c8cc743e39ea7fa97a91617ba/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Resource UUID, uniquely identifies the resource | 3.1.0 | |
| enable | boolean | body (contained in setVmCleanTraffic structure) | Whether VM clean-traffic is enabled |
|
3.1.0 |
| systemTags (Optional) | List | body | Optional. The system tags. | 3.1.0 | |
| userTags (Optional) | List | body | Optional. The user tags. | 3.1.0 |
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
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()