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

client = Gcore(
    api_key="My API Key",
)
security_group = client.cloud.security_groups.update(
    group_id="group_id",
    project_id=0,
    region_id=0,
)
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": "<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"
    }
  ],
  "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

group_id
string
required

Security group ID

Body

application/json
changed_rules
UpdateSecurityGroupRuleSerializer · object[]

List of rules to create or delete

name
string

Name

Examples:

"some_name"

tags
object | null

Update key-value tags using JSON Merge Patch semantics (RFC 7386). Provide key-value pairs to add or update tags. Set tag values to null to remove tags. Unspecified tags remain unchanged. Read-only tags are always preserved and cannot be modified.

Examples:

* Add/update tags: {'tags': {'environment': 'production', 'team': 'backend'}} adds new tags or updates existing ones.

* Delete tags: {'tags': {'old_tag': null}} removes specific tags.

* Remove all tags: {'tags': null} removes all user-managed tags (read-only tags are preserved).

* Partial update: {'tags': {'environment': 'staging'}} only updates specified tags.

* Mixed operations: {'tags': {'environment': 'production', 'cost_center': 'engineering', 'deprecated_tag': null}} adds/updates 'environment' and 'cost_center' while removing 'deprecated_tag', preserving other existing tags.

* Replace all: first delete existing tags with null values, then add new ones in the same request.

Examples:
{
"my-tag": "my-tag-value",
"my-tag-to-remove": null
}

Response

Updated 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