All Products
Search
Document Center

ApsaraMQ for RocketMQ:ListTagResources

Last Updated:Mar 03, 2024

Queries the tags that are attached to a specified resource.

Operation description

Note API operations provided by Alibaba Cloud are used to manage and query resources of Alibaba Cloud services. We recommend that you integrate these API operations only in management systems. Do not use these API operations in the core system of messaging services. Otherwise, system risks may occur.

When you call the ListTagResources operation, specify at least one of the following parameters in the request: Key and ResourceId. You can specify a resource ID to query all tags that are attached to the specified resource. You can also specify a tag key to query the tag value and resource to which the tag is attached.

  • If you include the Key parameter in a request, you can obtain the tag value and the ID of the resource to which the tag is attached.
  • If you include the ResourceId parameter in a request, you can obtain the keys and values of all tags that are attached to the specified resource.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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.
OperationAccess levelResource typeCondition keyAssociated operation
mq:ListTagResourcesList
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringNo

The ID of the ApsaraMQ for RocketMQ instance to which the resource whose tags you want to query belongs.

Note This parameter is required when you query the tags of a topic or a group.
MQ_INST_188077086902****_BXSuW61e
ResourceTypestringYes

The type of the resource whose tags you want to query. Valid values:

  • INSTANCE
  • TOPIC
  • GROUP
TOPIC
NextTokenstringNo

The token that determines the start point of the next query.

caeba0****be03f84eb48b699f0a4883
Tagobject []No

The tags that you want to query. A maximum of 20 tags can be included in the list.

KeystringNo

The key of the tag that you want to detach from the resource.

  • If you include this parameter in a request, the value of this parameter cannot be an empty string.
  • The tag value can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.
CartService
ValuestringNo

The value of the tag that you want to query.

  • The value of this parameter can be an empty string.
  • The tag key must be 1 to 128 characters in length and cannot contain http:// or https://. It cannot start with acs: or aliyun.
ServiceA
ResourceIdarrayNo

The list of resource IDs.

stringNo

The ID of the resource whose tags you want to query.

  • If the resource is a ApsaraMQ for RocketMQ instance, set the value of this parameter to the ID of the instance.
  • If the resource is a topic, set the value of this parameter to the name of the topic.
  • If the resource is a group, set the value of this parameter to the ID of the group.
test

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

The token that determines the start point of the next query.

caeba0****be03f84eb48b699f0a4883
RequestIdstring

The ID of the request. This parameter is a common parameter. Each request has a unique ID. You can use this ID to troubleshoot issues.

301D2CBE-66F8-403D-AEC0-82582478****
TagResourcesobject []

Details of the resource and tags, including the resource ID, the resource type, tag keys, and tag values.

ResourceTypestring

The type of the resource whose tags you want to query.

  • ALIYUN::MQ::INSTANCE: indicates that the resource is a ApsaraMQ for RocketMQ instance.
  • ALIYUN::MQ::TOPIC: indicates that the resource is a topic.
  • ALIYUN::MQ::GROUP: indicates that the resource is a group.
ALIYUN::MQ::TOPIC
InstanceIdstring

The ID of the instance

MQ_INST_188077086902****_BXSuW61e
TagValuestring

The tag value.

ServiceA
ResourceIdstring

Indicates the ID of the resource.

TopicA
TagKeystring

The tag key.

CartService

Examples

Sample success responses

JSONformat

{
  "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

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history

Query resource tags in the console

You can also query the tags that are attached to a resource in the ApsaraMQ for RocketMQ console.**** For more information, see Manage tags.