Documentation
¶
Overview ¶
Package gcs is the Google Cloud Storage provider for objects service
Index ¶
- Constants
- Variables
- type Builder
- type Option
- type Provider
- func (p *Provider) Bucket() string
- func (p *Provider) Close() error
- func (p *Provider) Delete(ctx context.Context, file *storagetypes.File, ...) error
- func (p *Provider) Download(ctx context.Context, file *storagetypes.File, ...) (*storagetypes.DownloadedFileMetadata, error)
- func (p *Provider) Exists(ctx context.Context, file *storagetypes.File) (bool, error)
- func (p *Provider) GetPresignedURL(_ context.Context, file *storagetypes.File, ...) (string, error)
- func (p *Provider) GetScheme() *string
- func (p *Provider) ListBuckets() ([]string, error)
- func (p *Provider) ListObjects(ctx context.Context, prefix string, limit int) ([]string, error)
- func (p *Provider) ProviderType() storagetypes.ProviderType
- func (p *Provider) Upload(ctx context.Context, reader io.Reader, opts *storagetypes.UploadFileOptions) (*storagetypes.UploadedFileMetadata, error)
Constants ¶
const ( // DefaultPresignedURLExpiry defines the default expiry time for signed URLs DefaultPresignedURLExpiry = 15 * time.Minute )
Variables ¶
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 (*Builder) Build ¶
func (b *Builder) Build(ctx context.Context, credentials storage.ProviderCredentials, config *storage.ProviderOptions) (storagetypes.Provider, error)
Build implements eddy.Builder
func (*Builder) ProviderType ¶
ProviderType implements eddy.Builder
func (*Builder) WithOptions ¶
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) Delete ¶
func (p *Provider) Delete(ctx context.Context, file *storagetypes.File, _ *storagetypes.DeleteFileOptions) error
Delete implements storagetypes.Provider
func (*Provider) Download ¶
func (p *Provider) Download(ctx context.Context, file *storagetypes.File, _ *storagetypes.DownloadFileOptions) (*storagetypes.DownloadedFileMetadata, error)
Download 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) ListBuckets ¶
ListBuckets implements storagetypes.Provider
func (*Provider) ListObjects ¶
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 ¶
func (p *Provider) Upload(ctx context.Context, reader io.Reader, opts *storagetypes.UploadFileOptions) (*storagetypes.UploadedFileMetadata, error)
Upload implements storagetypes.Provider