更新云主机控制台密码(UpdateConsolePassword)
API请求
URLs
PUT zstack/v1/vm-instances/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
{
"updateConsolePassword": {
"password": "new-password-123"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateConsolePassword":{"password":"new-password-123"}}' \
http://localhost:8080/zstack/v1/vm-instances/efa69f6385e93855a2b07f4de8908fb1/actions参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 5.4.2 | |
| password | String | body(包含在updateConsolePassword结构中) | 5.4.2 | ||
| systemTags (可选) | List | body | 系统标签 | 5.4.2 | |
| userTags (可选) | List | body | 用户标签 | 5.4.2 |
API返回
返回示例
{
"inventory": {
"uuid": "12e95e232863327c846cfd4752a18abd",
"name": "Test-VM-Updated",
"state": "Running"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 5.4.2 | |
| inventory | VmInstanceInventory | 详情参考inventory | 5.4.2 |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 5.4.2 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 3.7.0 |
| description | String | 错误的概要描述 | 3.7.0 |
| details | String | 错误的详细信息 | 3.7.0 |
| elaboration | String | 保留字段,默认为null | 3.7.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 3.7.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 3.7.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 0.6 |
| name | String | 资源名称 | 0.6 |
| description | String | 资源的详细描述 | 0.6 |
| zoneUuid | String | 区域UUID | 0.6 |
| clusterUuid | String | 集群UUID | 0.6 |
| imageUuid | String | 镜像UUID | 0.6 |
| hostUuid | String | 物理机UUID | 0.6 |
| lastHostUuid | String | 0.6 | |
| instanceOfferingUuid | String | 计算规格UUID | 0.6 |
| rootVolumeUuid | String | 根云盘UUID | 0.6 |
| platform | String | 0.6 | |
| architecture | String | 0.6 | |
| defaultL3NetworkUuid | String | 0.6 | |
| type | String | 0.6 | |
| hypervisorType | String | 0.6 | |
| memorySize | Long | 0.6 | |
| cpuNum | Integer | 0.6 | |
| cpuSpeed | Long | 0.6 | |
| allocatorStrategy | String | 0.6 | |
| createDate | Timestamp | 创建时间 | 0.6 |
| lastOpDate | Timestamp | 最后一次修改时间 | 0.6 |
| state | String | 0.6 | |
| guestOsType | String | 4.1.2 | |
| vmNics | List | 详情参考vmNics | 0.6 |
| allVolumes | List | 详情参考allVolumes | 0.6 |
| vmCdRoms | List | 详情参考vmCdRoms | 0.6 |
#vmNics
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
| vmInstanceUuid | String | 云主机UUID | 4.7.13 |
| l3NetworkUuid | String | 三层网络UUID | 4.7.13 |
| ip | String | 4.7.13 | |
| mac | String | 4.7.13 | |
| hypervisorType | String | 4.7.13 | |
| netmask | String | 4.7.13 | |
| gateway | String | 4.7.13 | |
| metaData | String | 4.7.13 | |
| ipVersion | Integer | 4.7.13 | |
| driverType | String | 4.7.13 | |
| internalName | String | 4.7.13 | |
| deviceId | Integer | 4.7.13 | |
| type | String | 4.7.13 | |
| state | String | 网卡状态 | 4.7.13 |
| createDate | Timestamp | 创建时间 | 4.7.13 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
| usedIps | List | 详情参考usedIps | 4.7.13 |
#usedIps
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 5.0.0 |
| ipRangeUuid | String | IP段UUID | 5.0.0 |
| l3NetworkUuid | String | 三层网络UUID | 5.0.0 |
| ipVersion | Integer | 5.0.0 | |
| ip | String | 5.0.0 | |
| netmask | String | 5.0.0 | |
| gateway | String | 5.0.0 | |
| usedFor | String | 分配原因 | 5.0.0 |
| ipInLong | long | 5.0.0 | |
| ipInBinary | byte[] | 5.2.0 | |
| vmNicUuid | String | 云主机网卡UUID | 5.0.0 |
| createDate | Timestamp | 创建时间 | 5.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 5.0.0 |
#allVolumes
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
| name | String | 资源名称 | 4.7.13 |
| description | String | 资源的详细描述 | 4.7.13 |
| primaryStorageUuid | String | 主存储UUID | 4.7.13 |
| vmInstanceUuid | String | 云主机UUID | 4.7.13 |
| diskOfferingUuid | String | 云盘规格UUID | 4.7.13 |
| rootImageUuid | String | 4.7.13 | |
| installPath | String | 4.7.13 | |
| type | String | 4.7.13 | |
| format | String | 4.7.13 | |
| size | Long | 4.7.13 | |
| actualSize | Long | 4.7.13 | |
| deviceId | Integer | 4.7.13 | |
| state | String | 4.7.13 | |
| status | String | 4.7.13 | |
| createDate | Timestamp | 创建时间 | 4.7.13 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
| isShareable | Boolean | 4.7.13 | |
| volumeQos | String | 4.7.13 | |
| lastDetachDate | Timestamp | 4.7.13 | |
| lastVmInstanceUuid | String | 4.7.13 |
#vmCdRoms
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.7.13 |
| vmInstanceUuid | String | 云主机UUID | 4.7.13 |
| deviceId | Integer | 4.7.13 | |
| isoUuid | String | 4.7.13 | |
| isoInstallPath | String | 4.7.13 | |
| name | String | 资源名称 | 4.7.13 |
| description | String | 资源的详细描述 | 4.7.13 |
| createDate | Timestamp | 创建时间 | 4.7.13 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.7.13 |
SDK示例
Java
SDK
UpdateConsolePasswordAction action = new UpdateConsolePasswordAction();
action.uuid = "efa69f6385e93855a2b07f4de8908fb1";
action.password = "new-password-123";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateConsolePasswordAction.Result res = action.call();Python
SDK
UpdateConsolePasswordAction action = UpdateConsolePasswordAction()
action.uuid = "efa69f6385e93855a2b07f4de8908fb1"
action.password = "new-password-123"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateConsolePasswordAction.Result res = action.call()