阅读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-阿里云