更新事件订阅的标签
Headers
Authorization: OAuth the-session-uuidBody
{
"updateEventSubscriptionLabel": {
"key": "VMUuid",
"value": "42c233c17c6e4907b7be1f11a41f3a17",
"operator": "Equal"
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示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结构中) | 标签的新操作符 |
| 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"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 3.9.0 |
| inventory | EventSubscriptionLabelInventory | 详情参考inventory | 3.9.0 |
error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 3.9.0 |
| description | String | 错误的概要描述 | 3.9.0 |
| details | String | 错误的详细信息 | 3.9.0 |
| elaboration | String | 保留字段,默认为null | 3.9.0 |
| opaque | LinkedHashMap | 保留字段,默认为null | 3.9.0 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 3.9.0 |
inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 3.9.0 |
| key | String | 标签名 | 3.9.0 |
| value | String | 标签值 | 3.9.0 |
| operator | Operator | 详情参考operator | 3.9.0 |
operator
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| op | String | 3.9.0 | |
| name | String | 资源名称 | 3.9.0 |
| ordinal | int | 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()