• 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

Create security group

Function Description

This interface is used to create a security group.

Interface Format

Method

URI

Description

POST

/v2.0/security-groups

Creates a security group.

Restrictions

N/A

Request Parameter

Parameter

Type

Mandatory

Description

security_group

Dict

Yes

Specifies the security group. For details, see Table 1.

This parameter has no mandatory fields.

Response Parameter

Parameter

Type

Mandatory

Description

security_group

Dict

Yes

Specifies the security group. For details, see Table 1.

Request Example

POST  /v2.0/security-groups
{
"security_group":{
"name":"test",
}
}

Response Example

{
    "security_group": {
        "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
        "name": "test",
        "description": "",
        "security_group_rules": [
            {
                "remote_group_id": null,
                "direction": "egress",
                "remote_ip_prefix": null,
                "protocol": null,
                "ethertype": "IPv4",
                "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
                "port_range_max": null,
                "port_range_min": null,
                "id": "2c4b4ca9-902e-47e7-bf68-d628cb06a388",
"description": null,
                "security_group_id": "9f79f6af-b30f-4b83-bc20-d86e0857cdf3"
            },
            {
                "remote_group_id": null,
                "direction": "egress",
                "remote_ip_prefix": null,
                "protocol": null,
                "ethertype": "IPv6",
                "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
                "port_range_max": null,
                "port_range_min": null,
                "id": "b197706d-e21d-439c-8bd8-0754bd2fac3c",
"description": null,
                "security_group_id": "9f79f6af-b30f-4b83-bc20-d86e0857cdf3"
            }
        ],
        "id": "9f79f6af-b30f-4b83-bc20-d86e0857cdf3"
    }
}

Error Code

See section Return Code Processing.