Adds tags to resources. Instance resources are supported.
Debugging
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:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis 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.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| cr:TagResources | create | *Instance acs:cr:{#regionId}:{#accountId}:instance/{#InstanceId} |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| ResourceType | string | Yes | The type of the resource. Instance resources are supported. | Instance |
| ResourceId | array | Yes | The resource IDs. You can specify a maximum of 20 resource IDs. | |
| string | Yes | The resource ID. | cri-1lg7vtctpqdn**** | |
| RegionId | string | Yes | The region ID of the resources. | cn-hangzhou |
| Tag | array<object> | Yes | The tag list. | |
| object | Yes | The tag list. | ||
| Key | string | No | The tag key of the resource. You can specify up to 20 tag keys. The tag key cannot be an empty string. A tag key can be up to 128 characters in length. It cannot start with acs: or aliyun, and cannot contain http:// or https://. | test-key |
| Value | string | No | The tag value of the resource. You can specify up to 20 tag values. The tag value can be an empty string. A tag value can be up to 128 characters in length. It cannot start with acs: or aliyun, and cannot contain http:// or https://. | test-val |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "E9A586D0-3977-5C28-A44D-55D3A9CD53CC"
}Error codes
| HTTP status code | Error code | Error message |
|---|---|---|
| 400 | SystemError | A system error occurred while processing your request |
| 400 | InvalidParameter.ResourceId | The ResourceId parameter is invalid. |
| 400 | InvalidResourceId.NotFound | The specified ResourceIds are not found in our records. |
| 400 | NumberExceed.ResourceIds | The maximum number of ResourceIds is exceeded. |
| 400 | InvalidParameter.RegionId | The RegionId parameter is invalid. |
| 400 | InvalidParameter.ResourceType | The ResourceType parameter is invalid. |
| 400 | MissingParameter.ResourceIds | You must specify ResourceId.N. |
| 400 | MissingParameter.ResourceType | You must specify ResourceType. |
| 400 | MissingParameter.Tags | You must specify Tags. |
| 400 | MissingParameter.TagKey | You must specify Tag.N.Key. |
| 400 | MissingParameter.TagValue | You must specify Tag.N.Value. |
| 400 | InvalidParameter.TagKey | The Tag.N.Key parameter is invalid. |
| 400 | InvalidParameter.TagValue | The Tag.N.Value parameter is invalid. |
| 400 | NumberExceed.Tags | The maximum number of Tags is exceeded. |
| 400 | QuotaExceed.TagsPerResource | The maximum number of tags for each resource is exceeded. |
| 400 | Duplicate.TagKey | The Tag.N.Key contains duplicate keys. |
| 403 | NoPermission | The operator is not permission for this operate |
| 500 | InvalidOperation.ConcurrentModification | The resource is modified concurrently. |
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|---|---|
| 2024-12-11 | The Error code has changed | View Change Details |
| 2024-04-01 | The Error code has changed | View Change Details |
