You can call this operation to query tags associated with one or more ApsaraDB for PolarDB clusters, or query the APsaraDB for PolarDB clusters associated with one or more tags.

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
RegionId String Yes cn-hangzhou

The region ID of your ApsaraDB for PolarDB 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.

Action String No ListTagResources

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

AccessKeyId String No LTAIfCxxxxxxx

The AccessKey ID provided to you by Alibaba Cloud.

ResourceId.N RepeatList No pc-bp1l20nxxxxxxxxxx

The ID of Cluster N. You can specify multiple clusters in one request. Valid values of N: 1 to 50.

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 multiple tags in one request. Valid values of N: 1 to 20. 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 value of Tag N. You can specify multiple tags in one request. Valid values of N: 1 to 20. 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 the first query does not return all results, you can provide the token returned from the first query in the next query to obtain more results.

Response parameters

Parameter Type Example Description
NextToken String 212db86sca4384811e0b5e8707ec21345

The token required to obtain more results. If not all results are returned in this query, you can provide this token in the next query to obtain more results.

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

The ID of the request.

TagResources Array

The information about the clusters and tags that were queried.

TagResource

The information about the clusters and tags that were queried.

ResourceId String pc-bp1l20nxxxxxxxxxx

The ID of the cluster.

ResourceType String cluster

The resource type. A value of cluster indicates an ApsaraDB for PolarDB cluster.

TagKey String testkey1

The key of the tag.

TagValue String testvalue1

The value of the tag.

Examples

Sample requests


http(s)://polardb.aliyuncs.com/? Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=cluster
&ResourceId.1=pc-bp1l20nxxxxxxxxxx
&Tag.1.Key=testkey1
&<Common request parameters>

Sample success responses

XML format

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

JSON format

{
	"TagResources":{
		"TagResource":[
			{
				"ResourceType":"cluster",
				"TagValue":"testvalue1",
				"ResourceId":"pc-bp1l20nxxxxxxxxxx",
				"TagKey":"testkey1"
			}
		]
	},
	"RequestId":"184DE106-CB2C-4DD2-B57F-396652E6C8F8"
}

Error codes

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