Queries the tags that are added to cloud resources. Instance resources are supported.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
cr:ListTagResources | get | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ResourceType | string | Yes | The type of the resources. Instance resources are supported. | Instance |
ResourceId | array | No | The resource IDs. You can specify a maximum of 20 resource IDs. | |
string | No | The resource ID. | cri-5w1ztcu2kruj**** | |
RegionId | string | Yes | The ID of the region in which the resources are deployed. | cn-hangzhou |
Tag | array<object> | No | The tag list. | |
object | No | The tag list. | ||
Key | string | No | The tag key of the resource. You can specify up to 20 tag keys. The tag key cannot be an empty string. A tag key can be up to 128 characters in length. It cannot start with acs: or aliyun, and cannot contain http:// or https://. | test-key |
Value | string | No | The tag value of the resource. You can specify up to 20 tag values. The tag value can be an empty string. It can be up to 128 characters in length. It cannot start with acs: or aliyun and cannot contain http:// or https://. | test-val |
NextToken | string | No | The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request or if no next query exists. You must specify the token that is obtained from the previous query as the value of NextToken. | AAAAAfj+3fkqd8igM6VLaQjlaYc= |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "7FF809ED-B42F-5AC3-9A17-CFE14BE32A8E",
"TagResources": {
"TagResource": [
{
"TagKey": "test-key\n",
"TagValue": "test-val",
"ResourceId": "cri-w19e7qr2wibl****",
"ResourceType": "Instance"
}
]
},
"NextToken": "AAAAAfj+3fkqd8igM6VLaQjlaYc=\n"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | SystemError | A system error occurred while processing your request |
400 | InvalidParameter.ResourceType | The ResourceType parameter is invalid. |
400 | MissingParameter.ResourceIdsOrTags | You must specify ResourceId.N or Tags. |
400 | MissingParameter.ResourceType | You must specify ResourceType. |
400 | MissingParameter.TagKey | You must specify Tag.N.Key. |
400 | NumberExceed.ResourceIds | The maximum number of ResourceIds is exceeded. |
400 | NumberExceed.Tags | The maximum number of Tags is exceeded. |
400 | Duplicate.TagKey | The Tag.N.Key contains duplicate keys. |
400 | InvalidParameter.NextToken | The NextToken parameter is invalid. |
403 | NoPermission | The operator is not permission for this operate |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-04-01 | The Error code has changed | View Change Details |