Skip to main content
POST
/
cloud
/
v1
/
ports
/
{project_id}
/
{region_id}
/
{port_id}
/
enable_port_security
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
)
instance_interface = client.cloud.instances.enable_port_security(
    port_id="port_id",
    project_id=0,
    region_id=0,
)
print(instance_interface.network_id)
{
  "allowed_address_pairs": [
    {
      "ip_address": "<string>",
      "mac_address": "<string>"
    }
  ],
  "floatingip_details": [
    {
      "created_at": "2023-11-07T05:31:56Z",
      "creator_task_id": "d1e1500b-e2be-40aa-9a4b-cc493fa1af30",
      "fixed_ip_address": "192.168.10.15",
      "floating_ip_address": "172.24.4.34",
      "id": "<string>",
      "port_id": "ee2402d0-f0cd-4503-9b75-69be1d11c5f1",
      "project_id": 123,
      "region": "<string>",
      "region_id": 123,
      "router_id": "11005a33-c5ac-4c96-ab6f-8f2827cc7da6",
      "status": "ACTIVE",
      "tags": [
        {
          "key": "<string>",
          "read_only": true,
          "value": "<string>"
        }
      ],
      "task_id": "a4eb4b29-048e-42f6-a5e1-2c18bc001c45",
      "updated_at": "2023-11-07T05:31:56Z"
    }
  ],
  "ip_assignments": [
    {
      "ip_address": "<string>",
      "subnet_id": "<string>"
    }
  ],
  "network_details": {
    "created_at": "2023-11-07T05:31:56Z",
    "creator_task_id": "fd50fdd1-0482-4c9b-b847-fc9924665af6",
    "default": true,
    "external": true,
    "id": "<string>",
    "mtu": 123,
    "name": "<string>",
    "port_security_enabled": true,
    "project_id": 1337,
    "region": "<string>",
    "region_id": 123,
    "segmentation_id": 9,
    "shared": true,
    "subnets": [
      {
        "cidr": "<string>",
        "created_at": "2023-11-07T05:31:56Z",
        "enable_dhcp": true,
        "ip_version": 4,
        "name": "<string>",
        "network_id": "<string>",
        "project_id": 123,
        "region": "<string>",
        "region_id": 123,
        "tags": [
          {
            "key": "<string>",
            "read_only": true,
            "value": "<string>"
          }
        ],
        "updated_at": "2023-11-07T05:31:56Z",
        "available_ips": 250,
        "creator_task_id": "5cc890da-d031-4a23-ac31-625edfa22812",
        "dns_nameservers": [
          "8.8.8.8",
          "8.8.4.4"
        ],
        "gateway_ip": "192.168.13.1",
        "has_router": false,
        "host_routes": [],
        "id": "b39792c3-3160-4356-912e-ba396c95cdcf",
        "task_id": null,
        "total_ips": 253
      }
    ],
    "tags": [
      {
        "key": "<string>",
        "read_only": true,
        "value": "<string>"
      }
    ],
    "task_id": null,
    "type": "<string>",
    "updated_at": "2023-11-07T05:31:56Z"
  },
  "network_id": "<string>",
  "port_id": "<string>",
  "port_security_enabled": true,
  "interface_name": "my-interface",
  "mac_address": "00:16:3e:f2:87:16"
}

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

port_id
string
required

Port ID

Response

200 - application/json

Instance network interface

allowed_address_pairs
AllowedAddressPairsSerializer · object[]
required

Group of subnet masks and/or IP addresses that share the current IP as VIP

floatingip_details
FloatingIPSerializer · object[]
required

Bodies of floating IPs that are NAT-ing IPs of this port

ip_assignments
PortIpSubnetIdSerializer · object[]
required

IP addresses assigned to this port

network_details
NetworkSubnetworkSerializer · object
required

Body of the network this port is attached to

network_id
string<uuid4>
required

ID of the network the port is attached to

port_id
string<uuid4>
required

ID of virtual ethernet port object

port_security_enabled
boolean
required

Port security status

interface_name
string | null

Interface name

Example:

"my-interface"

mac_address
string | null

MAC address of the virtual port

Example:

"00:16:3e:f2:87:16"