# Regions

## Get Region

`client.regions.get(stringname, RequestOptionsoptions?): Region`

**get** `/v1/regions/{name}`

Get a region by name

### Parameters

- `name: string`

### Returns

- `Region`

  Region response with product availability.

  - `availability: RegionAvailability`

    Availability status of the region.

    - `"live"`

    - `"preview"`

    - `"maintenance"`

    - `"sunset"`

  - `compute: Compute`

    Compute products available in this region.

    - `vms: boolean`

      VMs indicates if Virtual Machines are available.

  - `name: string`

    Name of the region.

  - `networking: Networking`

    Networking products available in this region.

    - `connect: boolean`

      Connect indicates if Nirvana Connect is available.

    - `vpcs: boolean`

      VPCs indicates if Virtual Private Clouds are available.

  - `nks: NKS`

    NKS products available in this region.

    - `autoscaling: boolean`

      Autoscaling indicates if NKS node pool autoscaling is available.

    - `clusters: boolean`

      Clusters indicates if NKS managed Kubernetes clusters are available.

  - `storage: Storage`

    Storage products available in this region.

    - `abs: boolean`

      ABS indicates if Accelerated Block Storage is available.

    - `local_nvme: boolean`

      LocalNVMe indicates if locally-attached NVMe storage is available.

### 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 region = await client.regions.get('us-sva-2');

console.log(region.availability);
```

#### Response

```json
{
  "availability": "live",
  "compute": {
    "vms": true
  },
  "name": "us-sva-2",
  "networking": {
    "connect": true,
    "vpcs": true
  },
  "nks": {
    "autoscaling": false,
    "clusters": false
  },
  "storage": {
    "abs": false,
    "local_nvme": true
  }
}
```

## List Regions

`client.regions.list(RegionListParamsquery?, RequestOptionsoptions?): Cursor<Region>`

**get** `/v1/regions`

List all regions

### Parameters

- `query: RegionListParams`

  - `cursor?: string`

    Pagination cursor returned by a previous request

  - `limit?: number`

    Maximum number of items to return

### Returns

- `Region`

  Region response with product availability.

  - `availability: RegionAvailability`

    Availability status of the region.

    - `"live"`

    - `"preview"`

    - `"maintenance"`

    - `"sunset"`

  - `compute: Compute`

    Compute products available in this region.

    - `vms: boolean`

      VMs indicates if Virtual Machines are available.

  - `name: string`

    Name of the region.

  - `networking: Networking`

    Networking products available in this region.

    - `connect: boolean`

      Connect indicates if Nirvana Connect is available.

    - `vpcs: boolean`

      VPCs indicates if Virtual Private Clouds are available.

  - `nks: NKS`

    NKS products available in this region.

    - `autoscaling: boolean`

      Autoscaling indicates if NKS node pool autoscaling is available.

    - `clusters: boolean`

      Clusters indicates if NKS managed Kubernetes clusters are available.

  - `storage: Storage`

    Storage products available in this region.

    - `abs: boolean`

      ABS indicates if Accelerated Block Storage is available.

    - `local_nvme: boolean`

      LocalNVMe indicates if locally-attached NVMe storage is available.

### 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 region of client.regions.list()) {
  console.log(region.availability);
}
```

#### Response

```json
{
  "items": [
    {
      "availability": "live",
      "compute": {
        "vms": true
      },
      "name": "us-sva-2",
      "networking": {
        "connect": true,
        "vpcs": true
      },
      "nks": {
        "autoscaling": false,
        "clusters": false
      },
      "storage": {
        "abs": false,
        "local_nvme": true
      }
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```

## Domain Types

### Region

- `Region`

  Region response with product availability.

  - `availability: RegionAvailability`

    Availability status of the region.

    - `"live"`

    - `"preview"`

    - `"maintenance"`

    - `"sunset"`

  - `compute: Compute`

    Compute products available in this region.

    - `vms: boolean`

      VMs indicates if Virtual Machines are available.

  - `name: string`

    Name of the region.

  - `networking: Networking`

    Networking products available in this region.

    - `connect: boolean`

      Connect indicates if Nirvana Connect is available.

    - `vpcs: boolean`

      VPCs indicates if Virtual Private Clouds are available.

  - `nks: NKS`

    NKS products available in this region.

    - `autoscaling: boolean`

      Autoscaling indicates if NKS node pool autoscaling is available.

    - `clusters: boolean`

      Clusters indicates if NKS managed Kubernetes clusters are available.

  - `storage: Storage`

    Storage products available in this region.

    - `abs: boolean`

      ABS indicates if Accelerated Block Storage is available.

    - `local_nvme: boolean`

      LocalNVMe indicates if locally-attached NVMe storage is available.

### Region Availability

- `RegionAvailability = "live" | "preview" | "maintenance" | "sunset"`

  Availability status of the region.

  - `"live"`

  - `"preview"`

  - `"maintenance"`

  - `"sunset"`

### Region List

- `RegionList`

  - `items: Array<Region>`

    - `availability: RegionAvailability`

      Availability status of the region.

      - `"live"`

      - `"preview"`

      - `"maintenance"`

      - `"sunset"`

    - `compute: Compute`

      Compute products available in this region.

      - `vms: boolean`

        VMs indicates if Virtual Machines are available.

    - `name: string`

      Name of the region.

    - `networking: Networking`

      Networking products available in this region.

      - `connect: boolean`

        Connect indicates if Nirvana Connect is available.

      - `vpcs: boolean`

        VPCs indicates if Virtual Private Clouds are available.

    - `nks: NKS`

      NKS products available in this region.

      - `autoscaling: boolean`

        Autoscaling indicates if NKS node pool autoscaling is available.

      - `clusters: boolean`

        Clusters indicates if NKS managed Kubernetes clusters are available.

    - `storage: Storage`

      Storage products available in this region.

      - `abs: boolean`

        ABS indicates if Accelerated Block Storage is available.

      - `local_nvme: boolean`

        LocalNVMe indicates if locally-attached NVMe storage is available.

  - `pagination: Pagination`

    Pagination response details.

    - `next_cursor: string | null`

    - `previous_cursor: string | null`

    - `total_count: number`
