修改弹性裸金属实例密码(ChangeBareMetal2InstancePassword)
API请求
URLs
PUT /v1/baremetal2/bm-instances/{uuid}/actionHeaders
Authorization: OAuth the-session-uuidBody
{
"changeBareMetal2InstancePassword": {
"username": "root",
"password": "password"
},
"systemTags": [],
"userTags": []
}Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeBareMetal2InstancePassword":{"username":"root","password":"password"}}' http://localhost:8080/zstack/v1/baremetal2/bm-instances/f2c1f0101aef32c782ddd6a09899d296/action参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | url | 资源的UUID,唯一标示该资源 | 4.0.0 | |
| username | String | body(包含在changeBareMetal2InstancePassword结构中) | 用户名 | 4.0.0 | |
| password | String | body(包含在changeBareMetal2InstancePassword结构中) | 密码 | 4.0.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.0.0 | |
| userTags (可选) | List | body | 用户标签 | 4.0.0 |
API返回
返回示例
{
"inventory": {
"chassisUuid": "1c06589d9b39475d8da1488cedad433b",
"lastChassisUuid": "381c287319f040d6bfda27f2e873c495",
"gatewayUuid": "ee6e344efcac481f9fb135c83868f2a0",
"lastGatewayUuid": "77f3d8f675ae4fc1b52ddb35e64743ef",
"chassisOfferingUuid": "0799c5e4b9db480abf0072a74af99cbc",
"status": "Connected",
"uuid": "f615bc219c264801ae2d183071b55b44",
"name": "BM-1",
"description": "This is a BareMetal2 Instance.",
"zoneUuid": "f67ee2185540426495b410a3c8ea2ba9",
"clusterUuid": "146f701449f8455f9d0ab375c86c1de4",
"imageUuid": "9d8169d053c84ef5bee8f68225c95983",
"rootVolumeUuid": "794df7c17cbf451eaa86ad3124a0f577",
"platform": "Linux",
"type": "baremetal2",
"memorySize": 8.589934592E9,
"cpuNum": 8.0,
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM",
"state": "Running"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.0.0 |
| inventory | BareMetal2InstanceInventory | 详情参考inventory | 4.0.0 |
#error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.0.0 |
| description | String | 错误的概要描述 | 4.0.0 |
| details | String | 错误的详细信息 | 4.0.0 |
| elaboration | String | 保留字段,默认为null | 4.0.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.0.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.0.0 |
#inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| chassisUuid | String | 裸金属节点UUID | 4.0.0 |
| lastChassisUuid | String | 上次所在裸金属节点UUID | 4.0.0 |
| gatewayUuid | String | 裸金属网关节点UUID | 4.0.0 |
| lastGatewayUuid | String | 上次所在裸金属网关节点UUID | 4.0.0 |
| chassisOfferingUuid | String | 裸金属节点规格UUID | 4.0.0 |
| gatewayAllocatorStrategy | String | 裸金属网关节点分配策略 | 4.0.0 |
| status | String | 连接状态 | 4.0.0 |
| uuid | String | 资源的UUID,唯一标示该资源 | 4.0.0 |
| name | String | 资源名称 | 4.0.0 |
| description | String | 资源的详细描述 | 4.0.0 |
| zoneUuid | String | 区域UUID | 4.0.0 |
| clusterUuid | String | 集群UUID | 4.0.0 |
| imageUuid | String | 镜像UUID | 4.0.0 |
| rootVolumeUuid | String | 根云盘UUID | 4.0.0 |
| platform | String | 平台类型 | 4.0.0 |
| defaultL3NetworkUuid | String | 默认网络UUID | 4.0.0 |
| type | String | 类型 | 4.0.0 |
| hypervisorType | String | 虚拟化类型 | 4.0.0 |
| memorySize | Long | 内存容量 | 4.0.0 |
| cpuNum | Integer | CPU核数 | 4.0.0 |
| cpuSpeed | Long | CPU速率 | 4.0.0 |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
| state | String | 运行状态 | 4.0.0 |
| provisionNic | BareMetal2InstanceProvisionNicInventory | 详情参考provisionNic | 4.0.0 |
| vmNics | List | 详情参考vmNics | 4.0.0 |
| allVolumes | List | 详情参考allVolumes | 4.0.0 |
#provisionNic
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.0.0 |
| networkUuid | String | 裸金属部署网络UUID | 4.0.0 |
| interfaceName | String | 网卡名称 | 4.0.0 |
| ip | String | IP地址 | 4.0.0 |
| netmask | String | 子网掩码 | 4.0.0 |
| gateway | String | 网关地址 | 4.0.0 |
| metadata | String | 4.0.0 | |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
#vmNics
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.0.0 |
| vmInstanceUuid | String | 云主机UUID | 4.0.0 |
| l3NetworkUuid | String | 三层网络UUID | 4.0.0 |
| ip | String | IP地址 | 4.0.0 |
| mac | String | MAC地址 | 4.0.0 |
| hypervisorType | String | 虚拟化类型 | 4.0.0 |
| netmask | String | 子网掩码 | 4.0.0 |
| gateway | String | 网关 | 4.0.0 |
| metaData | String | 4.0.0 | |
| ipVersion | Integer | IP地址版本 | 4.0.0 |
| deviceId | Integer | 设备ID | 4.0.0 |
| type | String | 网卡类型 | 4.0.0 |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
| usedIps | List | 详情参考usedIps | 4.0.0 |
#usedIps
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.0.0 |
| ipRangeUuid | String | IP段UUID | 4.0.0 |
| l3NetworkUuid | String | 三层网络UUID | 4.0.0 |
| ipVersion | Integer | IP协议号 | 4.0.0 |
| ip | String | IP地址 | 4.0.0 |
| netmask | String | 网络掩码 | 4.0.0 |
| gateway | String | 网关地址 | 4.0.0 |
| usedFor | String | 4.0.0 | |
| ipInLong | long | 4.0.0 | |
| vmNicUuid | String | 云主机网卡UUID | 4.0.0 |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
#allVolumes
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.0.0 |
| name | String | 资源名称 | 4.0.0 |
| description | String | 资源的详细描述 | 4.0.0 |
| primaryStorageUuid | String | 主存储UUID | 4.0.0 |
| vmInstanceUuid | String | 云主机UUID | 4.0.0 |
| diskOfferingUuid | String | 云盘规格UUID | 4.0.0 |
| rootImageUuid | String | 云盘根镜像UUID | 4.0.0 |
| installPath | String | 云盘在主存储上的路径 | 4.0.0 |
| type | String | 云盘类型,数据云盘/根云盘 | 4.0.0 |
| format | String | 云盘格式 | 4.0.0 |
| size | Long | 云盘大小 | 4.0.0 |
| actualSize | Long | 云盘真实大小 | 4.0.0 |
| deviceId | Integer | 4.0.0 | |
| state | String | 云盘是否开启 | 4.0.0 |
| status | String | 云盘状态 | 4.0.0 |
| createDate | Timestamp | 创建时间 | 4.0.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.0.0 |
| isShareable | Boolean | 是否共享云盘 | 4.0.0 |
| volumeQos | String | 云盘Qos,格式如total=1048576 | 4.0.0 |
SDK示例
Java
SDK
ChangeBareMetal2InstancePasswordAction action = new ChangeBareMetal2InstancePasswordAction();
action.uuid = "f2c1f0101aef32c782ddd6a09899d296";
action.username = "root";
action.password = "password";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ChangeBareMetal2InstancePasswordAction.Result res = action.call();Python
SDK
ChangeBareMetal2InstancePasswordAction action = ChangeBareMetal2InstancePasswordAction()
action.uuid = "f2c1f0101aef32c782ddd6a09899d296"
action.username = "root"
action.password = "password"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ChangeBareMetal2InstancePasswordAction.Result res = action.call()