UpdateHost
API Request
URLs
PUT zstack/v1/hosts/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"updateHost": {
"name": "example",
"description": "example",
"managementIp": "192.168.0.1"
},
"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 '{"updateHost":{"name":"example","description":"example","managementIp":"192.168.0.1"}}' \
http://localhost:8080/zstack/v1/hosts/fe98e821991a3c96af96fc7e458d2020/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| name | String | body (contained in the updateHost structure) | Optional. The resource name. | 0.6 | |
| description | String | body (contained in the updateHost structure) | Optional. Optional. The detailed description of the resource. | 0.6 | |
| managementIp | String | body (contained in the updateHost structure) | Optional. The IP address of the management node. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"zoneUuid": "2adef89f417e40dbab643656bbdc6eab",
"name": "example",
"uuid": "aaeb1d3c1f5a43fd941bfebab10b9f34",
"clusterUuid": "c12dec3c77e34c40a86c4ceea02b860b",
"description": "example",
"managementIp": "192.168.0.1",
"hypervisorType": "KVM",
"state": "Enabled",
"status": "Connected",
"totalCpuCapacity": 4.0,
"availableCpuCapacity": 2.0,
"totalMemoryCapacity": 4.0,
"availableMemoryCapacity": 4.0
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| inventory | HostInventory | See inventory. | 0.6 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| zoneUuid | String | The zone UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| uuid | String | The resource UUID. | 0.6 |
| clusterUuid | String | The cluster UUID. | 0.6 |
| description | String | The detailed description of the resource. | 0.6 |
| managementIp | String | 0.6 | |
| hypervisorType | String | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| totalCpuCapacity | Long | 0.6 | |
| availableCpuCapacity | Long | 0.6 | |
| cpuSockets | Integer | 0.6 | |
| totalMemoryCapacity | Long | 0.6 | |
| availableMemoryCapacity | Long | 0.6 | |
| cpuNum | Integer | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
UpdateHostAction action = new UpdateHostAction();
action.uuid = "17aa30b0eb5849fca56804ddd5050c84";
action.name = "example";
action.description = "example";
action.managementIp = "192.168.0.1";
action.sessionId = "f303f20ae5b740468f56e8007acba81c";
UpdateHostAction.Result res = action.call();Python
SDK
UpdateHostAction action = UpdateHostAction()
action.uuid = "3925f7e788b54e86831644a6f85ea7c7"
action.name = "example"
action.description = "example"
action.managementIp = "192.168.0.1"
action.sessionId = "83a1c2866a8a42f98c66ed7196a58d75"
UpdateHostAction.Result res = action.call()