List VPC Networks
Retrieve all VPC networks across all GCP projects, including their subnets.
Response
Array of VPC networks
Cloud provider identifier (always “GCP”)
Whether subnets are automatically created
Routing mode: “REGIONAL” or “GLOBAL”
Project ID containing this VPC
Array of subnets in this VPC
Region where the subnet is located
IP CIDR range (e.g., “10.0.0.0/24”)
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
GCP project ID where the VPC will be created
Name for the new VPC network
Optional description for the VPC
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
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
GCP project ID containing the VPC
Region where the subnet will be created (e.g., “us-central1”)
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
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'."
}