gcs

package
v2.6.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gcs is the Google Cloud Storage provider for objects service

Index

Constants

View Source
const (
	// DefaultPresignedURLExpiry defines the default expiry time for signed URLs
	DefaultPresignedURLExpiry = 15 * time.Minute
)

Variables

View Source
var (
	// ErrBucketRequired is returned when no GCS bucket is specified
	ErrBucketRequired = errors.New("gcs: bucket is required")
	// ErrProjectIDRequired is returned when listing buckets without a project id
	ErrProjectIDRequired = errors.New("gcs: project id is required")
	// ErrClientCreate is returned when the GCS client could not be created
	ErrClientCreate = errors.New("gcs: client creation failed")
)

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder creates GCS providers for the client pool

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new Builder

func (*Builder) Build

Build implements eddy.Builder

func (*Builder) ProviderType

func (b *Builder) ProviderType() string

ProviderType implements eddy.Builder

func (*Builder) WithOptions

func (b *Builder) WithOptions(opts ...Option) *Builder

WithOptions sets provider options for the builder

type Option

type Option func(*providerConfig)

Option configures the GCS provider during construction

func WithClientOptions

func WithClientOptions(opts ...option.ClientOption) Option

WithClientOptions supplies Google API client options such as a credential token source; omitted, the client uses application default credentials

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements storagetypes.Provider against Google Cloud Storage

func NewProvider

func NewProvider(ctx context.Context, options *storage.ProviderOptions, opts ...Option) (*Provider, error)

NewProvider creates a GCS provider for the bucket in options, authenticating with application default credentials unless client options say otherwise

func (*Provider) Bucket

func (p *Provider) Bucket() string

Bucket returns the bucket the provider reads and writes by default

func (*Provider) Close

func (p *Provider) Close() error

Close implements storagetypes.Provider

func (*Provider) Delete

Delete implements storagetypes.Provider

func (*Provider) Download

Download implements storagetypes.Provider

func (*Provider) Exists

func (p *Provider) Exists(ctx context.Context, file *storagetypes.File) (bool, error)

Exists implements storagetypes.Provider

func (*Provider) GetPresignedURL

func (p *Provider) GetPresignedURL(_ context.Context, file *storagetypes.File, opts *storagetypes.PresignedURLOptions) (string, error)

GetPresignedURL implements storagetypes.Provider

func (*Provider) GetScheme

func (p *Provider) GetScheme() *string

GetScheme implements storagetypes.Provider

func (*Provider) ListBuckets

func (p *Provider) ListBuckets() ([]string, error)

ListBuckets implements storagetypes.Provider

func (*Provider) ListObjects

func (p *Provider) ListObjects(ctx context.Context, prefix string, limit int) ([]string, error)

ListObjects returns the object keys under prefix, at most limit when limit is positive

func (*Provider) ProviderType

func (p *Provider) ProviderType() storagetypes.ProviderType

ProviderType implements storagetypes.Provider

func (*Provider) Upload

Upload implements storagetypes.Provider

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL