Queries the tags that are attached to one or more PolarDB clusters, or queries the PolarDB clusters to which one or more tags are 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 No ListTagResources

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

RegionId String Yes cn-hangzhou

The ID of the region. 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 pc-****************

The ID of the cluster. To query the tags of multiple clusters, click the plus sign (+) icon to add cluster IDs.

Note
  • You must specify at least one of the ResourceId.N and Tag.N.Key parameters.
  • If you specify the ResourceId.N parameter, you can add a maximum of 50 cluster IDs at a time.
Tag.N.Key String No type

The key of the tag. To query the details of clusters to which multiple tags are attached, click the plus sign (+) icon to add tags.

Note
  • You must specify at least one of the ResourceId.N and Tag.N.Key parameters.
  • If you specify the Tag.N.Key parameter, you can add up to 20 key-value pairs of tags at a time.
Tag.N.Value String No test

The tag value that is paired with the tag key. This parameter can be an empty string.

NextToken String No 212db86sca4384811e0b5e8707e******

The token that is used to obtain more results. This parameter is not required in the first query. If the first query does not return all results, you can use the token that is returned from the first query in the next query to obtain more results.

Response parameters

Parameter Type Example Description
NextToken String 212db86sca4384811e0b5e8707e******

The token that was used to obtain more results. If not all results are returned in this query, the token is returned. You can use this token in the next query to obtain more results.

RequestId String 688C04E4-23F8-409F-8A38-B954D5******

The ID of the request.

TagResources Array of TagResource

The information about the clusters and tags that were queried.

TagResource
ResourceId String pc-****************

The ID of the cluster.

ResourceType String cluster

The type of the resource. The returned value is cluster.

TagKey String type

The key of the tag.

TagValue String test

The value of the tag.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/? Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=cluster
&<Common request parameters>

Sample success responses

XML format

<ListTagResourcesResponse>
  <RequestId>688C04E4-23F8-409F-8A38-B954D5******</RequestId>
  <TagResources>
        <TagResource>
              <ResourceId>pc-***************</ResourceId>
              <TagKey>type</TagKey>
              <ResourceType>cluster</ResourceType>
              <TagValue>test</TagValue>
        </TagResource>
  </TagResources>
</ListTagResourcesResponse>

JSON format

{
    "RequestId": "688C04E4-23F8-409F-8A38-B954D5******",
    "TagResources": {
        "TagResource": [
            {
                "ResourceId": "pc-***************",
                "TagKey": "type",
                "ResourceType": "cluster",
                "TagValue": "test"
            }
        ]
    }
}

Error codes

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