查询一个或多个ECS资源已经绑定的标签列表
接口说明
接口说明
请求中至少指定以下任一参数,以确定查询对象。
ResourceId.NTag.N(Tag.N.Key与Tag.N.Value)TagFilter.N
同时指定下列参数时,返回结果中仅包含同时满足这两个条件的 ECS 资源。
Tag.N和ResourceId.NTagFilter.N和ResourceId.N
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ecs:ListTagResources |
get |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
是 |
资源所属的地域 ID,您可以调用 DescribeRegions 查看最新的阿里云地域列表。 |
cn-hangzhou |
| RegionId |
string |
是 |
资源所属的地域 ID,您可以调用 DescribeRegions 查看最新的阿里云地域列表。 |
cn-hangzhou |
| NextToken |
string |
否 |
下一个查询开始 Token。 |
caeba0bbb2be03f84eb48b699f0a4883 |
| ResourceType |
string |
是 |
资源类型定义。取值范围:
|
instance |
| ResourceId |
array |
否 |
ECS 资源 ID。N 的取值范围为 1~50。 |
i-bp1j6qtvdm8w0z1o**** |
|
string |
否 |
ECS 资源 ID。N 的取值范围为 1~50。 |
i-bp1j6qtvdm8w0z1o**** |
|
| Tag |
array<object> |
否 |
标签列表。 |
|
|
object |
否 |
标签列表。 |
||
| Key |
string |
否 |
精确查找 ECS 资源时使用的标签键。标签键长度的取值范围为 1~128。N 的取值范围为 1~20。
|
TestKey |
| Value |
string |
否 |
精确查找 ECS 资源时使用的标签值。标签值长度的取值范围为 1~128。N 的取值范围为 1~20。 说明
当 |
TestValue |
| TagFilter |
array<object> |
否 |
Tag 过滤规则。 说明
该参数正在邀测中,暂未开放使用。 |
|
|
object |
否 |
Tag 过滤规则。 |
||
| TagValues |
array |
否 |
模糊查找 ECS 资源时使用的标签值。标签值长度的取值范围为 1~128。N 的取值范围为 1~5。具体的参数说明请参见 |
TestTagFilter |
|
string |
否 |
模糊查找 ECS 资源时使用的标签值。标签值长度的取值范围为 1~128。N 的取值范围为 1~5。具体的参数说明请参见 |
TestTagFilter |
|
| TagKey |
string |
否 |
模糊查找 ECS 资源时使用的标签键。标签键长度的取值范围为 1~128。N 的取值范围为 1~5。
说明
|
env |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| NextToken |
string |
下一个查询开始 Token。 |
caeba0bbb2be03f84eb48b699f0a4883 |
| RequestId |
string |
请求 ID。 |
484256DA-D816-44D2-9D86-B6EE4D5BA78C |
| TagResources |
object |
||
| TagResource |
array<object> |
由资源及其标签组成的集合,包含了资源 ID、资源类型和标签键值等信息。 |
|
|
object |
|||
| TagValue |
string |
标签值。 |
TestValue |
| ResourceType |
string |
资源类型。可能值:
|
instance |
| ResourceId |
string |
资源 ID。 |
i-bp1j6qtvdm8w0z1o**** |
| TagKey |
string |
标签键。 |
TestKey |
示例
正常返回示例
JSON格式
{
"NextToken": "caeba0bbb2be03f84eb48b699f0a4883",
"RequestId": "484256DA-D816-44D2-9D86-B6EE4D5BA78C",
"TagResources": {
"TagResource": [
{
"TagValue": "TestValue",
"ResourceType": "instance",
"ResourceId": "i-bp1j6qtvdm8w0z1o****",
"TagKey": "TestKey"
}
]
}
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidDefaultResourceGroup.NotSupported | The specified parameter Tag is not support for default resource group. | 不支持查询默认资源组。 |
| 400 | InvalidTag.NotSupported | You can only specify Tag for either resource tag or resource group. | 不支持同时查询资源组和标签。 |
| 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. | |
| 400 | InvalidTags.MalFormed | The tags must be empty, when the tagFilters is not empty. | |
| 500 | ServiceUnavailable | The service is unavailable, please try again later. | 服务暂时不可用,请稍候重试。 |
| 500 | InternalError | The process of creating snapshot has failed due to some unknown error. | 创建快照失败。 |
| 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 | NoPermission.Tag | The operator is not permission for the tag. | 您没有操作该资源标签的权限。 |
| 403 | BothEmpty.TagsAndResources | The specified Tags and ResourcesIds are not allow to both empty. | 传入的参数必须包含Tags或ResourcesIds其中的至少一个。 |
| 403 | PermissionDenied.TagsFuzzyQuery | The specified operator has not permission to query fuzzy tags. | |
| 403 | NumberExceed.TagValues | The number of the specified TagValues is beyond permitted range, the max is 5. | |
| 403 | InvalidFilter.Malformed | The specified Filter is not valid. | |
| 403 | InvalidTagFilter.Malformed | The specified TagFilter is not valid. | |
| 403 | Invalid.NextToken | The specified NextToken is not valid. | |
| 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. | 指定的资源类型不存在。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。