# VMs

## Create VM

`client.compute.vms.create(VMCreateParamsbody, RequestOptionsoptions?): Operation`

**post** `/v1/compute/vms`

Create a VM

### Parameters

- `body: VMCreateParams`

  - `boot_volume: BootVolume`

    Boot volume for the VM.

    - `size: number`

      Size of the Volume in GB.

    - `type: VolumeType`

      Type of the Volume.

      - `"nvme"`

      - `"abs"`

    - `tags?: Array<string>`

      Tags to attach to the Volume.

  - `instance_type: string`

    Instance type name.

  - `name: string`

    Name of the VM.

  - `os_image_name: string`

    Name of the OS Image to use for the VM.

  - `project_id: string`

    Project ID to create the VM in.

  - `public_ip_enabled: boolean`

    Whether to enable public IP for the VM.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

  - `ssh_key: SSHKeyRequest`

    Public SSH key configuration for the VM.

    - `public_key: string`

      Public key to and use to access the VM.

  - `subnet_id: string`

    ID of the subnet to use for the VM.

  - `data_volumes?: Array<DataVolume>`

    Data volumes for the VM.

    - `name: string`

      Name of the Volume.

    - `size: number`

      Size of the Volume in GB.

    - `type: VolumeType`

      Type of the Volume.

    - `tags?: Array<string>`

      Tags to attach to the Volume.

  - `tags?: Array<string>`

    Tags to attach to the VM.

### Returns

- `Operation`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails | null`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string | number | boolean | Array<string>`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

      - `to: string | number | boolean | Array<string>`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const operation = await client.compute.vms.create({
  boot_volume: { size: 100, type: 'abs' },
  instance_type: 'n1-standard-8',
  name: 'my-vm',
  os_image_name: 'ubuntu-noble-2025-10-01',
  project_id: '123e4567-e89b-12d3-a456-426614174000',
  public_ip_enabled: true,
  region: 'us-sva-2',
  ssh_key: {
    public_key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDBIASkmwNiLcdlW6927Zjt1Hf7Kw/PpEZ4Zm+wU9wn2',
  },
  subnet_id: '123e4567-e89b-12d3-a456-426614174000',
});

console.log(operation.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Get VM Details

`client.compute.vms.get(stringvmID, RequestOptionsoptions?): VM`

**get** `/v1/compute/vms/{vm_id}`

Get details about a VM

### Parameters

- `vmID: string`

### Returns

- `VM`

  VM details.

  - `id: string`

    Unique identifier for the VM.

  - `boot_volume_id: string`

    ID of the boot volume attached to the VM.

  - `cpu_config: CPUConfig`

    CPU configuration for the VM.

    - `vcpu: number`

      Number of virtual CPUs.

  - `created_at: string`

    When the VM was created.

  - `data_volume_ids: Array<string>`

    IDs of the data volumes attached to the VM.

  - `memory_config: MemoryConfig`

    Memory configuration for the VM.

    - `size: number`

      Size of the memory in GB.

  - `name: string`

    Name of the VM.

  - `private_ip: string | null`

    Private IP of the VM.

  - `project_id: string`

    Project ID the VM belongs to.

  - `public_ip: string | null`

    Public IP of the VM.

  - `public_ip_enabled: boolean`

    Whether the public IP is enabled for the VM.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

  - `subnet_id: string`

    ID of the subnet the VM is in.

  - `tags: Array<string>`

    Tags to attach to the VM.

  - `updated_at: string`

    When the VM was updated.

  - `vpc_id: string`

    ID of the VPC the VM is in.

  - `vpc_name: string`

    Name of the VPC the VM is in.

  - `instance_type?: string | null`

    Instance type name.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const vm = await client.compute.vms.get('vm_id');

console.log(vm.id);
```

#### Response

```json
{
  "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"
}
```

## Update VM

`client.compute.vms.update(stringvmID, VMUpdateParamsbody, RequestOptionsoptions?): Operation`

**patch** `/v1/compute/vms/{vm_id}`

Update a VM

### Parameters

- `vmID: string`

- `body: VMUpdateParams`

  - `instance_type?: string`

    Instance type name.

  - `name?: string`

    Name of the VM.

  - `public_ip_enabled?: boolean`

    Whether to enable public IP for the VM.

  - `tags?: Array<string>`

    Tags to attach to the VM.

### Returns

- `Operation`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails | null`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string | number | boolean | Array<string>`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

      - `to: string | number | boolean | Array<string>`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const operation = await client.compute.vms.update('vm_id');

console.log(operation.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Delete VM

`client.compute.vms.delete(stringvmID, RequestOptionsoptions?): Operation`

**delete** `/v1/compute/vms/{vm_id}`

Delete a VM

### Parameters

- `vmID: string`

### Returns

- `Operation`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails | null`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string | number | boolean | Array<string>`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

      - `to: string | number | boolean | Array<string>`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const operation = await client.compute.vms.delete('vm_id');

console.log(operation.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## List VMs

`client.compute.vms.list(VMListParamsquery, RequestOptionsoptions?): Cursor<VM>`

**get** `/v1/compute/vms`

List all VMs

### Parameters

- `query: VMListParams`

  - `project_id: string`

    Project ID of resources to request

  - `cursor?: string`

    Pagination cursor returned by a previous request

  - `limit?: number`

    Maximum number of items to return

### Returns

- `VM`

  VM details.

  - `id: string`

    Unique identifier for the VM.

  - `boot_volume_id: string`

    ID of the boot volume attached to the VM.

  - `cpu_config: CPUConfig`

    CPU configuration for the VM.

    - `vcpu: number`

      Number of virtual CPUs.

  - `created_at: string`

    When the VM was created.

  - `data_volume_ids: Array<string>`

    IDs of the data volumes attached to the VM.

  - `memory_config: MemoryConfig`

    Memory configuration for the VM.

    - `size: number`

      Size of the memory in GB.

  - `name: string`

    Name of the VM.

  - `private_ip: string | null`

    Private IP of the VM.

  - `project_id: string`

    Project ID the VM belongs to.

  - `public_ip: string | null`

    Public IP of the VM.

  - `public_ip_enabled: boolean`

    Whether the public IP is enabled for the VM.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

  - `subnet_id: string`

    ID of the subnet the VM is in.

  - `tags: Array<string>`

    Tags to attach to the VM.

  - `updated_at: string`

    When the VM was updated.

  - `vpc_id: string`

    ID of the VPC the VM is in.

  - `vpc_name: string`

    Name of the VPC the VM is in.

  - `instance_type?: string | null`

    Instance type name.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const vm of client.compute.vms.list({ project_id: 'project_id' })) {
  console.log(vm.id);
}
```

#### Response

```json
{
  "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
  }
}
```

## Restart VM

`client.compute.vms.restart(stringvmID, RequestOptionsoptions?): Operation`

**post** `/v1/compute/vms/{vm_id}/restart`

Restart a VM

### Parameters

- `vmID: string`

### Returns

- `Operation`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails | null`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string | number | boolean | Array<string>`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

      - `to: string | number | boolean | Array<string>`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `Array<string>`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

const operation = await client.compute.vms.restart('vm_id');

console.log(operation.id);
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Domain Types

### CPU Config

- `CPUConfig`

  CPU configuration for the VM.

  - `vcpu: number`

    Number of virtual CPUs.

### Memory Config

- `MemoryConfig`

  Memory configuration for the VM.

  - `size: number`

    Size of the memory in GB.

### OS Image

- `OSImage`

  OS Image details.

  - `created_at: string`

    When the OS Image was created.

  - `display_name: string`

    Display name of the OS Image.

  - `name: string`

    Name of the OS Image.

### SSH Key Request

- `SSHKeyRequest`

  Public SSH key configuration for the VM.

  - `public_key: string`

    Public key to and use to access the VM.

### VM

- `VM`

  VM details.

  - `id: string`

    Unique identifier for the VM.

  - `boot_volume_id: string`

    ID of the boot volume attached to the VM.

  - `cpu_config: CPUConfig`

    CPU configuration for the VM.

    - `vcpu: number`

      Number of virtual CPUs.

  - `created_at: string`

    When the VM was created.

  - `data_volume_ids: Array<string>`

    IDs of the data volumes attached to the VM.

  - `memory_config: MemoryConfig`

    Memory configuration for the VM.

    - `size: number`

      Size of the memory in GB.

  - `name: string`

    Name of the VM.

  - `private_ip: string | null`

    Private IP of the VM.

  - `project_id: string`

    Project ID the VM belongs to.

  - `public_ip: string | null`

    Public IP of the VM.

  - `public_ip_enabled: boolean`

    Whether the public IP is enabled for the VM.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

  - `subnet_id: string`

    ID of the subnet the VM is in.

  - `tags: Array<string>`

    Tags to attach to the VM.

  - `updated_at: string`

    When the VM was updated.

  - `vpc_id: string`

    ID of the VPC the VM is in.

  - `vpc_name: string`

    Name of the VPC the VM is in.

  - `instance_type?: string | null`

    Instance type name.

### VM List

- `VMList`

  - `items: Array<VM>`

    - `id: string`

      Unique identifier for the VM.

    - `boot_volume_id: string`

      ID of the boot volume attached to the VM.

    - `cpu_config: CPUConfig`

      CPU configuration for the VM.

      - `vcpu: number`

        Number of virtual CPUs.

    - `created_at: string`

      When the VM was created.

    - `data_volume_ids: Array<string>`

      IDs of the data volumes attached to the VM.

    - `memory_config: MemoryConfig`

      Memory configuration for the VM.

      - `size: number`

        Size of the memory in GB.

    - `name: string`

      Name of the VM.

    - `private_ip: string | null`

      Private IP of the VM.

    - `project_id: string`

      Project ID the VM belongs to.

    - `public_ip: string | null`

      Public IP of the VM.

    - `public_ip_enabled: boolean`

      Whether the public IP is enabled for the VM.

    - `region: RegionName`

      Region the resource is in.

      - `"us-sva-2"`

    - `status: ResourceStatus`

      Status of the resource.

      - `"pending"`

      - `"creating"`

      - `"updating"`

      - `"ready"`

      - `"deleting"`

      - `"deleted"`

      - `"error"`

    - `subnet_id: string`

      ID of the subnet the VM is in.

    - `tags: Array<string>`

      Tags to attach to the VM.

    - `updated_at: string`

      When the VM was updated.

    - `vpc_id: string`

      ID of the VPC the VM is in.

    - `vpc_name: string`

      Name of the VPC the VM is in.

    - `instance_type?: string | null`

      Instance type name.

  - `pagination: Pagination`

    Pagination response details.

    - `next_cursor: string | null`

    - `previous_cursor: string | null`

    - `total_count: number`

# Availability

## Check VM Create Availability

`client.compute.vms.availability.create(AvailabilityCreateParamsbody, RequestOptionsoptions?): void`

**post** `/v1/compute/vms/availability`

Check VM Create Availability

### Parameters

- `body: AvailabilityCreateParams`

  - `boot_volume: BootVolume`

    Boot volume for the VM.

    - `size: number`

      Size of the Volume in GB.

    - `type: VolumeType`

      Type of the Volume.

      - `"nvme"`

      - `"abs"`

    - `tags?: Array<string>`

      Tags to attach to the Volume.

  - `instance_type: string`

    Instance type name.

  - `name: string`

    Name of the VM.

  - `os_image_name: string`

    Name of the OS Image to use for the VM.

  - `project_id: string`

    Project ID to create the VM in.

  - `public_ip_enabled: boolean`

    Whether to enable public IP for the VM.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

  - `ssh_key: SSHKeyRequest`

    Public SSH key configuration for the VM.

    - `public_key: string`

      Public key to and use to access the VM.

  - `subnet_id: string`

    ID of the subnet to use for the VM.

  - `data_volumes?: Array<DataVolume>`

    Data volumes for the VM.

    - `name: string`

      Name of the Volume.

    - `size: number`

      Size of the Volume in GB.

    - `type: VolumeType`

      Type of the Volume.

    - `tags?: Array<string>`

      Tags to attach to the Volume.

  - `tags?: Array<string>`

    Tags to attach to the VM.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

await client.compute.vms.availability.create({
  boot_volume: { size: 100, type: 'abs' },
  instance_type: 'n1-standard-8',
  name: 'my-vm',
  os_image_name: 'ubuntu-noble-2025-10-01',
  project_id: '123e4567-e89b-12d3-a456-426614174000',
  public_ip_enabled: true,
  region: 'us-sva-2',
  ssh_key: {
    public_key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDBIASkmwNiLcdlW6927Zjt1Hf7Kw/PpEZ4Zm+wU9wn2',
  },
  subnet_id: '123e4567-e89b-12d3-a456-426614174000',
});
```

## Check VM Update Availability

`client.compute.vms.availability.update(stringvmID, AvailabilityUpdateParamsbody, RequestOptionsoptions?): void`

**patch** `/v1/compute/vms/{vm_id}/availability`

Check VM Update Availability

### Parameters

- `vmID: string`

- `body: AvailabilityUpdateParams`

  - `instance_type?: string`

    Instance type name.

  - `name?: string`

    Name of the VM.

  - `public_ip_enabled?: boolean`

    Whether to enable public IP for the VM.

  - `tags?: Array<string>`

    Tags to attach to the VM.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

await client.compute.vms.availability.update('vm_id');
```

# Volumes

## List VM's Volumes

`client.compute.vms.volumes.list(stringvmID, VolumeListParamsquery?, RequestOptionsoptions?): Cursor<Volume>`

**get** `/v1/compute/vms/{vm_id}/volumes`

List VM's Volumes

### Parameters

- `vmID: string`

- `query: VolumeListParams`

  - `cursor?: string`

    Pagination cursor returned by a previous request

  - `limit?: number`

    Maximum number of items to return

### Returns

- `Volume`

  Volume details.

  - `id: string`

    Unique identifier for the Volume.

  - `created_at: string`

    When the Volume was created.

  - `kind: VolumeKind`

    Volume kind.

    - `"boot"`

    - `"data"`

  - `name: string`

    Name of the Volume.

  - `project_id: string`

    Project ID the Volume belongs to.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

  - `size: number`

    Size of the Volume in GB.

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

  - `tags: Array<string>`

    Tags to attach to the Volume.

  - `type: VolumeType`

    Type of the Volume.

    - `"nvme"`

    - `"abs"`

  - `updated_at: string`

    When the Volume was updated.

  - `vm_id: string | null`

    ID of the VM the Volume is attached to.

  - `vm_name: string | null`

    Name of the VM the Volume is attached to.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const volume of client.compute.vms.volumes.list('vm_id')) {
  console.log(volume.id);
}
```

#### Response

```json
{
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "created_at": "2025-01-01T00:00:00Z",
      "kind": "boot",
      "name": "my-volume",
      "project_id": "123e4567-e89b-12d3-a456-426614174000",
      "region": "us-sva-2",
      "size": 100,
      "status": "ready",
      "tags": [
        "production",
        "ethereum"
      ],
      "type": "abs",
      "updated_at": "2025-01-01T00:00:00Z",
      "vm_id": "123e4567-e89b-12d3-a456-426614174000",
      "vm_name": "my-vm"
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```

# OS Images

## List OS Images

`client.compute.vms.osImages.list(OSImageListParamsquery?, RequestOptionsoptions?): Cursor<OSImage>`

**get** `/v1/compute/vms/os_images`

List all OS Images

### Parameters

- `query: OSImageListParams`

  - `cursor?: string`

    Pagination cursor returned by a previous request

  - `limit?: number`

    Maximum number of items to return

### Returns

- `OSImage`

  OS Image details.

  - `created_at: string`

    When the OS Image was created.

  - `display_name: string`

    Display name of the OS Image.

  - `name: string`

    Name of the OS Image.

### Example

```typescript
import NirvanaLabs from '@nirvana-labs/nirvana';

const client = new NirvanaLabs({
  apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const osImage of client.compute.vms.osImages.list()) {
  console.log(osImage.created_at);
}
```

#### Response

```json
{
  "items": [
    {
      "created_at": "2025-01-01T00:00:00Z",
      "display_name": "Ubuntu 24.04 (Noble)",
      "name": "ubuntu-noble-2025-10-01"
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```
