Creating a Security Group Rule¶
Function¶
This API is used to create a security group rule.
URI¶
POST /v1/{project_id}/security-group-rules
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
security_group_rule | Yes | security_group_rule object | Specifies the security group rule objects. For details, see Table 2. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
security_group_id | Yes | String | Specifies the security group ID. |
description | No | String |
|
direction | Yes | String |
|
ethertype | No | String |
|
protocol | No | String |
|
port_range_min | No | Integer |
|
port_range_max | No | Integer |
|
remote_ip_prefix | No | String |
|
remote_group_id | No | String |
|
remote_address_group_id | No | String |
|
Example Request¶
Create an inbound rule in the security group whose ID is a7734e61-b545-452d-a3cd-0189cbd9747a.
POST https://{Endpoint}/v1/{project_id}/security-group-rules { "security_group_rule": { "direction": "ingress", "port_range_min": "80", "ethertype": "IPv4", "port_range_max": "80", "protocol": "tcp", "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a" } }
POST https://{Endpoint}/v1/{project_id}/security-group-rules { "security_group_rule": { "direction": "ingress", "port_range_min": "80", "ethertype": "IPv6", "port_range_max": "90", "protocol": "tcp", "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a" } }
Response Parameters¶
Parameter | Type | Description |
---|---|---|
security_group_rule | security_group_rule object | Specifies the security group rule objects. For details, see Table 4. |
Parameter | Type | Description |
---|---|---|
id | String | Specifies the security group rule ID, which uniquely identifies the security group rule. |
description | String |
|
security_group_id | String | Specifies the security group rule ID, which uniquely identifies the security group rule. |
direction | String |
|
ethertype | String |
|
protocol | String |
|
port_range_min | Integer |
|
port_range_max | Integer |
|
remote_ip_prefix | String |
|
remote_group_id | String |
|
remote_address_group_id | String |
|
tenant_id | String |
|
Example Response¶
{
"security_group_rule": {
"direction": "ingress",
"ethertype": "IPv4",
"id": "2bc0accf-312e-429a-956e-e4407625eb62",
"description": "",
"port_range_max": 80,
"port_range_min": 80,
"protocol": "tcp",
"remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5",
"remote_ip_prefix": null,
"security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a",
"tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
"remote_address_group_id": null
}
}
Status Code¶
See Status Codes.
Error Code¶
See Error Codes.