Call the ListTagResources operation to query the tags attached to a resource.
Operation description
When you call the ListTagResources operation, specify at least one of the tag key Tag.N.Key or the resource ID ResourceId.N. You can query all tags for a resource. You can also query tag values and the resources to which the tags are attached based on a specified tag key.
If you specify the tag key Tag.N.Key, you can query the tag value Tag.N.Value and the ID of the attached resource ResourceId.N.
If you specify the resource ID ResourceId.N, you can query all tag information for the specified resource, including the tag key Tag.N.Key and the tag value Tag.N.Value.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mq:ListTagResources |
get |
*All Resource
|
None |
|
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
No |
The ID of the instance where the tagged resource is located. Note
If you query tags for a topic or group, you must specify this parameter. |
MQ_INST_188077086902****_BXSuW61e |
| ResourceType |
string |
Yes |
The resource type. This is an enumeration. Valid values:
|
TOPIC |
| NextToken |
string |
No |
The token that is used to start the next page of a paginated query. |
caeba0****be03f84eb48b699f0a4883 |
| Tag |
array<object> |
No |
A list of tags. The list can contain a maximum of 20 elements. |
|
|
object |
No |
|||
| Key |
string |
No |
The tag key of the resource.
|
CartService |
| Value |
string |
No |
The tag value of the resource.
|
ServiceA |
| ResourceId |
array |
No |
A list of resource IDs. |
TopicA |
|
string |
No |
The ID of the resource to query.
|
test |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| NextToken |
string |
The token that is used to start the next page of a paginated query. |
caeba0****be03f84eb48b699f0a4883 |
| RequestId |
string |
The ID of the request. This is a common parameter. Each request has a unique ID. You can use this ID to locate and troubleshoot issues. |
301D2CBE-66F8-403D-AEC0-82582478**** |
| TagResources |
array<object> |
A collection of resources and their tags. The collection contains information such as resource IDs, resource types, and tag key-value pairs. |
|
|
object |
|||
| ResourceType |
string |
The resource type.
|
ALIYUN::MQ::TOPIC |
| InstanceId |
string |
The instance ID. |
MQ_INST_188077086902****_BXSuW61e |
| TagValue |
string |
The tag value. |
ServiceA |
| ResourceId |
string |
The resource ID. |
TopicA |
| TagKey |
string |
The tag key. |
CartService |
Examples
Success response
JSON format
{
"NextToken": "caeba0****be03f84eb48b699f0a4883",
"RequestId": "301D2CBE-66F8-403D-AEC0-82582478****",
"TagResources": [
{
"ResourceType": "ALIYUN::MQ::TOPIC",
"InstanceId": "MQ_INST_188077086902****_BXSuW61e",
"TagValue": "ServiceA",
"ResourceId": "TopicA",
"TagKey": "CartService"
}
]
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.