All Products
Search
Document Center

ApsaraMQ for Kafka:ListTagResources

Last Updated:Mar 15, 2024

Queries the tags that are attached to a 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
alikafka:ListTagResourcesRead
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The ID of the region in which the resource is deployed.

cn-hangzhou
ResourceTypestringYes

The type of the resource whose tags you want to query. The value is an enumerated value. Valid values:

  • INSTANCE
  • TOPIC
  • CONSUMERGROUP
INSTANCE
NextTokenstringNo

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

caeba0bbb2be03f84eb48b699f0a4883
ResourceIdarrayNo

The resource ID. The following items describe the formats of resource IDs:

  • Instance ID: instanceId
  • Topic ID: Kafka_alikafka_instanceId_topic
  • Group ID: Kafka_alikafka_instanceId_consumerGroup

For example, you create an instance whose ID is alikafka_post-cn-v0h1fgs2xxxx, a topic whose name is test-topic, and a group whose ID is test-consumer-group. In this case, the resource IDs are alikafka_post-cn-v0h1fgs2xxxx, Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-topic, and Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-consumer-group.

Note You must specify one of the ResourceId and Tag parameters to query the tags that are attached to a resource. Otherwise, the call fails.
stringNo
alikafka_post-cn-v0h1fgs2****
Tagobject []No

The tags.

KeystringNo

The tag key.

  • If you leave this parameter empty, the keys of all tags are matched.
  • The tag key must be 1 to 128 characters in length and cannot start with acs: or aliyun. The tag key cannot contain http:// or https://.
FinanceDept
ValuestringNo

The tag value.

  • If you do not specify the tag key, you cannot specify the tag value. If you leave this parameter empty, the values of all tags are matched.
  • The tag value must be 1 to 128 characters in length and cannot start with acs: or aliyun. The tag value cannot contain http:// or https://.
FinanceJoshua

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

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

caeba0bbb2be03f84eb48b699f0a4883
RequestIdstring

The ID of the request.

DE65F6B7-7566-4802-9007-96F2494A****
TagResourcesobject []

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

TagValuestring

The value of the tag.

FinanceJoshua
ResourceTypestring

The type of the resource. The value is an enumerated value. Valid values:

  • Instance
  • Topic
  • Consumergroup
instance
ResourceIdstring

The ID of the resource. A resource ID complies with the following rules:

  • The resource ID of an instance is the value of the instanceId parameter.
  • The resource ID of a topic is the value of the Kafka_alikafka_instanceId_topic parameter.
  • The resource ID of a consumer group is the value of the Kafka_alikafka_instanceId_consumerGroup parameter.

For example, the resources whose tags you want to query include the alikafka_post-cn-v0h1fgs2xxxx instance, the test-topic topic, and the test-consumer-group consumer group. In this case, their resource IDs are alikafka_post-cn-v0h1fgs2xxxx, Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-topic, and Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-consumer-group.

alikafka_post-cn-v0h1fgs2****
TagKeystring

The key of the tag.

FinanceDept

Examples

Sample success responses

JSONformat

{
  "NextToken": "caeba0bbb2be03f84eb48b699f0a4883",
  "RequestId": "DE65F6B7-7566-4802-9007-96F2494A****",
  "TagResources": {
    "TagResource": [
      {
        "TagValue": "FinanceJoshua",
        "ResourceType": "instance",
        "ResourceId": "alikafka_post-cn-v0h1fgs2****",
        "TagKey": "FinanceDept"
      }
    ]
  }
}

Error codes

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

Change history

Change timeSummary of changesOperation
2023-11-09The internal configuration of the API is changed, but the call is not affectedsee changesets
Change itemChange content
The internal configuration of the API is changed, but the call is not affected.