Skip to content
DocsOpenAPI spec

    List Volumes

    client.Compute.Volumes.List(ctx, query) (*Cursor[Volume], error)
    GET/v1/compute/volumes

    List all volumes

    ParametersExpand Collapse
    query VolumeListParams
    ProjectID param.Field[string]

    Project ID of resources to request

    Attached param.Field[bool]Optional

    Filter by whether the Volume is attached to a VM. Combine with vm_id and both must hold.

    Cursor param.Field[string]Optional

    Pagination cursor returned by a previous request. Only valid for the same filters and sort order.

    Kind param.Field[VolumeListParamsKind]Optional

    Filter by Volume kind

    const VolumeListParamsKindBoot VolumeListParamsKind = "boot"
    const VolumeListParamsKindData VolumeListParamsKind = "data"
    Limit param.Field[int64]Optional

    Maximum number of items to return

    maximum100
    minimum10
    Name param.Field[string]Optional

    Filter by a case-insensitive substring of the Volume name

    Region param.Field[string]Optional

    Filter by region

    Sort param.Field[string]Optional

    Comma-separated sort terms in precedence order, each field:asc or field:desc. Fields: created_at, updated_at, name, status, size

    Status param.Field[VolumeListParamsStatus]Optional

    Filter by Volume status

    const VolumeListParamsStatusPending VolumeListParamsStatus = "pending"
    const VolumeListParamsStatusCreating VolumeListParamsStatus = "creating"
    const VolumeListParamsStatusUpdating VolumeListParamsStatus = "updating"
    const VolumeListParamsStatusReady VolumeListParamsStatus = "ready"
    const VolumeListParamsStatusDeleting VolumeListParamsStatus = "deleting"
    const VolumeListParamsStatusError VolumeListParamsStatus = "error"
    Tags param.Field[[]string]Optional

    Filter by tags. Repeat the parameter to require several tags; a Volume must carry all of them.

    Type param.Field[VolumeListParamsType]Optional

    Filter by storage type

    const VolumeListParamsTypeNvme VolumeListParamsType = "nvme"
    const VolumeListParamsTypeABS VolumeListParamsType = "abs"
    VMID param.Field[string]Optional

    Filter by the VM the Volume is attached to

    ReturnsExpand Collapse
    type Volume struct{…}

    Volume details.

    ID string

    Unique identifier for the Volume.

    CreatedAt Time

    When the Volume was created.

    formatdate-time

    Volume kind.

    One of the following:
    const VolumeKindBoot VolumeKind = "boot"
    const VolumeKindData VolumeKind = "data"
    Name string

    Name of the Volume.

    ProjectID string

    Project ID the Volume belongs to.

    Region RegionName

    Region the resource is in.

    Size int64

    Size of the Volume in GB.

    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"
    Tags []string

    Tags to attach to the Volume.

    Type of the Volume.

    One of the following:
    const VolumeTypeNvme VolumeType = "nvme"
    const VolumeTypeABS VolumeType = "abs"
    UpdatedAt Time

    When the Volume was updated.

    formatdate-time
    VMID string

    ID of the VM the Volume is attached to.

    VMName string

    Name of the VM the Volume is attached to.

    List Volumes

    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.Volumes.List(context.TODO(), compute.VolumeListParams{
        ProjectID: "project_id",
      })
      if err != nil {
        panic(err.Error())
      }
      fmt.Printf("%+v\n", page)
    }
    
    {
      "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
      }
    }
    Returns Examples
    {
      "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
      }
    }