更新自定义属性键

PUT/zstack/v1/resource-attributes/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateResourceAttributeKey": {
    "description": "test"
  },
  "systemTags": [],
  "userTags": []
}

上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateResourceAttributeKey":{"description":"test"}}' \
http://localhost:8080/zstack/v1/resource-attributes/ff03a2b491023030bf58b1b35ea9cd00/actions

参数列表

名字类型位置描述可选值起始版本
uuidStringurl自定义属性键 UUID 4.10.16
name (可选)Stringbody(包含在updateResourceAttributeKey结构中)键名称 4.10.16
description (可选)Stringbody(包含在updateResourceAttributeKey结构中)资源的详细描述 4.10.16
resourceTypes (可选)Listbody(包含在updateResourceAttributeKey结构中)该属性支持的资源类型列表 4.10.16
createConstraints (可选)Listbody(包含在updateResourceAttributeKey结构中)新创建的限制 4.10.16
updateConstraints (可选)Listbody(包含在updateResourceAttributeKey结构中)更新的限制 4.10.16
deleteConstraintIds (可选)Listbody(包含在updateResourceAttributeKey结构中)删除的限制的 ID 列表 4.10.16
systemTags (可选)Listbody系统标签 4.10.16
userTags (可选)Listbody用户标签 4.10.16

API返回

返回示例

{
  "inventory": {
    "uuid": "ff03a2b491023030bf58b1b35ea9cd00",
    "name": "OperationsPersonnel",
    "description": "Kinny",
    "resourceTypes": [
      "VmInstanceVO"
    ],
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM",
    "constraints": [
      {
        "id": 1,
        "keyUuid": "ff03a2b491023030bf58b1b35ea9cd00",
        "type": "option",
        "parameter": "Kinny",
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ]
  }
}
名字类型描述起始版本
successboolean更新是否成功4.10.16
inventoryResourceAttributeKeyInventory详情参考inventory4.10.16
errorErrorCode详情参考error4.10.16

inventory

名字类型描述起始版本
uuidString自定义属性键 UUID4.10.16
nameString自定义属性键名称4.10.16
descriptionString资源的详细描述4.10.16
createDateTimestamp创建时间4.10.16
lastOpDateTimestamp最后一次修改时间4.10.16

error

名字类型描述起始版本
odeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10010.6
descriptionString错误的概要描述0.6
detailsString错误的详细信息0.6
elaborationString保留字段,默认为null0.6
opaqueLinkedHashMap保留字段,默认为null0.6
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null0.6

SDK示例

Java SDK

UpdateResourceAttributeKeyAction action = new UpdateResourceAttributeKeyAction();
action.uuid = "ff03a2b491023030bf58b1b35ea9cd00";
action.description = "test";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateResourceAttributeKeyAction.Result res = action.call();

Python SDK

action = UpdateResourceAttributeKeyAction()
action.uuid = "ff03a2b491023030bf58b1b35ea9cd00"
action.description = "test"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()