为指定的ECS资源列表统一创建并绑定标签。
接口说明
接口说明
绑定标签前,阿里云会校验资源已有标签数量。超过限制值后返回报错信息。更多信息,请参见使用限制。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ecs:TagResources |
create |
DedicatedHost
Disk
NetworkInterface
Image
Instance
KeyPair
LaunchTemplate
ReservedInstance
SecurityGroup
Snapshot
AutoSnapshotPolicy
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
是 |
资源所属的地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。 |
cn-hangzhou |
| RegionId |
string |
是 |
资源所属的地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。 |
cn-hangzhou |
| ResourceType |
string |
是 |
资源类型定义。取值范围:
|
instance |
| ResourceId |
array |
是 |
资源 ID 数组。数组长度:1~50。 |
i-bp67acfmxazb4ph**** |
|
string |
否 |
资源 ID。 |
r-XXX |
|
| Tag |
array<object> |
是 |
标签数组。数组长度:1~20。如果数组中有多个标签对象,标签键 |
|
|
object |
否 |
标签对象。 |
||
| Key |
string |
是 |
标签键,不允许为空和空字符串。最多支持 128 个字符,不能以 |
TestKey |
| Value |
string |
是 |
标签值。不允许为空,可以为空字符串。最多支持 128 个字符,不能包含 |
TestValue |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
示例
正常返回示例
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | NumberExceed.ResourceIds | The ResourceIds parameter's number is exceed , Valid : 50. | 指定的ResourceIds参数的数量超过限制。 |
| 400 | NumberExceed.Tags | The Tags parameter's number is exceed , Valid : 20. | 指定的标签数量超过限制。 |
| 400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | 标签中存在重复的键,请保持键的唯一性。 |
| 400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | 指定的标签键参数有误。 |
| 400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | 指定的标签值参数有误。 |
| 400 | OperationDenied.QuotaExceed | The quota of tags on resource is beyond permitted range. | |
| 400 | InvalidTag.Mismatch | The specified Tag.n.Key and Tag.n.Value are not match. | 指定的 Tag.N.Key 和 Tag.N.Value 不匹配。 |
| 400 | InvalidTagCount | The specified tags are beyond the permitted range. | 指定的标记超出取值范围。 |
| 400 | Invalid.Scope | The specified scope is invalid. | |
| 500 | ServiceUnavailable | The service is unavailable, please try again later. | 服务暂时不可用,请稍候重试。 |
| 403 | PermissionDenied.TagOwnerBid | The specified operator not have permission to set TagOwnerBid value. | |
| 403 | PermissionDenied.TagOwnerUid | The specified operator not have permission to set TagOwnerUid value. | 无权设置标签归属者。 |
| 403 | PermissionDenied.Scope | The specified operator not have permission to set Scope value. | 指定的操作员无权设置范围值。 |
| 403 | InvalidResourceId.NotSupported | The specified ResourceId does not support tagging. | |
| 403 | NoPermissionKey.Scope | %s | |
| 403 | NoPermission.Tag | The operator is not permission for the tag. | 您没有操作该资源标签的权限。 |
| 403 | QuotaExceed.Tags | %s | 标签数超过可以配置的最大数量。%s为变量,将根据调用API的实际情况动态返回错误信息。 |
| 403 | TagKey.Duplication | The TagKey has duplication with others, case-insensitive. | 指定的 Tag.N.Key 参数中存在重复的取值。该参数的取值不区分大小写,请检查是否传入了重复的参数值。 |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | 地域信息错误 |
| 404 | MissingParameter.ResourceIds | The parameter - ResourceIds.N should not be null. | |
| 404 | MissingParameter.TagOwnerUid | The parameter - TagOwnerUid should not be null. | |
| 404 | MissingParameter.TagOwnerBid | The parameter - TagOwnerBid should not be null. | |
| 404 | MissingParameter.ResourceType | The parameter - ResourceType should not be null. | 参数ResourceType不能为空。 |
| 404 | MissingParameter.Tags | The parameter - Tags should not be null. | |
| 404 | MissingParameter.RegionId | The parameter - RegionId should not be null. | 必填参数RegionId为空。 |
| 404 | InvalidResourceId.NotFound | The specified ResourceIds are not found in our records. | 指定的资源不存在,请检查参数 ResourceId 是否正确。 |
| 404 | InvalidResourceType.NotFound | The ResourceType provided does not exist in our records. | 指定的资源类型不存在。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。