• Native OpenStack API

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

Creating a Security Group

Function

This interface is used to create a security group.

URI

POST /v2.0/security-groups

Request Message

Table 1 Request parameter

Parameter

Type

Mandatory

Description

security_group

Dict

Yes

Specifies the security group and security group list. For details, see Table 1. This parameter has no mandatory fields.

Response Message

Table 2 Response parameter

Parameter

Type

Description

security_group

Dict

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

Example:

Example request

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

Example response

{
    "security_group": {
        "id": "d29ae17d-f355-4992-8747-1fb66cc9afd2",
        "name": "sg-test",
        "description": "",
        "tenant_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
        "project_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
        "security_group_rules": [
            {
                "id": "3f51e52c-0e85-40f7-a137-85927392e436",
                "direction": "egress",
                "protocol": null,
                "ethertype": "IPv4",
                "description": null,
                "remote_group_id": null,
                "remote_ip_prefix": null,
                "tenant_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
                "port_range_max": null,
                "port_range_min": null,
                "security_group_id": "d29ae17d-f355-4992-8747-1fb66cc9afd2"
            },
            {
                "id": "6332de3e-98fb-4f8c-b44a-fcb8ff09881e",
                "direction": "egress",
                "protocol": null,
                "ethertype": "IPv6",
                "description": null,
                "remote_group_id": null,
                "remote_ip_prefix": null,
                "tenant_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
                "port_range_max": null,
                "port_range_min": null,
                "security_group_id": "d29ae17d-f355-4992-8747-1fb66cc9afd2"
            }
        ],
        "created_at": "2018-09-20T02:15:34",
        "updated_at": "2018-09-20T02:15:34"
    }
}

Status Codes

For details, see section Status Codes.

Error Codes

For details, see section Error Codes.