List Virtual Machines
Retrieve all VM instances across all GCP projects and zones.
Response
Array of virtual machine instances
Cloud provider identifier (always “GCP”)
Current VM status (e.g., “RUNNING”, “STOPPED”)
Zone where the VM is located
VM machine type (e.g., “e2-medium”)
Project ID containing this VM
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
GCP project ID where the VM will be created
Zone where the VM will be created (e.g., “us-central1-a”)
Name for the new VM instance
machineType
string
default:"e2-medium"
Machine type for the VM (e.g., “e2-medium”, “n1-standard-1”)
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
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
GCP project ID containing the VM
Zone where the VM is located
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
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'."
}