Skip to content
Docs

    Get VM Details

    client.Compute.VMs.Get(ctx, vmID) (*VM, error)
    GET/v1/compute/vms/{vm_id}

    Get details about a VM

    ParametersExpand Collapse
    vmID string
    ReturnsExpand Collapse
    type VM struct{…}

    VM details.

    ID string

    Unique identifier for the VM.

    BootVolumeID string

    ID of the boot volume attached to the VM.

    CPUConfig CPUConfig

    CPU configuration for the VM.

    Vcpu int64

    Number of virtual CPUs.

    maximum192
    minimum1
    CreatedAt Time

    When the VM was created.

    formatdate-time
    DataVolumeIDs []string

    IDs of the data volumes attached to the VM.

    MemoryConfig MemoryConfig

    Memory configuration for the VM.

    Size int64

    Size of the memory in GB.

    maximum768
    minimum1
    Name string

    Name of the VM.

    PrivateIP string

    Private IP of the VM.

    ProjectID string

    Project ID the VM belongs to.

    PublicIP string

    Public IP of the VM.

    PublicIPEnabled bool

    Whether the public IP is enabled for the VM.

    Region RegionName

    Region the resource is in.

    Status of the resource.

    One of the following:
    const ResourceStatusPending ResourceStatus = "pending"
    const ResourceStatusCreating ResourceStatus = "creating"
    const ResourceStatusUpdating ResourceStatus = "updating"
    const ResourceStatusReady ResourceStatus = "ready"
    const ResourceStatusDeleting ResourceStatus = "deleting"
    const ResourceStatusDeleted ResourceStatus = "deleted"
    const ResourceStatusError ResourceStatus = "error"
    SubnetID string

    ID of the subnet the VM is in.

    Tags []string

    Tags to attach to the VM.

    UpdatedAt Time

    When the VM was updated.

    formatdate-time
    VPCID string

    ID of the VPC the VM is in.

    VPCName string

    Name of the VPC the VM is in.

    InstanceType stringOptional

    Instance type name.

    Get VM Details

    package main
    
    import (
      "context"
      "fmt"
    
      "github.com/nirvana-labs/nirvana-go"
      "github.com/nirvana-labs/nirvana-go/option"
    )
    
    func main() {
      client := nirvana.NewClient(
        option.WithAPIKey("My API Key"),
      )
      vm, err := client.Compute.VMs.Get(context.TODO(), "vm_id")
      if err != nil {
        panic(err.Error())
      }
      fmt.Printf("%+v\n", vm.ID)
    }
    
    {
      "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"
    }
    Returns Examples
    {
      "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"
    }