ListTagResources - Query tags for resources

Updated at:

Queries tags attached to one or more resources.

Debugging

You can call this API directly in OpenAPI Explorer. OpenAPI Explorer saves you the effort of calculating signatures. After a successful call, OpenAPI Explorer automatically generates sample SDK code.

Permissions

The following table lists the permissions required to call this API. To grant a RAM user or RAM role permission to call this API, add the required permissions to the Action element of a RAM policy statement.

  • Operation: The permission required to call the API.

  • Access level: The access level of the operation. Valid values: Write, Read, and List.

  • Resource type: The resource types that can be authorized. For more information, see the following descriptions:

    • Required resource types are highlighted.

    • If an operation does not support resource-level authorization, All resources is displayed in this column.

  • Condition key: The condition keys that are defined by the cloud service.

  • Associated operation: Other operations that must also be permitted for this operation to succeed.

Operation

Access level

Resource type

Condition key

Associated operation

alikafka:ListTagResources

Read

All resources

*

None

None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the resource.

cn-hangzhou

ResourceType

string

Yes

The type of the resource. Valid values:

  • INSTANCE: instance

  • TOPIC: topic

  • CONSUMERGROUP: consumer group

INSTANCE

NextToken

string

No

The token used to retrieve the next page of results.

caeba0bbb2be03f84eb48b699f0a4883

ResourceId

array

No

The resource IDs. The resource ID format varies by resource type:

  • Instance: instanceId

  • Topic: Kafka_alikafka_instanceId_topic

  • Consumer group: Kafka_alikafka_instanceId_consumerGroup

For example, if the instance ID is alikafka_post-cn-v0h1fgs2xxxx, the topic name is test-topic, and the consumer group name is test-consumer-group, the resource IDs are alikafka_post-cn-v0h1fgs2xxxx, Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-topic, and Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-consumer-group, respectively.

Note

You must specify either the ResourceId parameter or the Tag parameter to query tags for a resource. Otherwise, the API call fails.

string

No

The resource ID.

alikafka_post-cn-v0h1fgs2****

Tag

array<object>

No

A list of tags.

object

No

A tag.

Key

string

No

The tag key of the resource.

  • If you leave this parameter empty, all tag keys are matched.

  • The tag key can be up to 128 characters in length and cannot start with aliyun or acs:. The tag key cannot contain http:// or https://.

FinanceDept

Value

string

No

The tag value of the resource.

  • This parameter must be empty if the Key parameter is empty. If you specify a key but leave this parameter empty, all tag values for that key are matched.

  • The tag value can be up to 128 characters in length and cannot start with aliyun or acs:. The tag value cannot contain http:// or https://.

FinanceJoshua

Response parameters

Parameter

Type

Description

Example

NextToken

string

The token used to retrieve the next page of results.

caeba0bbb2be03f84eb48b699f0a4883

RequestId

string

The request ID.

DE65F6B7-7566-4802-9007-96F2494A****

TagResources

array<object>

The list of resources and their tags.

TagValue

string

The tag value.

FinanceJoshua

ResourceType

string

The type of the resource. Valid values:

  • Instance

  • Topic

  • ConsumerGroup

Instance

ResourceId

string

The resource ID. The format of the resource ID varies based on the resource type:

  • Instance: instanceId

  • Topic: Kafka_alikafka_instanceId_topic

  • Consumer group: Kafka_alikafka_instanceId_consumerGroup

For example, if the instance ID is alikafka_post-cn-v0h1fgs2xxxx, the topic name is test-topic, and the consumer group name is test-consumer-group, the resource IDs are alikafka_post-cn-v0h1fgs2xxxx, Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-topic, and Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-consumer-group, respectively.

alikafka_post-cn-v0h1fgs2****

TagKey

string

The tag key.

FinanceDept

Examples

Sample response

{
  "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 common error codes, see Common error codes.

Change history

Date

Description

Actions

2024-08-15

Updated the OpenAPI description.

View change details

2023-11-09

Updated internal API configurations. The API call behavior is unchanged.

View change details