Skip to content
Get started

List volumes

client.Volumes.List(ctx, query) (*[]Volume, error)
get/volumes

List volumes

ParametersExpand Collapse
query VolumeListParams
Tags param.Field[map[string, string]]optional

Filter volumes by tag key-value pairs.

ReturnsExpand Collapse
type VolumeListResponse []Volume
ID string

Unique identifier

CreatedAt Time

Creation timestamp (RFC3339)

formatdate-time
Name string

Volume name

SizeGB int64

Size in gigabytes

Attachments []VolumeAttachmentoptional

List of current attachments (empty if not attached)

InstanceID string

ID of the instance this volume is attached to

MountPath string

Mount path in the guest

Readonly bool

Whether the attachment is read-only

Tags map[string, string]optional

User-defined key-value tags.

List volumes
package main

import (
  "context"
  "fmt"

  "github.com/kernel/hypeman-go"
  "github.com/kernel/hypeman-go/option"
)

func main() {
  client := hypeman.NewClient(
    option.WithAPIKey("My API Key"),
  )
  volumes, err := client.Volumes.List(context.TODO(), hypeman.VolumeListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", volumes)
}
[
  {
    "id": "vol-data-1",
    "created_at": "2025-01-15T09:00:00Z",
    "name": "my-data-volume",
    "size_gb": 10,
    "attachments": [
      {
        "instance_id": "inst-abc123",
        "mount_path": "/mnt/data",
        "readonly": false
      }
    ],
    "tags": {
      "team": "backend",
      "env": "staging"
    }
  }
]
Returns Examples
[
  {
    "id": "vol-data-1",
    "created_at": "2025-01-15T09:00:00Z",
    "name": "my-data-volume",
    "size_gb": 10,
    "attachments": [
      {
        "instance_id": "inst-abc123",
        "mount_path": "/mnt/data",
        "readonly": false
      }
    ],
    "tags": {
      "team": "backend",
      "env": "staging"
    }
  }
]