• Native OpenStack API

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

Creating a Security Group

Function Description

This interface is used to create a security group.

URI

  • URI format

    POST /v2/{tenant_id}/os-security-groups

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

  • Parameter description

    Parameter

    Mandatory

    Description

    tenant_id

    Yes

    Specifies the tenant or project ID.

Restrictions

This interface will become invalid from micro version 2.36. Since this version, the system will return error 404 when you call this interface.

You are advised to use the desired network interface. For details, see section "Security Group (Native OpenStack API) > Creating a Security Group" in Virtual Private Network API Reference.

Request

Parameter

Type

Mandatory

Description

security_group

Dict

Yes

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

Table 1 Objects of request parameter security_group

Parameter

Type

Mandatory

Description

name

String

No

Specifies the security group name. It is a string of 0 to 255 characters.

description

String

No

Specifies information about a security group. It is a string of 0 to 255 characters.

Response

Parameter

Type

Mandatory

Description

security_group

Dict

No

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

Table 2 Objects of response parameter security_group

Parameter

Type

Mandatory

Description

description

String(255)

Yes

Provides supplementary information about the security group.

id

String

Yes

Specifies the security group ID in UUID format.

name

String(255)

Yes

Specifies the security group name.

rules

List(security_group_rule)

Yes

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

tenant_id

String(255)

Yes

Specifies the tenant or project ID.

Request Example

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

Response Example

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

Returned Values

See General Request Returned Values.