Skip to content

List All Block Storage Volumes

client.GPUDroplets.Volumes.List(ctx, query) (*GPUDropletVolumeListResponse, error)
get/v2/volumes

To list all of the block storage volumes available on your account, send a GET request to /v2/volumes.

Filtering Results

By Region

The region may be provided as query parameter in order to restrict results to volumes available in a specific region. For example: /v2/volumes?region=nyc1

By Name

It is also possible to list volumes on your account that match a specified name. To do so, send a GET request with the volume's name as a query parameter to /v2/volumes?name=$VOLUME_NAME. Note: You can only create one volume per region with the same name.

By Name and Region

It is also possible to retrieve information about a block storage volume by name. To do so, send a GET request with the volume's name and the region slug for the region it is located in as query parameters to /v2/volumes?name=$VOLUME_NAME&region=nyc1.

ParametersExpand Collapse
query GPUDropletVolumeListParams
Name param.Field[string]optional

The block storage volume's name.

Page param.Field[int64]optional

Which 'page' of paginated results to return.

minimum1
PerPage param.Field[int64]optional

Number of items returned per page

minimum1
maximum200
Region param.Field[GPUDropletVolumeListParamsRegion]optional

The slug identifier for the region where the resource is available.

const GPUDropletVolumeListParamsRegionAms1 GPUDropletVolumeListParamsRegion = "ams1"
const GPUDropletVolumeListParamsRegionAms2 GPUDropletVolumeListParamsRegion = "ams2"
const GPUDropletVolumeListParamsRegionAms3 GPUDropletVolumeListParamsRegion = "ams3"
const GPUDropletVolumeListParamsRegionBlr1 GPUDropletVolumeListParamsRegion = "blr1"
const GPUDropletVolumeListParamsRegionFra1 GPUDropletVolumeListParamsRegion = "fra1"
const GPUDropletVolumeListParamsRegionLon1 GPUDropletVolumeListParamsRegion = "lon1"
const GPUDropletVolumeListParamsRegionNyc1 GPUDropletVolumeListParamsRegion = "nyc1"
const GPUDropletVolumeListParamsRegionNyc2 GPUDropletVolumeListParamsRegion = "nyc2"
const GPUDropletVolumeListParamsRegionNyc3 GPUDropletVolumeListParamsRegion = "nyc3"
const GPUDropletVolumeListParamsRegionSfo1 GPUDropletVolumeListParamsRegion = "sfo1"
const GPUDropletVolumeListParamsRegionSfo2 GPUDropletVolumeListParamsRegion = "sfo2"
const GPUDropletVolumeListParamsRegionSfo3 GPUDropletVolumeListParamsRegion = "sfo3"
const GPUDropletVolumeListParamsRegionSgp1 GPUDropletVolumeListParamsRegion = "sgp1"
const GPUDropletVolumeListParamsRegionTor1 GPUDropletVolumeListParamsRegion = "tor1"
const GPUDropletVolumeListParamsRegionSyd1 GPUDropletVolumeListParamsRegion = "syd1"
ReturnsExpand Collapse
type GPUDropletVolumeListResponse struct{…}

Information about the response itself.

Total int64optional

Number of objects returned by the request.

Volumes []GPUDropletVolumeListResponseVolume

Array of volumes.

ID stringoptional

The unique identifier for the block storage volume.

CreatedAt stringoptional

A time value given in ISO8601 combined date and time format that represents when the block storage volume was created.

Description stringoptional

An optional free-form text field to describe a block storage volume.

DropletIDs []int64optional

An array containing the IDs of the Droplets the volume is attached to. Note that at this time, a volume can only be attached to a single Droplet.

FilesystemLabel stringoptional

The label currently applied to the filesystem.

FilesystemType stringoptional

The type of filesystem currently in-use on the volume.

Name stringoptional

A human-readable name for the block storage volume. Must be lowercase and be composed only of numbers, letters and "-", up to a limit of 64 characters. The name must begin with a letter.

Region Regionoptional

The region that the block storage volume is located in. When setting a region, the value should be the slug identifier for the region. When you query a block storage volume, the entire region object will be returned.

Available bool

This is a boolean value that represents whether new Droplets can be created in this region.

Features []string

This attribute is set to an array which contains features available in this region

Name string

The display name of the region. This will be a full name that is used in the control panel and other interfaces.

Sizes []string

This attribute is set to an array which contains the identifying slugs for the sizes available in this region. sizes:read is required to view.

Slug string

A human-readable string that is used as a unique identifier for each region.

SizeGigabytes int64optional

The size of the block storage volume in GiB (1024^3). This field does not apply when creating a volume from a snapshot.

Tags []stringoptional

A flat array of tag names as strings applied to the resource.

Requires tag:read scope.

Accepts one of the following:
List All Block Storage Volumes
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := gradient.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  volumes, err := client.GPUDroplets.Volumes.List(context.TODO(), gradient.GPUDropletVolumeListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", volumes.Meta)
}
{
  "volumes": [
    {
      "id": "506f78a4-e098-11e5-ad9f-000f53306ae1",
      "region": {
        "name": "New York 1",
        "slug": "nyc1",
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192gb"
        ],
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata"
        ],
        "available": true
      },
      "droplet_ids": [],
      "name": "example",
      "description": "Block store for examples",
      "size_gigabytes": 10,
      "created_at": "2016-03-02T17:00:49Z",
      "filesystem_type": "ext4",
      "filesystem_label": "example",
      "tags": [
        "aninterestingtag"
      ]
    },
    {
      "id": "506f78a4-e098-11e5-ad9f-000f53305eb2",
      "region": {
        "name": "New York 3",
        "slug": "nyc3",
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192gb"
        ],
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata"
        ],
        "available": true
      },
      "droplet_ids": [],
      "name": "example",
      "description": "Block store for examples",
      "size_gigabytes": 10,
      "created_at": "2016-03-02T17:01:49Z",
      "filesystem_type": "ext4",
      "filesystem_label": "example",
      "tags": [
        "aninterestingtag"
      ]
    }
  ],
  "links": {},
  "meta": {
    "total": 2
  }
}
Returns Examples
{
  "volumes": [
    {
      "id": "506f78a4-e098-11e5-ad9f-000f53306ae1",
      "region": {
        "name": "New York 1",
        "slug": "nyc1",
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192gb"
        ],
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata"
        ],
        "available": true
      },
      "droplet_ids": [],
      "name": "example",
      "description": "Block store for examples",
      "size_gigabytes": 10,
      "created_at": "2016-03-02T17:00:49Z",
      "filesystem_type": "ext4",
      "filesystem_label": "example",
      "tags": [
        "aninterestingtag"
      ]
    },
    {
      "id": "506f78a4-e098-11e5-ad9f-000f53305eb2",
      "region": {
        "name": "New York 3",
        "slug": "nyc3",
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192gb"
        ],
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata"
        ],
        "available": true
      },
      "droplet_ids": [],
      "name": "example",
      "description": "Block store for examples",
      "size_gigabytes": 10,
      "created_at": "2016-03-02T17:01:49Z",
      "filesystem_type": "ext4",
      "filesystem_label": "example",
      "tags": [
        "aninterestingtag"
      ]
    }
  ],
  "links": {},
  "meta": {
    "total": 2
  }
}