List VMs
package main
import (
"context"
"fmt"
"github.com/nirvana-labs/nirvana-go"
"github.com/nirvana-labs/nirvana-go/compute"
"github.com/nirvana-labs/nirvana-go/option"
)
func main() {
client := nirvana.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Compute.VMs.List(context.TODO(), compute.VMListParams{
ProjectID: "project_id",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
{
"items": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"boot_volume_id": "123e4567-e89b-12d3-a456-426614174000",
"cpu_config": {
"vcpu": 2
},
"created_at": "2025-01-01T00:00:00Z",
"data_volume_ids": [
"123e4567-e89b-12d3-a456-426614174001",
"123e4567-e89b-12d3-a456-426614174002"
],
"memory_config": {
"size": 2
},
"name": "my-vm",
"private_ip": "10.0.0.1",
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"public_ip": "123.123.123.123",
"public_ip_enabled": true,
"region": "us-sva-2",
"status": "ready",
"subnet_id": "123e4567-e89b-12d3-a456-426614174000",
"tags": [
"production",
"ethereum"
],
"updated_at": "2025-01-01T00:00:00Z",
"vpc_id": "123e4567-e89b-12d3-a456-426614174000",
"vpc_name": "my-vpc",
"instance_type": "n1-standard-8"
}
],
"pagination": {
"next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
"previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
"total_count": 125
}
}Returns Examples
{
"items": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"boot_volume_id": "123e4567-e89b-12d3-a456-426614174000",
"cpu_config": {
"vcpu": 2
},
"created_at": "2025-01-01T00:00:00Z",
"data_volume_ids": [
"123e4567-e89b-12d3-a456-426614174001",
"123e4567-e89b-12d3-a456-426614174002"
],
"memory_config": {
"size": 2
},
"name": "my-vm",
"private_ip": "10.0.0.1",
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"public_ip": "123.123.123.123",
"public_ip_enabled": true,
"region": "us-sva-2",
"status": "ready",
"subnet_id": "123e4567-e89b-12d3-a456-426614174000",
"tags": [
"production",
"ethereum"
],
"updated_at": "2025-01-01T00:00:00Z",
"vpc_id": "123e4567-e89b-12d3-a456-426614174000",
"vpc_name": "my-vpc",
"instance_type": "n1-standard-8"
}
],
"pagination": {
"next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
"previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
"total_count": 125
}
}