Skip to main content
POST
/
cloud
/
v2
/
security_groups
/
{project_id}
/
{region_id}
/
{group_id}
/
rules
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
)
task_id_list = client.cloud.security_groups.rules.create(
    group_id="00000000-0000-4000-8000-000000000000",
    project_id=1,
    region_id=1,
    direction="ingress",
)
print(task_id_list.tasks)
{
  "tasks": [
    "<string>"
  ]
}

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

Example:

1

region_id
integer
required

Region ID

Example:

1

group_id
string<uuid4>
required

Security group ID

Example:

"00000000-0000-4000-8000-000000000000"

Body

application/json
direction
enum<string>
required

Ingress or egress, which is the direction in which the security group is applied

Available options:
egress,
ingress
Example:

"ingress"

description
string

Rule description

Maximum string length: 255
Example:

"Some description"

ethertype
enum<string>

Ether type

Available options:
IPv4,
IPv6
Example:

"IPv4"

port_range_max
integer | null

The maximum port number in the range that is matched by the security group rule

Required range: 0 <= x <= 65535
Example:

80

port_range_min
integer | null

The minimum port number in the range that is matched by the security group rule

Required range: 0 <= x <= 65535
Example:

80

protocol
enum<string>

Protocol

Available options:
ah,
any,
dccp,
egp,
esp,
gre,
icmp,
igmp,
ipencap,
ipip,
ipv6-encap,
ipv6-frag,
ipv6-icmp,
ipv6-nonxt,
ipv6-opts,
ipv6-route,
ospf,
pgm,
rsvp,
sctp,
tcp,
udp,
udplite,
vrrp
Example:

"tcp"

remote_group_id
string<uuid4>

The remote group UUID to associate with this security group

Example:

"00000000-0000-4000-8000-000000000000"

remote_ip_prefix
string<ipvanynetwork> | null

The remote IP prefix that is matched by this security group rule

Example:

"10.0.0.0/8"

Response

200 - application/json

OK

tasks
string[]
required

List of task IDs representing asynchronous operations. Use these IDs to monitor operation progress:

  • GET /v1/tasks/{task_id} - Check individual task status and details Poll task status until completion (FINISHED/ERROR) before proceeding with dependent operations.
Example:
["d478ae29-dedc-4869-82f0-96104425f565"]