Skip to main content

List Virtual Machines

Retrieve all VM instances across all GCP projects and zones.

Response

value
array
Array of virtual machine instances

Example Request

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

Example Response

{
  "value": [
    {
      "provider": "GCP",
      "name": "my-vm-instance",
      "id": "1234567890123456789",
      "status": "RUNNING",
      "location": "us-central1-a",
      "machineType": "e2-medium",
      "projectId": "my-project-123"
    }
  ]
}

Create Virtual Machine

Create a new VM instance in a specific project and zone.

Request Body

projectId
string
required
GCP project ID where the VM will be created
zone
string
required
Zone where the VM will be created (e.g., “us-central1-a”)
vmName
string
required
Name for the new VM instance
machineType
string
default:"e2-medium"
Machine type for the VM (e.g., “e2-medium”, “n1-standard-1”)
sourceImage
string
Boot disk source image

Example Request

curl -X POST https://api.example.com/api/gcp/create_gcp_vms \
  -H "Content-Type: application/json" \
  -H "Cookie: session=your-session-token" \
  -d '{
    "projectId": "my-project-123",
    "zone": "us-central1-a",
    "vmName": "my-new-vm",
    "machineType": "e2-medium",
    "sourceImage": "projects/debian-cloud/global/images/family/debian-12"
  }'

Response

message
string
Success message confirming VM creation
{
  "message": "Maszyna wirtualna 'my-new-vm' została pomyślnie utworzona."
}

Delete Virtual Machine

Delete a VM instance from a specific project and zone.

Request Body

projectId
string
required
GCP project ID containing the VM
zone
string
required
Zone where the VM is located
vmName
string
required
Name of the VM instance to delete

Example Request

curl -X DELETE https://api.example.com/api/gcp/delete_gcp_vm \
  -H "Content-Type: application/json" \
  -H "Cookie: session=your-session-token" \
  -d '{
    "projectId": "my-project-123",
    "zone": "us-central1-a",
    "vmName": "my-vm-instance"
  }'

Response

message
string
Success message confirming VM deletion
{
  "message": "Rozpoczęto usuwanie maszyny wirtualnej 'my-vm-instance'."
}

Error Responses

{
  "error": "Maszyna wirtualna 'my-vm-instance' nie została znaleziona."
}
{
  "error": "Brak uprawnień do usunięcia maszyny wirtualnej 'my-vm-instance'."
}

Build docs developers (and LLMs) love