Skip to main content

List VPC Networks

Retrieve all VPC networks across all GCP projects, including their subnets.

Response

value
array
Array of VPC networks

Example Request

curl -X GET https://api.example.com/api/gcp/list_gcp_vpcs \
  -H "Cookie: session=your-session-token"

Example Response

{
  "value": [
    {
      "provider": "GCP",
      "name": "my-vpc",
      "id": "1234567890123456789",
      "description": "Custom VPC network",
      "subnetMode": false,
      "routingMode": "REGIONAL",
      "projectId": "my-project-123",
      "subnets": [
        {
          "name": "my-subnet",
          "region": "us-central1",
          "ipCidrRange": "10.0.1.0/24"
        }
      ]
    }
  ]
}

Create VPC Network

Create a new VPC network in a specific project.

Request Body

projectId
string
required
GCP project ID where the VPC will be created
vpcName
string
required
Name for the new VPC network
description
string
default:""
Optional description for the VPC
routingMode
string
default:"REGIONAL"
Routing mode: “REGIONAL” or “GLOBAL”

Example Request

curl -X POST https://api.example.com/api/gcp/create_gcp_vpc \
  -H "Content-Type: application/json" \
  -H "Cookie: session=your-session-token" \
  -d '{
    "projectId": "my-project-123",
    "vpcName": "my-custom-vpc",
    "description": "Custom VPC for production",
    "routingMode": "REGIONAL"
  }'

Response

message
string
Success message confirming VPC creation
{
  "message": "Sieć VPC 'my-custom-vpc' została pomyślnie utworzona."
}

Configuration Details

  • Auto-create subnets is set to false (custom mode)
  • You must manually create subnets after VPC creation
  • Routing mode determines how routes are shared across regions

Create Subnet

Create a new subnet within an existing VPC network.

Request Body

projectId
string
required
GCP project ID containing the VPC
region
string
required
Region where the subnet will be created (e.g., “us-central1”)
vpcName
string
required
Name of the VPC network
subnetName
string
required
Name for the new subnet
ipCidrRange
string
required
IP CIDR range for the subnet (e.g., “10.0.1.0/24”)

Example Request

curl -X POST https://api.example.com/api/gcp/create_gcp_subnet \
  -H "Content-Type: application/json" \
  -H "Cookie: session=your-session-token" \
  -d '{
    "projectId": "my-project-123",
    "region": "us-central1",
    "vpcName": "my-custom-vpc",
    "subnetName": "my-subnet",
    "ipCidrRange": "10.0.1.0/24"
  }'

Response

message
string
Success message confirming subnet creation
{
  "message": "Subnet 'my-subnet' został pomyślnie utworzony w sieci 'my-custom-vpc'."
}

CIDR Range Guidelines

  • Use RFC 1918 private IP ranges:
    • 10.0.0.0/8
    • 172.16.0.0/12
    • 192.168.0.0/16
  • Subnet masks must be between /8 and /29
  • Ranges cannot overlap with other subnets in the VPC

Error Responses

VPC Already Exists

{
  "error": "Sieć VPC o nazwie 'my-custom-vpc' już istnieje w projekcie 'my-project-123'."
}

Subnet Already Exists

{
  "error": "Subnet o nazwie 'my-subnet' już istnieje w regionie 'us-central1'."
}

VPC Not Found

{
  "error": "Sieć VPC 'my-custom-vpc' nie została znaleziona w projekcie 'my-project-123'."
}

Permission Denied

{
  "error": "Brak uprawnień do tworzenia sieci VPC w projekcie 'my-project-123'."
}

Build docs developers (and LLMs) love