gcs

package
v2.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

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