Adding a Security Group Rule
Function
This API is used to add a security group rule.
URI
POST /v2.0/security-group-rules
Request Parameters
Parameter | Type | Mandatory | Description |
---|---|---|---|
security_group_rule | security_group_rule object | Yes | Specifies the security group rule. For details, see Table 2. |
Attribute | Mandatory | Type | Description |
---|---|---|---|
description | No | String | Provides supplementary information about the security group rule. |
security_group_id | Yes | String | Specifies the ID of the belonged security group. |
remote_group_id | No | String |
|
direction | Yes | String |
|
remote_ip_prefix | No | String |
|
protocol | No | String |
|
port_range_max | No | Integer |
|
port_range_min | No | Integer |
|
ethertype | No | String |
|
Example Request
Create an outbound rule in the security group whose ID is 5cb9c1ee-00e0-4d0f-9623-55463cd26ff8. Set protocol to tcp, and remote_ip_prefix to 10.10.0.0/24.
POST https://{Endpoint}/v2.0/security-group-rules{"security_group_rule": {"security_group_id": "5cb9c1ee-00e0-4d0f-9623-55463cd26ff8","direction": "egress","protocol": "tcp","remote_ip_prefix": "10.10.0.0/24"}}
Response Parameters
Parameter | Type | Description |
---|---|---|
security_group_rule | security_group_rule object | Specifies the security group rule. For details, see Table 4. |
Attribute | Type | Description |
---|---|---|
id | String |
|
description | String | Provides supplementary information about the security group rule. |
security_group_id | String | Specifies the ID of the belonged security group. |
remote_group_id | String | Specifies the peer ID of the belonged security group. |
direction | String | Specifies the direction of a security group rule. |
remote_ip_prefix | String | Specifies the peer IP address segment. |
protocol | String | Specifies the protocol type or the IP protocol number. |
port_range_max | Integer |
|
port_range_min | Integer |
|
ethertype | String |
|
tenant_id | String | Specifies the project ID. |
project_id | String | Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
created_at | String |
|
updated_at | String |
|
Example Response
{"security_group_rule": {"remote_group_id": null,"direction": "egress","remote_ip_prefix": "10.10.0.0/24","protocol": "tcp","tenant_id": "6fbe9263116a4b68818cf1edce16bc4f","port_range_max": null,"security_group_id": "5cb9c1ee-00e0-4d0f-9623-55463cd26ff8","port_range_min": null,"ethertype": "IPv4","description": null,"id": "7c336b04-1603-4911-a6f4-f2af1d9a0488","project_id": "6fbe9263116a4b68818cf1edce16bc4f","created_at": "2018-09-20T02:15:34","updated_at": "2018-09-20T02:15:34"}}
Status Code
See Status Codes.
Error Code
See Error Codes.
- Function
- URI
- Request Parameters
- Example Request
- Response Parameters
- Example Response
- Status Code
- Error Code