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

client = Gcore(
    api_key="My API Key",
)
security_group_rule = client.cloud.security_groups.rules.create(
    group_id="group_id",
    project_id=0,
    region_id=0,
)
print(security_group_rule.id)
{
  "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": "<string>",
  "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"
}

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

group_id
string
required

Security group ID

Body

application/json
description
string

Rule description

Maximum length: 255
Examples:

"Some description"

direction
enum<string>

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

Available options:
egress,
ingress
Examples:

"ingress"

ethertype
enum<string>

Ether type

Available options:
IPv4,
IPv6
Examples:

"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
Examples:

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
Examples:

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
remote_group_id
string<uuid4>

The remote group UUID to associate with this security group

Examples:

"00000000-0000-4000-8000-000000000000"

remote_ip_prefix
string<ipvanynetwork> | null

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

Examples:

"10.0.0.0/8"

Response

200 - application/json

Created rule details

created_at
string<date-time>
required

Datetime when the rule was created

Examples:

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

direction
enum<string>
required

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

Available options:
egress,
ingress
id
string<uuid4>
required

The ID of the security group rule

Examples:

"00000000-0000-4000-8000-000000000000"

revision_number
integer
required

The revision number of the resource

Examples:

0

security_group_id
string<uuid4>
required

The security group ID to associate with this security group rule

Examples:

"00000000-0000-4000-8000-000000000000"

updated_at
string<date-time>
required

Datetime when the rule was last updated

Examples:

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

description
string | null
default:""

Rule description

Examples:

"Some description"

ethertype
enum<string> | null

Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules.

Available options:
IPv4,
IPv6
Examples:

"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
Examples:

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
Examples:

80

protocol
enum<string> | null

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
Examples:

"tcp"

remote_group_id
string<uuid4> | null

The remote group UUID to associate with this security group rule

remote_ip_prefix
string<ipvanynetwork> | null

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

Examples:

"10.0.0.0/8"