Batch Adding or Deleting Tags of a Vault
Function
This API is used to batch add or delete tags for a specified instance. TMS uses this API to manage service resource tags. A resource can have a maximum of 10 tags. This API is idempotent. If there are duplicate keys in the request body when you add tags, an error is reported. If a to-be-added tag has the same key as an existing tag, the tag will be added and overwrite the existing tag. When deleting tags, you can upload duplicate keys. When deleting tags, if some tags do not exist, the deletion is considered to be successful by default. The character set of the tags will not be verified. A key and a value can individually consist of up to 127 and 255 characters. When you delete tags, the tags structure cannot be missing, and the key cannot be left blank or be an empty string.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
POST /v3/{project_id}/vault/{vault_id}/tags/action
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID |
vault_id |
Yes |
String |
Resource ID |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tags |
No |
Array of Tag objects |
Tag list This list cannot be an empty list. The list can contain up to 10 keys. Keys in this list must be unique. |
sys_tags |
No |
Array of SysTag objects |
System tag list This field is available only to the op_service permission. Choose either this field or tags. Currently, TMS calls contain only one resource_tag structure. The key is fixed at as _sys_enterprise_project_id. The value is the UUID or 0. Value 0 indicates the default enterprise project. Currently, only the create operation is supported. |
action |
Yes |
String |
Operation to be performed. The value can be set to create or delete only. Enumeration values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Key It can contain a maximum of 36 characters. It cannot be an empty string. Spaces before and after a key will be discarded. It cannot contain non-printable ASCII characters (0–31) and the following characters: =*<>,|/ It can contain only letters, digits, hyphens (-), and underscores (_). |
value |
Yes |
String |
Value It is mandatory when a tag is added and optional when a tag is deleted. It can contain a maximum of 43 characters. It can be an empty string. Spaces before and after a value will be discarded. It cannot contain non-printable ASCII characters (0–31) and the following characters: =*<>,|/ It can contain only letters, digits, hyphens (-), underscores (_), and periods (.). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Key Key of the system tag, which is obtained from the whitelist and cannot be defined randomly. Currently, only the _sys_enterprise_project_id field is supported, and the corresponding value indicates the enterprise project ID. |
value |
Yes |
String |
Value Currently, only the enterprise project ID is used. The default enterprise project ID is 0. |
Response Parameters
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
For details, see Error Codes. |
error_msg |
String |
Error message |
Example Requests
Example request
POST https://{endpoint}/v3/{project_id}/vault/{vault_id}/tags/action { "tags" : [ { "key" : "string", "value" : "string" }, { "key" : "string1", "value" : "string2" } ], "action" : "create" }
Example Responses
None
Status Codes
Status Code |
Description |
---|---|
204 |
No Content |
400 |
Bad Request |
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