Help us shape the future of Go! Take the 2026 Go Developer Survey

s3

package
v1.11.21 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package s3 is the AWS S3 storage provider for objects service

Index

Constants

View Source
const (
	// DefaultPresignedURLExpiry defines the default expiry time for presigned URLs
	DefaultPresignedURLExpiry = 15 * time.Minute
	// DefaultPartSize defines the default part size for multipart uploads (64MB)
	DefaultPartSize = 64 * 1024 * 1024
	// DefaultConcurrency defines the default concurrency for uploads
	DefaultConcurrency = 5
)

Variables

View Source
var (
	// ErrS3BucketRequired is returned when S3 bucket is not specified
	ErrS3BucketRequired = errors.New("S3 bucket is required")
	// ErrS3CredentialsRequired is returned when required S3 credentials are missing
	ErrS3CredentialsRequired = errors.New("missing required S3 credentials: bucket, region")
	// ErrS3SecretCredentialRequired is returned when S3 secret access key is missing
	ErrS3SecretCredentialRequired = errors.New("missing required S3 secret access key, id")
	// ErrS3LoadCredentials is returned when AWS credentials fail to load
	ErrS3LoadCredentials = errors.New("failed to load AWS credentials")
)

Functions

func NewS3ProviderFromCredentials

func NewS3ProviderFromCredentials(credentials storage.ProviderCredentials, options *storage.ProviderOptions, opts ...Option) mo.Result[storagetypes.Provider]

NewS3ProviderFromCredentials creates an S3 provider from provider credentials and optional configuration

func NewS3ProviderResult

func NewS3ProviderResult(options *storage.ProviderOptions, opts ...Option) mo.Result[*Provider]

NewS3ProviderResult creates a new S3 provider instance with mo.Result error handling

Types

type Builder

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

Builder creates S3 providers for the client pool

func NewS3Builder

func NewS3Builder() *Builder

NewS3Builder creates a new S3Builder

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 allows configuring provider-specific options

type Option

type Option func(*providerConfig)

Option configures the S3 provider during construction

func WithACL

func WithACL(acl types.ObjectCannedACL) Option

WithACL sets the canned ACL applied during uploads

func WithAWSConfig

func WithAWSConfig(c aws.Config) Option

WithAWSConfig provides a pre-configured AWS config

func WithDebugMode

func WithDebugMode(enabled bool) Option

WithDebugMode enables AWS client debug logging

func WithUsePathStyle

func WithUsePathStyle(use bool) Option

WithUsePathStyle configures the S3 client to use path-style addressing

type Provider

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

Provider implements the storagetypes.Provider interface for Amazon S3

func NewS3Provider

func NewS3Provider(options *storage.ProviderOptions, opts ...Option) (*Provider, error)

NewS3Provider creates a new S3 provider instance

func (*Provider) Close

func (p *Provider) Close() error

Close cleans up resources

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 checks if an object exists in S3

func (*Provider) GetPresignedURL

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

GetPresignedURL implements storagetypes.Provider

func (*Provider) GetScheme

func (p *Provider) GetScheme() *string

GetScheme returns the URI scheme for S3

func (*Provider) GetTags

func (p *Provider) GetTags(ctx context.Context, key string) (map[string]string, error)

GetTags returns the tags for an object in a bucket

func (*Provider) HeadObj

func (p *Provider) HeadObj(ctx context.Context, key string) (*s3.HeadObjectOutput, error)

HeadObj checks if an object exists in S3 and returns its metadata

func (*Provider) ListBuckets

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

ListBuckets lists the buckets in the current account.

func (*Provider) ProviderType

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

func (*Provider) Tag

func (p *Provider) Tag(ctx context.Context, key string, tags map[string]string) error

Tag updates an existing object in a bucket with specific tags

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