All Products
Search
Document Center

Message Queue for Apache Kafka:ListTagResources

Last Updated:Feb 03, 2023

Queries the tags that are attached to a specified resource.

Authorization information

The following table is the authorization information corresponding to the API, which can be found in the RAM permission policy statement.Action Used in the element to grant the RAM user or RAM role permission to call this API. The specific instructions are as follows:

  • 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 keyword: refers to the condition keyword defined by the cloud product itself.
  • 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.
Operateaccess levelResource typeconditional keywordAssociation operation
alikafka:ListTagResourcesRead
    All resources
    without
without

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 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 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 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.

NoteYou must set at least one of the ResourceId and Tag parameters to query the tags of a specified resource. Otherwise, the request fails.
TagarrayNo

The tag list.

objectNo
KeystringNo

The tag key.

  • Valid values of N: 1 to 20.
  • If this parameter is not configured, all tag keys are matched.
  • The tag key can be up to 128 characters in length. The tag value cannot start with acs: or aliyun or contain http:// or https://.
FinanceDept
ValuestringNo

The tag value.

  • Valid values of N: 1 to 20.
  • If the Key parameter is not configured, you cannot configure this parameter. If this parameter is not configured, all tag values are matched.
  • The tag value can be 1 to 128 characters in length. The tag value cannot start with acs: or aliyun or 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****
TagResourcesarray

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

object
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

Example

Normal return example

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 API error center.