更新事件订阅的标签

PUT/zstack/v1/zwatch/events/subscriptions/labels/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateEventSubscriptionLabel": {
    "key": "VMUuid",
    "value": "42c233c17c6e4907b7be1f11a41f3a17",
    "operator": "Equal"
  },
  "systemTags": [],
  "userTags": []
}

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

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateEventSubscriptionLabel":{"key":"VMUuid","value":"228fc2c5041248df9b0d317f6f7a8585","operator":"Equal"}}' http://localhost:8080/zstack/v1/zwatch/events/subscriptions/labels/cfb859d412933a1da57ae99e2aa442ce/actions

参数列表

名字

类型

位置

描述

可选值

起始版本

uuid

String

url

原事件订阅标签的UUID,唯一标示该资源

 

3.9.0

key

String

body(包含在updateEventSubscriptionLabel结构中)

标签的新名

 

3.9.0

value

String

body(包含在updateEventSubscriptionLabel结构中)

标签的新值

 

3.9.0

operator

String

body(包含在updateEventSubscriptionLabel结构中)

标签的新操作符

  • Regex
  • Equal

3.9.0

systemTags (可选)

List

body

 

 

3.9.0

userTags (可选)

List

body

 

 

3.9.0

API返回

返回示例

{
  "inventory": {
    "uuid": "d937a1c6d9de3f2285b0cb23316624a8",
    "key": "VMUuid",
    "operator": "Equal",
    "value": "19cf33283b484ff6b73a6d98e1d762f5"
  }
}
名字类型描述起始版本
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error3.9.0
inventoryEventSubscriptionLabelInventory详情参考inventory3.9.0

error

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

inventory

名字类型描述起始版本
uuidString资源的UUID,唯一标示该资源3.9.0
keyString标签名3.9.0
valueString标签值3.9.0
operatorOperator详情参考operator3.9.0

operator

名字类型描述起始版本
opString 3.9.0
nameString资源名称3.9.0
ordinalint 3.9.0

SDK示例

Java SDK

UpdateEventSubscriptionLabelAction action = new UpdateEventSubscriptionLabelAction();
action.uuid = "cfb859d412933a1da57ae99e2aa442ce";
action.key = "VMUuid";
action.value = "9d7099dd361049aaaf801ca6b17b2858";
action.operator = "Equal";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateEventSubscriptionLabelAction.Result res = action.call();

Python SDK

UpdateEventSubscriptionLabelAction action = UpdateEventSubscriptionLabelAction()
action.uuid = "cfb859d412933a1da57ae99e2aa442ce"
action.key = "VMUuid"
action.value = "27e59f9fe7ed46118a2f6b8a383ce494"
action.operator = "Equal"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateEventSubscriptionLabelAction.Result res = action.call()