• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Neutron
  5. Security groups and rules
  6. Create security group rule

Create security group rule

Function Description

This interface is used to create security group rules.

Interface Format

Method

URI

Description

POST

/v2.0/security-group-rules

Creates a security group rule.

Restrictions

N/A

Request Parameter

Parameter

Type

Mandatory

Description

security_group_rule

Dict

Yes

Specifies the security group rule. For details, see Table 2.

Mandatory parameters: direction and security_group_id

Response Parameter

Parameter

Type

Mandatory

Description

security_group_rule

Dict

Yes

Specifies the security group rule. For details, see Table 2.

Request Example

POST  /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 Example

{
    "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"
    }
}

Error Code

See section Return Code Processing.