POST
/
cloud
/
v1
/
securitygroups
/
{project_id}
/
{region_id}
Python
import os
from gcore import Gcore

client = Gcore(
    api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
)
security_group = client.cloud.security_groups.create(
    project_id=0,
    region_id=0,
    security_group={
        "name": "my_security_group"
    },
)
print(security_group.id)
{
  "created_at": "2019-06-18T11:56:16+0000",
  "description": "Some description",
  "id": "00000000-0000-4000-8000-000000000000",
  "name": "my_security_group",
  "project_id": 1337,
  "region": "Luxembourg 1",
  "region_id": 7,
  "revision_number": 1,
  "security_group_rules": [
    {
      "created_at": "2019-06-18T11:56:16+0000",
      "description": "Some description",
      "direction": "egress",
      "ethertype": "IPv4",
      "id": "00000000-0000-4000-8000-000000000000",
      "port_range_max": 80,
      "port_range_min": 80,
      "protocol": "tcp",
      "remote_group_id": [
        "00000000-0000-4000-8000-000000000000"
      ],
      "remote_ip_prefix": "10.0.0.0/8",
      "revision_number": 0,
      "security_group_id": "00000000-0000-4000-8000-000000000000",
      "updated_at": "2019-06-18T11:57:00+0000"
    }
  ],
  "tags_v2": [
    {
      "key": "my-tag",
      "read_only": false,
      "value": "my-tag-value"
    }
  ],
  "updated_at": "2019-06-18T11:57:00+0000"
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

project_id
integer
required

Project ID

region_id
integer
required

Region ID

Body

application/json
security_group
object
required

Security group

instances
string[]

List of instances

Examples:
["00000000-0000-4000-8000-000000000000"]

Response

200 - application/json

Created security group details

created_at
string<date-time>
required

Datetime when the security group was created

Examples:

"2019-06-18T11:56:16+0000"

id
string<uuid4>
required

Security group ID

Examples:

"00000000-0000-4000-8000-000000000000"

name
string
required

Security group name

Examples:

"my_security_group"

project_id
integer
required

Project ID

Examples:

1337

region
string
required

Region name

Examples:

"Luxembourg 1"

region_id
integer
required

Region ID

Examples:

7

revision_number
integer
required

The number of revisions

Examples:

1

tags_v2
TagSerializer · object[]
required

Tags for a security group

Examples:
[
{
"key": "my-tag",
"read_only": false,
"value": "my-tag-value"
}
]
updated_at
string<date-time>
required

Datetime when the security group was last updated

Examples:

"2019-06-18T11:57:00+0000"

description
string | null

Security group description

Examples:

"Some description"

security_group_rules
SecurityGroupRuleSerializer · object[]

Security group rules