ShutdownHost
API Request
URLs
PUT zstack/v1/hosts/power/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In the above example, systemTags and userTags fields can be omitted. They are listed to indicate that these two fields can be included in the body.
{
"shutdownHost": {
"returnEarly": false,
"force": false,
"method": "AUTO"
},
"systemTags": [],
"userTags": []
}
Note: In the above example, systemTags and userTags fields can be omitted. They are listed to indicate that these two fields can be included in the body.Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"shutdownHost":{"returnEarly":false,"force":false,"method":"AUTO"}}' //localhost:8080/zstack/v1/hosts/power/700457ff11133edf93541013f6caf8e7/actionsParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Resource UUID, uniquely identifies the resource | 4.7.0 | |
| returnEarly (optional) | boolean | body (contained in shutdownHost structure) | Whether to return early | 4.7.0 | |
| force (optional) | boolean | body (contained in shutdownHost structure) | Whether to force shutdown | 0.6 | |
| method (optional) | String | body (contained in shutdownHost structure) | Shutdown method |
|
4.7.0 |
| systemTags (optional) | List | body | System tag | 4.7.0 | |
| userTags (optional) | List | body | User tag | 4.7.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
ShutdownHostAction action = new ShutdownHostAction();
action.uuid = "700457ff11133edf93541013f6caf8e7";
action.returnEarly = false;
action.force = false;
action.method = "AUTO";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ShutdownHostAction.Result res = action.call();Python
SDK
ShutdownHostAction action = ShutdownHostAction()
action.uuid = "700457ff11133edf93541013f6caf8e7"
action.returnEarly = false
action.force = false
action.method = "AUTO"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ShutdownHostAction.Result res = action.call()