import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
connected_port_list = client.cloud.reserved_fixed_ips.vip.connected_ports.add(
port_id="port_id",
project_id=0,
region_id=0,
)
print(connected_port_list.count){
"count": 1,
"results": [
{
"instance_id": "<string>",
"instance_name": "<string>",
"ip_assignments": [
{
"ip_address": "<string>",
"subnet": {
"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
},
"subnet_id": "<string>"
}
],
"network": {
"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": [
"<string>"
],
"tags": [
{
"key": "<string>",
"read_only": true,
"value": "<string>"
}
],
"task_id": null,
"type": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"port_id": "<string>"
}
]
}Add instance ports to share a VIP.
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
connected_port_list = client.cloud.reserved_fixed_ips.vip.connected_ports.add(
port_id="port_id",
project_id=0,
region_id=0,
)
print(connected_port_list.count){
"count": 1,
"results": [
{
"instance_id": "<string>",
"instance_name": "<string>",
"ip_assignments": [
{
"ip_address": "<string>",
"subnet": {
"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
},
"subnet_id": "<string>"
}
],
"network": {
"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": [
"<string>"
],
"tags": [
{
"key": "<string>",
"read_only": true,
"value": "<string>"
}
],
"task_id": null,
"type": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"port_id": "<string>"
}
]
}API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234$abcdef
Project ID
Region ID
Port ID
List of port IDs that will share one VIP
[
"351b0dd7-ca09-431c-be53-935db3785067",
"bc688791-f1b0-44eb-97d4-07697294b1e1"
]Was this page helpful?