You can call this operation to query tags that are attached to one or more clusters, or clusters that have one or more tags attached.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListTagResources

The operation that you want to perform. Set the value to ListTagResources.

RegionId String Yes cn-hangzhou

The region ID of the cluster. You can call the DescribeRegions operation to query the most recent region list.

ResourceType String Yes cluster

The type of the resource. Set the value to cluster.

ResourceId.N RepeatList No am-bp1l20nxxxxxxxxxx

The ID of a cluster. You can query tags for a maximum of 50 clusters at a time. The N value must be an integer that starts from 1.

Note You must specify at least one of the ResourceId.N and the Tag.N.Key parameters.
Tag.N.Key String No testkey1

The key of Tag N. You can specify a maximum of 20 tag keys at a time. The N value must be an integer that starts from 1. This parameter cannot be an empty string.

Note You must specify at least one of the ResourceId.N and the Tag.N.Key parameters.
Tag.N.Value String No testvalue1

The key value of the tag. You can specify a maximum of 20 tag values at a time. The N value must be an integer that starts from 1. This parameter can be an empty string.

NextToken String No 212db86sca4384811e0b5e8707ec21345

The token required to obtain more results. This parameter is not required in the first query. If a query does not return all results, in the next query, you can provide the token returned by the previous query to retrieve more results.

Response parameters

Parameter Type Example Description
NextToken String 212db86sca4384811e0b5e8707ec21345

The token required to obtain more results. If a query does not return all results, this token can be entered in the next query to obtain more results.

RequestId String 184DE106-CB2C-4DD2-B57F-396652E6C8F8

The ID of the request.

TagResources Array of TagResource

The information of the clusters and tags that were queried.

TagResource
ResourceId String am-bp1l20nxxxxxxxxxx

The ID of a cluster.

ResourceType String cluster

The type of the resource. A value of cluster indicates an AnalyticDB for MySQL cluster.

TagKey String testkey1

The key of each tag.

TagValue String testvalue1

The key value of the tag.

Examples

Sample requests

http(s)://[Endpoint]/? Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=cluster
&<Common request parameters>

Sample success responses

XML format

<RequestId>184DE106-CB2C-4DD2-B57F-396652E6C8F8</RequestId>
<NextToken>212db86sca4384811e0b5e8707ec21345</NextToken>
<TagResources>
    <TagResource>
        <ResourceId>am-bp1l20nxxxxxxxxxx</ResourceId>
        <TagKey>testkey1</TagKey>
        <ResourceType>cluster</ResourceType>
        <TagValue>testvalue1</TagValue>
    </TagResource>
</TagResources>

JSON format

{
    "RequestId": "184DE106-CB2C-4DD2-B57F-396652E6C8F8",
    "NextToken": "212db86sca4384811e0b5e8707ec21345",
    "TagResources": {
        "TagResource": {
            "ResourceId": "am-bp1l20nxxxxxxxxxx",
            "TagKey": "testkey1",
            "ResourceType": "cluster",
            "TagValue": "testvalue1"
        }
    }
}

Error codes

For a list of error codes, visit the API Error Center.