Get Host Latest Power Status

PUT/zstack/v1/hosts/power/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "getHostPowerStatus": {
    "method": "AUTO"
  },
  "systemTags": [],
  "userTags": []
}

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 '{"getHostPowerStatus":{"method":"AUTO"}}' //localhost:8080/zstack/v1/hosts/power/12d6c065d8cb3e128b5c33f7c619f65f/actions

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

uuid

String

url

Resource UUID, uniquely identifies the resource

 

4.7.0

method (optional)

String

body (contained in getHostPowerStatus structure)

Method to get host power status

  • AUTO
  • AGENT
  • IPMI

4.7.0

systemTags (optional)

List

body

System tag

 

4.7.0

userTags (optional)

List

body

User tag

 

4.7.0

API Response

Response Example

{
  "inventory": {
    "ipmiAddress": "192.168.0.1",
    "ipmiUsername": "admin",
    "ipmiPort": 623,
    "ipmiPassword": "password",
    "ipmiPowerStatus": "POWER_ON"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.7.0
inventory See details inventory4.7.0
errorErrorCodeError code. If not null, the operation failed. If null, the operation succeeded. See details error4.7.0

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource4.7.0
ipmiAddressStringIPMI address4.7.0
ipmiUsernameStringIPMI username4.7.0
ipmiPortintIPMI port4.7.0
ipmiPowerStatusStringIPMI power status4.7.0

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier of the error, e.g. SYS.1000, HOST.10014.7.0
descriptionStringBrief description of the error4.7.0
detailsStringDetailed error information4.7.0
elaborationStringReserved field, default is null4.7.0
opaqueLinkedHashMapReserved field, default is null4.7.0
causeErrorCodeRoot cause, the error that caused the current error. If there is no original error, this field is null4.7.0

SDK Examples

Java SDK

GetHostPowerStatusAction action = new GetHostPowerStatusAction();
action.uuid = "12d6c065d8cb3e128b5c33f7c619f65f";
action.method = "AUTO";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetHostPowerStatusAction.Result res = action.call();

Python SDK

GetHostPowerStatusAction action = GetHostPowerStatusAction()
action.uuid = "12d6c065d8cb3e128b5c33f7c619f65f"
action.method = "AUTO"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetHostPowerStatusAction.Result res = action.call()