Create Security Group

Create Security Group
Create a security group

Create a security group.

Request
URI
POST
https://api.example.local/v3/security_groups
COPY
Request Body
SecurityGroupCreate of type(s) application/json
Optional

Show optional properties

{
    "name": "string"
}
{
    "name": "string",
    "globally_enabled": {
        "running": false,
        "staging": false
    },
    "rules": [
        {
            "protocol": "string",
            "destination": "string",
            "ports": "string",
            "type": 0,
            "code": 0,
            "description": "string"
        }
    ],
    "metadata": {
        "labels": {
            "labels": "string"
        },
        "annotations": {
            "annotations": "string"
        }
    }
}
string
name
Required

Name of the security group

object
globally_enabled
Optional

globally_enabled

array of object
rules
Optional

Rules for the security group

object
metadata
Optional

Metadata is a JSON object that contains information about a resource. It includes the GUID of the resource, the time the resource was created, the time the resource was last updated, and links to the resource. Metadata is included in the response body of a request to retrieve a resource.

Authentication
This operation uses the following authentication methods.
Responses
201

Created

Returns SecurityGroup of type(s) application/json
This response body class contains all of the following: BaseSchema
{
    "guid": "string",
    "created_at": "string",
    "updated_at": "string",
    "name": "string",
    "globally_enabled": {
        "running": false,
        "staging": false
    },
    "rules": [
        {
            "protocol": "string",
            "destination": "string",
            "ports": "string",
            "type": 0,
            "code": 0,
            "description": "string"
        }
    ],
    "running_spaces": {
        "data": [
            {
                "guid": "string"
            }
        ]
    },
    "staging_spaces": {
        "data": [
            {
                "guid": "string"
            }
        ]
    },
    "links": {
        "self": {
            "href": "string",
            "method": "string"
        },
        "running_spaces": {
            "href": "string",
            "method": "string"
        },
        "staging_spaces": {
            "href": "string",
            "method": "string"
        }
    },
    "metadata": {
        "labels": {
            "labels": "string"
        },
        "annotations": {
            "annotations": "string"
        }
    }
}

400

Bad Request

Returns BadRequest of type(s) application/json
{
    "errors": [
        {
            "code": 0,
            "detail": "string",
            "title": "string"
        }
    ]
}
array of object
errors
Optional

errors


401

Unauthorized

Returns Unauthorized of type(s) application/json
{
    "errors": [
        {
            "code": 0,
            "detail": "string",
            "title": "string"
        }
    ]
}
array of object
errors
Optional

errors


403

Forbidden

Returns Forbidden of type(s) application/json
{
    "errors": [
        {
            "code": 0,
            "detail": "string",
            "title": "string"
        }
    ]
}
array of object
errors
Optional

errors


409

Conflict

Returns Conflict of type(s) application/json
{
    "errors": [
        {
            "code": 0,
            "detail": "string",
            "title": "string"
        }
    ]
}
array of object
errors
Optional

errors


422

Unprocessable Entity

Returns UnprocessableEntity of type(s) application/json
{
    "errors": [
        {
            "code": 0,
            "detail": "string",
            "title": "string"
        }
    ]
}
array of object
errors
Optional

errors


500

Internal Server Error

Returns 500 of type(s) application/json
{
    "errors": [
        {
            "code": 0,
            "detail": "string",
            "title": "string"
        }
    ]
}
array of object
errors
Optional

errors


503

Service Unavailable

Returns ServiceUnavailable of type(s) application/json
{
    "errors": [
        {
            "code": 0,
            "detail": "string",
            "title": "string"
        }
    ]
}
array of object
errors
Optional

errors


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"name":"string"}' https://{api_host}/v3/security_groups