Adding Rules to a Specified Security Group
Function
This API is used to add rules to a specified security group.
Debugging
You can debug this API through automatic authentication in API Explorer.
URI
POST /v3/{project_id}/vpc/security-groups/{security_group_id}/security-group-rules/batch-create
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
security_group_id |
Yes |
String |
Security Group ID |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
security_group_rules |
Yes |
Array of BatchCreateSecurityGroupRulesOption objects |
Request body for batch creating security group rules. |
ignore_duplicate |
No |
Boolean |
Specifies whether to ignore duplicate security group rules during creation. Default: false |
dry_run |
No |
Boolean |
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
description |
No |
String |
|
direction |
Yes |
String |
|
ethertype |
No |
String |
|
protocol |
No |
String |
|
multiport |
No |
String |
|
remote_ip_prefix |
No |
String |
|
remote_group_id |
No |
String |
|
remote_address_group_id |
No |
String |
|
action |
No |
String |
|
priority |
No |
String |
|
Response Parameters
Status code: 201
Parameter |
Type |
Description |
---|---|---|
security_group_rules |
Array of SecurityGroupRule objects |
Response body for batch creating security group rules. |
request_id |
String |
Request ID. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
|
description |
String |
|
security_group_id |
String |
|
direction |
String |
|
protocol |
String |
|
ethertype |
String |
|
multiport |
String |
|
action |
String |
|
priority |
Integer |
|
remote_group_id |
String |
|
remote_ip_prefix |
String |
|
remote_address_group_id |
String |
|
created_at |
String |
|
updated_at |
String |
|
project_id |
String |
|
Example Requests
Adding two inbound rules to the security group whose ID is 15457509-18f9-4387-bae6-d4ed1898b301 with duplicate rules ignored
POST https://{Endpoint}/v3/{project_id}/vpc/security-groups/15457509-18f9-4387-bae6-d4ed1898b301/security-group-rules/batch-create { "ignore_duplicate" : true, "security_group_rules" : [ { "direction" : "ingress", "description" : "", "protocol" : "tcp", "action" : "allow", "priority" : 1, "ethertype" : "IPv4", "multiport" : "22", "remote_ip_prefix" : "117.78.12.122/32" }, { "direction" : "ingress", "description" : "", "protocol" : "tcp", "action" : "allow", "priority" : 1, "ethertype" : "IPv4", "multiport" : "22", "remote_ip_prefix" : "117.78.12.122/32" } ] }
Example Responses
Status code: 201
Normal response to the POST operation. For more status codes, see Status Codes.
-
{ "security_group_rules" : [ { "id" : "abef369b-d646-4b8a-9f44-fcd248a6c421", "project_id" : "5f6387106c2048b589b369d96c2f23a2", "security_group_id" : "15457509-18f9-4387-bae6-d4ed1898b301", "direction" : "ingress", "protocol" : "tcp", "description" : "", "created_at" : "2023-04-28T04:08:52.000+00:00", "updated_at" : "2023-04-28T04:08:52.000+00:00", "ethertype" : "IPv4", "remote_ip_prefix" : "117.78.12.122/32", "multiport" : 22, "action" : "allow", "priority" : 1, "remote_group_id" : null, "remote_address_group_id" : null } ], "request_id" : "f1ae2c6f9e94babf077cd3b3e1570c81" }
Status Codes
Status Code |
Description |
---|---|
201 |
Normal response to the POST operation. 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