• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Neutron
  5. Security Group
  6. Creating a Security Group Rule

Creating a Security Group Rule

Function

This interface is used to create a security group rule.

URI

POST /v2.0/security-group-rules

Request Message

Table 1 Request parameter

Parameter

Type

Mandatory

Description

security_group_rule

Dict

Yes

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

Mandatory parameters: direction and security_group_id

Response Message

Table 2 Response parameter

Parameter

Type

Description

security_group_rule

Dict

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

Example:

Example request

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

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 Codes

For details, see section Status Codes.