Adding a resource tag
Function
If there are a large number of cloud resources, you can use Tag Management Service (TMS) to manage cloud resources under your account and add resource tags.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
coc:instance:addResourceToTags
Write
-
-
- coc:instance:createResourceTags
-
URI
POST /v1/resources/{resource_id}/tags
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
resource_id |
Yes |
String |
Definition: ID of the resource to which you want to add a tag. Constraints: N/A Value range: N/A Default value: N/A |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
tags |
Yes |
Array of QueryResourceTagsResponse objects |
Definition: The key-value pair of a tag. Constraints: N/A Value range: N/A Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
[items] |
No |
Array of TagResponse objects |
Definition: The key-value pair of a tag. Constraints: N/A Value range: N/A Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
key |
Yes |
String |
Definition: Tag key. Value range: The tag key cannot start or end with a space, or start with sys. It can contain letters, digits, spaces, and the following special characters: _.:=+-@. A maximum of 128 characters are allowed. |
|
value |
Yes |
String |
Definition: Tag value. Value range: A tag value can contain a maximum of 255 characters. It cannot start or end with a space. Only letters, digits, spaces, and the following special characters are allowed: _ . : / = + - @ |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Definition: Resource ID. Value Range: N/A |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition: Error code. Value range: The value contains 8 to 36 characters. |
|
error_msg |
String |
Definition: Error description. Value range: The value contains 2 to 512 characters. |
Example Requests
Add a resource tag.
POST https://{Endpoint}/v1/resources/{resource_id}/tags
{
"tags" : [ {
"key" : "Test resource tag",
"value" : "9999"
} ]
}
Example Responses
Status code: 200
Resource tags are added.
{
"data" : {
"id" : "6805f787eac07d54601ab7d7"
}
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Resource tags are added. |
|
400 |
Failed to add the resource tag. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot