GET
/
cloud
/
v1
/
subnets
/
{project_id}
/
{region_id}
import os
from gcore import Gcore

client = Gcore(
    api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
)
page = client.cloud.networks.subnets.list(
    project_id=1,
    region_id=1,
)
page = page.results[0]
print(page.cidr)
{
  "count": 1,
  "results": [
    {
      "available_ips": 250,
      "cidr": "192.168.13.0/24",
      "created_at": "2019-06-13T13:58:12+0000",
      "creator_task_id": "5cc890da-d031-4a23-ac31-625edfa22812",
      "dns_nameservers": [
        "8.8.8.8",
        "8.8.4.4"
      ],
      "enable_dhcp": true,
      "gateway_ip": "192.168.13.1",
      "has_router": false,
      "host_routes": [],
      "id": "b39792c3-3160-4356-912e-ba396c95cdcf",
      "ip_version": 4,
      "name": "subnet_3",
      "network_id": "b30d0de7-bca2-4c83-9c57-9e645bd2cc92",
      "project_id": 1337,
      "region": "Luxembourg 1",
      "region_id": 7,
      "tags": [
        {
          "key": "my-tag",
          "read_only": false,
          "value": "my-tag-value"
        }
      ],
      "task_id": null,
      "total_ips": 253,
      "updated_at": "2019-06-13T13:58:12+0000"
    }
  ]
}

Authorizations

APIKey
string
header
required

API key for authentication.

Path Parameters

project_id
integer
required

Project ID

Examples:

1

region_id
integer
required

Region ID

Examples:

1

Query Parameters

limit
integer
default:1000

Optional. Limit the number of returned items

Required range: 0 < x <= 1000
Examples:

1000

network_id
string

Only list subnets of this network

Examples:

"b30d0de7-bca2-4c83-9c57-9e645bd2cc92"

offset
integer
default:0

Optional. Offset value is used to exclude the first set of records from the result

Required range: x >= 0
Examples:

0

order_by
enum<string>

Ordering subnets list result by name, created_at, updated_at, available_ips, total_ips, and cidr (default) fields of the subnet and directions (name.asc).

Available options:
available_ips.asc,
available_ips.desc,
cidr.asc,
cidr.desc,
created_at.asc,
created_at.desc,
name.asc,
name.desc,
total_ips.asc,
total_ips.desc,
updated_at.asc,
updated_at.desc
tag_key
string[]

Optional. Filter by tag keys. ?tag_key=key1&tag_key=key2

Tag key. The maximum size for a key is 255 bytes.

Examples:
["key1", "key2"]
tag_key_value
string

Optional. Filter by tag key-value pairs. curl -G --data-urlencode "tag_key_value={"key": "value"}" --url "https://example.com/cloud/v1/resource/1/1"

Examples:
{ "key": "value" }

Response

200 - application/json

OK

The response is of type object.