Creates tags for one or more PolarDB clusters.

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 TagResources

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

RegionId String Yes cn-hangzhou

The region ID of the cluster.

ResourceType String Yes cluster

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

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

The ID of the cluster. To create tags for multiple clusters at a time, click Add to add cluster IDs.

Note You can create tags for a maximum of 50 clusters at a time.
Tag.N.Key String No type

The key of the tag. To create multiple tags for a cluster at a time, click Add to add tag keys.

Note You can create up to 20 tags at a time. A tag consists of a key and a value. Each value of Tag.N.Key is paired with a value of Tag.N.Value.
Tag.N.Value String No test

The value of the tag. To create multiple tags for a cluster at a time, click Add to add tag values.

Note You can create up to 20 tags at a time. A tag consists of a key and a value. Each value of Tag.N.Value is paired with a value of Tag.N.Key.

Response parameters

Parameter Type Example Description
RequestId String 1CB5286F-AF5A-4E09-BFE9-588D4C******

The ID of the request.

Examples

Sample requests

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

Sample success responses

XML format

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

<TagResourcesResponse>
    <RequestId>1CB5286F-AF5A-4E09-BFE9-588D4C******</RequestId>
</TagResourcesResponse>

JSON format

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

{
  "RequestId" : "1CB5286F-AF5A-4E09-BFE9-588D4C******"
}

Error codes

HTTP status code Error code Error message Description
400 NumberExceed.Tags The number of tags is exceed , Valid : 20 The error message returned because the number of created tags exceeds the upper limit. You can create up to 20 tags for a cluster.

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