Batch Creating or Deleting Security Group Tags
Function
This API is used to add multiple tags to or delete them from a security group at a time.
The API is idempotent.
If the request body contains duplicate keys, an error is reported. During tag creation, duplicate keys are not allowed. If a key already exists in the database, its value will be overwritten by the new duplicate key.
During tag deletion, if the tags do not exist, the deletion is considered to be successful by default. The character set of the tags will not be checked. When you delete tags, the tag structure cannot be missing, and the key cannot be left blank or be an empty string.
Constraints
The API is idempotent.
If the request body contains duplicate keys, an error is reported. During tag creation, duplicate keys are not allowed. If a key already exists in the database, its value will be overwritten by the new duplicate key.
During tag deletion, if the tags do not exist, the deletion is considered to be successful by default. The character set of the tags will not be checked. When you delete tags, the tag 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.
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
vpc:securityGroups:createTags
Tagging
securityGroup *
- vpc:securityGroupTags:create
-
-
vpc:securityGroups:deleteTags
Tagging
securityGroup *
- vpc:securityGroupTags:delete
-
-
g:TagKeys
URI
POST /v2.0/{project_id}/security-groups/{security_group_id}/tags/action
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID |
|
security_group_id |
Yes |
String |
Security Group ID |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
action |
Yes |
String |
Operation identifier. |
|
tags |
Yes |
Array of ResourceTag objects |
Tag list. |
Response Parameters
Status code: 204
The response to the request is normal. For more status codes, see Status Codes.
None
Example Requests
-
Set action to create to batch create two tags for a security group.
POST https://{Endpoint}/v2.0/{project_id}/security-groups/{security_group_id}/tags/action { "action" : "create", "tags" : [ { "key" : "key1", "value" : "value1" }, { "key" : "key2", "value" : "value3" } ] } -
Set action to create to batch delete two tags for a security group.
POST https://{Endpoint}/v2.0/{project_id}/security-groups/{security_group_id}/tags/action { "action" : "delete", "tags" : [ { "key" : "key1", "value" : "value1" }, { "key" : "key2", "value" : "value3" } ] }
Example Responses
None
Status Codes
|
Status Code |
Description |
|---|---|
|
204 |
The response to the request is normal. For more status codes, see Status Codes. |
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