閱讀336 返回首頁    go 阿裏雲


綁定標簽__標簽相關接口_API 參考_雲服務器 ECS-阿裏雲

描述

  • Tag 容許被創建在 ECS 的實例、磁盤、快照、鏡像、安全組上。

  • 每個資源最多可以綁定 10 個 Tag。

  • 如果要綁定 Tag 的 Key 在指定的資源上已經存在,則覆蓋 Value。

  • Tag.n.Key 與 Tag.n.Value 必須一一匹配。

請求參數

名稱 類型 是否必須 描述
Action String 操作接口名,AddTags。
RegionId String 資源所屬地域。
ResourceId String 要創建 Tag 的資源 ID。
ResourceType String 資源類型:
  • image
  • instance
  • snapshot
  • disk
  • securitygroup
所有值均為小寫。
Tag.n.Key String 標簽 key,n 從 1 開始,最大為 5。
最多支持 64 個字符
不支持 aliyun 開頭
不支持 https:// 和 https:// 開頭
不允許為空字符串。
Tag.n.Value String 標簽 value,n 從 1 開始,最大為 5。
最多支持 128 個字符
不支持 aliyun 開頭
不支持 https:// 和 https:// 開頭
允許為空字符串。

返回參數

名稱 類型 描述
RequestId String 請求 ID

錯誤碼

錯誤代碼 描述 Http狀態碼 語義
MissingParameter The input parameter "ResourceId" that is mandatory for processing this request is not supplied. 400 ResourceId 參數未指定
InvalidResourceId.NotFound The specified ResourceId is not found in our records 404 指定的 ResourceId 不存在
MissingParameter The input parameter "RegionId" that is mandatory for processing this request is not supplied. 400 RegionId 參數未指定
InvalidRegionId.NotFound The RegionId provided does not exist in our records. 404 指定的 RegionId 不存在
MissingParameter The input parameter "ResourceType" that is mandatory for processing this request is not supplied. 400 ResourceType 參數未指定
InvalidResourceType.NotFound The ResourceType provided does not exist in our records. 404 指定的 ResourceType 不存在
MissingParameter.TagKey The input parameter "Tag.n.Key" that is mandatory for processing this request is not supplied. 400 Tag.n.Key 參數未指定
InvalidTagKey.Malformed The specified Tag.n.Key is not valid 400 指定的 Tag.n.Key 不合法
MissingParameter.TagValue The input parameter "Tag.n.Value" that is mandatory for processing this request is not supplied. 400 Tag.n.Value 參數未指定
InvalidTagValue.Malformed The specified Tag.n.Value is not valid 400 指定的 Tag.n.Value 不合法
OperationDenied.QuotaExceed The quota of tags on resource is beyond permitted range 400 資源上的用戶 Tag 已經超過 10 個
InvalidTag.Mismatch The specified Tag.n.Key and Tag.n.Value are not match 400 Tag.n.Key 和 Tag.n.Value 沒有一一對應
InvalidTagCount The specified tags are beyond the permitted range 400 指定的 Tag 數超過了 5 個
InvalidResourceId.NotSupported The specified ResourceId does not support tagging 403 指定的資源 ID 不支持打 Tag

示例

請求示例

https://ecs.aliyuncs.com/?Action=AddTags
&ResourceId=s-946ntx4wr
&ResourceType=snapshot
&RegionId=cn-shenzhen
&Tag.1.Key=test
&Tag.1.Value=api
&<公共請求參數>

返回示例

XML格式

<AddTagsResponse>
    <RequestId>C46FF5A8-C5F0-4024-8262-B16B639225A0</RequestId>
</AddTagsResponse>

JSON格式

{
  "RequestId": "C46FF5A8-C5F0-4024-8262-B16B639225A0"
}

最後更新:2016-11-23 16:03:51

  上一篇:go 刪除虛擬邊界路由器__高速通道相關接口_API 參考_雲服務器 ECS-阿裏雲
  下一篇:go 解綁標簽__標簽相關接口_API 參考_雲服務器 ECS-阿裏雲