Queries the tags that are added to one or more PolarDB clusters, or queries the PolarDB clusters to which one or more tags are added.

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

ResourceType String Yes cluster

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

NextToken String No 212db86sca4384811e0b5e8707e******

The token required 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.

ResourceId.N String No pc-****************

The ID of the cluster. To query the tags of multiple clusters, click Add 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 added, click Add 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 create up to 20 tags at a time.
Tag.N.Value String No test

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

Response parameters

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

The token required 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 details of the clusters and tags that were queried.

TagResource
ResourceType String cluster

The type of the resource. This parameter is set to cluster.

TagValue String test

The values of the tags.

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

The ID of the cluster.

TagKey String type

The key of the tag.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/?Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=cluster
&NextToken=212db86sca4384811e0b5e8707e******
&ResourceId=[]
&Tag=[{"Key":"type","Value":"test"}]
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<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

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

For a list of error codes, see Service error codes.