All Products
Search
Document Center

ApsaraDB for Redis:TagResources

Last Updated:Oct 09, 2024

Adds specified tags to one or more ApsaraDB for Redis instances.

Operation description

If you have a large number of instances, you can create multiple tags and add these tags to the instances. Then, you can filter instances by tag.

  • A tag consists of a key and a value. Each key must be unique in a region for an Alibaba Cloud account. Different keys can be mapped to the same value.
  • If the tag that you specify does not exist, this tag is automatically created and added to the specified instance.
  • If the key of the specified tag is the same as that of an existing tag, the specified tag overwrites the existing tag.
  • You can add up to 20 tags to each instance.
  • You can add tags to up to 50 instances in each request.

You can also add tags to instances in the ApsaraDB for Redis console. For more information, see Create a tag.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
kvstore:TagResourcescreate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the instance.

cn-hangzhou
ResourceTypestringYes

The resource type. Set the value to INSTANCE.

INSTANCE
ResourceIdarrayYes

The ID of the instance.

stringYes

The ID of the instance. You can specify multiple IDs.

Note This parameter indicates the ID of the Nth instance. For example, ResourceId.1 specifies the ID of the first instance and ResourceId.2 specifies the ID of the second instance.
r-bp1zxszhcgatnx****
Tagarray<object>Yes

The tags of the instance.

objectYes

The object.

KeystringYes

The key of the tag associated with the instance.

Note
  • N specifies the serial number of the tag. For example, Tag.1.Key specifies the key of the first tag and Tag.2.Key specifies the key of the second tag.
  • If the key of the tag does not exist, the key is automatically created.
  • demokey
    ValuestringYes

    The value of the tag associated with the instance.

    Note N specifies the serial number of the tag. For example, Tag.1.Value specifies the value of the first tag and Tag.2.Value specifies the value of the second tag.
    demovalue

    Response parameters

    ParameterTypeDescriptionExample
    object
    RequestIdstring

    The ID of the request.

    4BD4E308-A3D8-4CD1-98B3-0ADAEE38****

    Examples

    Sample success responses

    JSONformat

    {
      "RequestId": "4BD4E308-A3D8-4CD1-98B3-0ADAEE38****"
    }

    Error codes

    HTTP status codeError codeError messageDescription
    400NumberExceed.TagsThe Tags parameter number is exceed, Valid is 20.-
    400InvalidTagKey.MalformedThe specified parameter Tag.n.Key or TagKey.n is not valid.-
    400InvalidTagValue.MalformedThe specified parameter Tag.n.Value is not valid.-
    400InvalidParameter.ResourceIdThe specified parameter ResourceId.n is not valid.-
    400MissParameter.TagOrResourceIdThe parameter Tag.n or ResourceId.n is needed.The parameters Tag and ResourceId cannot all be empty. At least one of them is passed in.
    400InvalidParameter.ScopeThe specified parameter Scope is not valid.-
    400NumberExceed.ResourceIdsThe ResourceIds parameter number is exceed.-
    400NumberExceed.TagsThe Tags parameter number is exceed.-
    400NumberExceed.CustomTagsThe Custom Tags parameter number is exceed. Valid is 20.-
    400Duplicate.TagKeyThe specified parameter Tag.n.Key is duplicated.-
    400InvalidParameter.ResourceTypeThe specified parameter ResourceType is not valid.-
    400OperationDenied.QuotaExceedThe Tags parameter number is exceed. Valid is 20.-
    404InvalidDbInstanceId.NotFoundSpecified instance does not exist.The specified instance does not exist

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2023-07-20API Description Update. The Error code has changedView Change Details