Updated on 2022-02-22 GMT+08:00

Creating a Security Group (Discarded)

Function

This API is used to create a security group.

This API has been discarded. Use the API described in section "Security Group (OpenStack Neutron APIs) > Creating a Security Group" in Virtual Private Network API Reference.

URI

POST /v2.1/{project_id}/os-security-groups

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

Request

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Mandatory

Type

Description

security_group

Yes

Object

Specifies the security group, which is configured in the message body. For details, see Table 3.

Table 3 Objects of request parameter security_group

Parameter

Mandatory

Type

Description

name

No

String

Specifies the security group name. It must contain 0 to 255 characters.

description

No

String

Specifies information about a security group. It must contain 0 to 255 characters.

Response

Table 4 describes the response parameters.

Table 4 Response parameters

Parameter

Type

Description

security_group

Object

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

Table 5 Objects of response parameter security_group

Parameter

Type

Description

description

String

Provides supplementary information about the security group.

id

String

Specifies the security group ID in UUID format.

name

String

Specifies the security group name.

rules

Array of objects

Specifies the rules of the security group. The list is empty.

tenant_id

String

Specifies the tenant or project ID.

Example Request

POST https://{endpoint}/v2.1/bb1118612ba64af3a6ea63a1bdcaa5ae/os-security-groups
{
    "security_group": {
        "name": "test",
        "description": "description"
    }
}

Example Response

{
    "security_group": {
        "rules": [],
        "tenant_id": "bb1118612ba64af3a6ea63a1bdcaa5ae",
        "description": "desc-sg",
        "id": "81f1d23b-b1e2-42cd-bdee-359b4a065a42",
        "name": "test-sg"
    }
}