Skip to content
DocsOpenAPI spec

    List Buckets

    client.Storage.Buckets.List(ctx, query) (*Cursor[Bucket], error)
    GET/v1/storage/buckets

    List all Buckets

    ParametersExpand Collapse
    query BucketListParams
    ProjectID param.Field[string]

    Project ID of resources to request

    Cursor param.Field[string]Optional

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

    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 Bucket 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_bytes, object_count

    Status param.Field[BucketListParamsStatus]Optional

    Filter by Bucket status

    const BucketListParamsStatusPending BucketListParamsStatus = "pending"
    const BucketListParamsStatusCreating BucketListParamsStatus = "creating"
    const BucketListParamsStatusUpdating BucketListParamsStatus = "updating"
    const BucketListParamsStatusReady BucketListParamsStatus = "ready"
    const BucketListParamsStatusDeleting BucketListParamsStatus = "deleting"
    const BucketListParamsStatusError BucketListParamsStatus = "error"
    Tags param.Field[[]string]Optional

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

    ReturnsExpand Collapse
    type Bucket struct{…}

    Bucket details.

    ID string

    Unique identifier for the Bucket.

    CreatedAt Time

    When the Bucket was created.

    formatdate-time
    Endpoint string

    S3 endpoint of the Bucket’s region. Point S3 clients at it, with an Object Storage Key of the same project and region.

    Name string

    Name of the Bucket, used to address it over S3.

    ObjectCount int64

    Number of objects in the Bucket. Updated periodically, so it can lag behind recent writes.

    ProjectID string

    Project ID the Bucket belongs to.

    Region RegionName

    Region the resource is in.

    One of the following:
    const RegionNameUsSva2 RegionName = "us-sva-2"
    const RegionNameUsWdc1 RegionName = "us-wdc-1"
    SigningRegion string

    Region S3 clients must sign their requests for (the SigV4 region). Configure it as the region of any S3 client or SDK used with the Bucket.

    SizeBytes int64

    Total size of the objects in the Bucket, in bytes. Updated periodically, so it can lag behind recent writes.

    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"
    const ResourceStatusSuspended ResourceStatus = "suspended"
    Tags []string

    Tags attached to the Bucket.

    UpdatedAt Time

    When the Bucket was updated.

    formatdate-time
    URL string

    Path-style URL of the Bucket.

    List Buckets

    package main
    
    import (
      "context"
      "fmt"
    
      "github.com/nirvana-labs/nirvana-go"
      "github.com/nirvana-labs/nirvana-go/option"
      "github.com/nirvana-labs/nirvana-go/storage"
    )
    
    func main() {
      client := nirvana.NewClient(
        option.WithAPIKey("My API Key"),
      )
      page, err := client.Storage.Buckets.List(context.TODO(), storage.BucketListParams{
        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",
          "endpoint": "https://s3.sva2.nirvanacloud.io",
          "name": "my-bucket",
          "object_count": 1024,
          "project_id": "123e4567-e89b-12d3-a456-426614174000",
          "region": "us-sva-2",
          "signing_region": "us-east-1",
          "size_bytes": 1073741824,
          "status": "ready",
          "tags": [
            "production",
            "ethereum"
          ],
          "updated_at": "2025-01-01T00:00:00Z",
          "url": "https://s3.sva2.nirvanacloud.io/my-bucket"
        }
      ],
      "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",
          "endpoint": "https://s3.sva2.nirvanacloud.io",
          "name": "my-bucket",
          "object_count": 1024,
          "project_id": "123e4567-e89b-12d3-a456-426614174000",
          "region": "us-sva-2",
          "signing_region": "us-east-1",
          "size_bytes": 1073741824,
          "status": "ready",
          "tags": [
            "production",
            "ethereum"
          ],
          "updated_at": "2025-01-01T00:00:00Z",
          "url": "https://s3.sva2.nirvanacloud.io/my-bucket"
        }
      ],
      "pagination": {
        "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
        "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
        "total_count": 125
      }
    }