Adding or Deleting Vault Tags in Batches
Function
This API is used to batch add or delete tags for a specific resource. A resource can have a maximum of 10 tags. (A resource in a region supporting landing zone can have up to 20 tags.)
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
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, no identity policy-based permission required for calling this API.
URI
POST /v3/{project_id}/vault/{vault_id}/tags/action
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
| vault_id | Yes | String | Definition Vault ID. For details about how to obtain the vault ID, see Querying the Vault List. Constraints N/A Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| tags | No | Array of BulkCreateAndDeleteTags 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 | List of system tags. This field is only available to the op_service permission. Choose either this field or tags. _sys_enterprise_project_id is the only resource_tag structure key used in TMS calls. The value is the UUID or 0 (the default enterprise project). Only the create operation is supported currently. |
| action | Yes | String | Operation to be performed. The value can be set to create or delete only. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | Yes | String | Tag key. A key consists of up to 36 characters. A key cannot be an empty string. Spaces before and after a key will be discarded. A key cannot contain the following characters: ASCII (0-31), equal signs (=), asterisks (*), left angle brackets (<), right angle brackets (>), backslashes (), commas (,), vertical bars (|), and slashes (/). A key can contain only letters, digits, hyphens (-), and underscores (_). When creating tags, if the request body contains duplicate keys, an error will be reported. When creating tags, if a new tag's key duplicates an existing tag's key, the new tag overwrites the existing one. When deleting tags, duplicate keys are allowed. When deleting tags, non-existent tags are treated as successfully deleted by default. The character set of tags is not verified. When deleting tags, the tags structure must be provided, and key cannot be null or an empty string. |
| value | No | String | Tag value. A value is mandatory when a tag is added and optional when a tag is deleted. A value consists of up to 43 characters. A value can be an empty string. Spaces before and after a value will be discarded. A value cannot contain the following characters: ASCII (0-31), equal signs (=), asterisks (*), left angle brackets (<), right angle brackets (>), backslashes (), commas (,), vertical bars (|), and slashes (/). A value can contain only letters, digits, hyphens (-), underscores (_), and periods (.). |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | Yes | String | 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: 204
None
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.
What is your overall rating for this page?
Thank 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