虚拟机相关接口
更新分组目录
Headers
Authorization: OAuth the-session-uuidBody
{
"updateDirectory": {
"uuid": "66a79f93fd5d3d269302297dc1459f6e",
"name": "test"
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateDirectory":{"uuid":"66a79f93fd5d3d269302297dc1459f6e","name":"test"}}' http://localhost:8080/zstack/v1/update/directory参数列表
| 名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
| uuid | String | body(包含在updateDirectory结构中) | 资源的UUID,唯一标示该资源 | 4.6.0 | |
| name | String | body(包含在updateDirectory结构中) | 资源名称 | 4.6.0 | |
| systemTags (可选) | List | body | 系统标签 | 4.6.0 | |
| userTags (可选) | List | body | 用户标签 | 4.6.0 |
API返回
返回示例
{
"inventory": {
"uuid": "ce9c80c271df30eba545af5b7efc6b09",
"name": "test",
"groupName": "admin/first/second",
"parentUuid": "5cc7f45b66783385b3f4a9d1ef109a5d",
"rootDirectoryUuid": "57290934e96a305fbdad6ccb33bb64b8",
"zoneUuid": "b103949274663c19b9675ea6f6505dd5",
"type": "default"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 4.6.0 | |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.6.0 |
| inventory | VmInstanceInventory | 详情参考inventory | 4.6.0 |
error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 4.6.0 |
| description | String | 错误的概要描述 | 4.6.0 |
| details | String | 错误的详细信息 | 4.6.0 |
| elaboration | String | 保留字段,默认为null | 4.6.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 4.6.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 4.6.0 |
inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.6.0 |
| name | String | 资源名称 | 4.6.0 |
| groupName | String | 所属分组 | 4.6.0 |
| parentUuid | String | 父级目录UUID | 4.6.0 |
| rootDirectoryUuid | String | 根目录UUID | 4.6.0 |
| zoneUuid | String | 数据中心UUID | 4.6.0 |
| type | String | 目录类型 | 4.6.0 |
| createDate | Timestamp | 创建时间 | 4.6.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.6.0 |
SDK示例
Java SDK
UpdateDirectoryAction action = new UpdateDirectoryAction();
action.uuid = "66a79f93fd5d3d269302297dc1459f6e";
action.name = "test";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateDirectoryAction.Result res = action.call();Python SDK
UpdateDirectoryAction action = UpdateDirectoryAction()
action.uuid = "66a79f93fd5d3d269302297dc1459f6e"
action.name = "test"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateDirectoryAction.Result res = action.call()