Documentation
¶
Overview ¶
Package s3 is the AWS S3 storage provider for objects service
Index ¶
- Constants
- Variables
- func NewS3ProviderFromCredentials(credentials storage.ProviderCredentials, options *storage.ProviderOptions, ...) mo.Result[storagetypes.Provider]
- func NewS3ProviderResult(options *storage.ProviderOptions, opts ...Option) mo.Result[*Provider]
- type Builder
- type Option
- type Provider
- 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(ctx context.Context, file *storagetypes.File, ...) (string, error)
- func (p *Provider) GetScheme() *string
- func (p *Provider) GetTags(ctx context.Context, key string) (map[string]string, error)
- func (p *Provider) HeadObj(ctx context.Context, key string) (*s3.HeadObjectOutput, error)
- func (p *Provider) ListBuckets() ([]string, error)
- func (p *Provider) ProviderType() storagetypes.ProviderType
- func (p *Provider) Tag(ctx context.Context, key string, tags map[string]string) error
- 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 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 ¶
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 ¶
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 (*Builder) Build ¶
func (b *Builder) Build(_ 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 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 ¶
WithAWSConfig provides a pre-configured AWS config
func WithDebugMode ¶
WithDebugMode enables AWS client debug logging
func WithUsePathStyle ¶
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) 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, opts *storagetypes.DownloadFileOptions) (*storagetypes.DownloadedFileMetadata, error)
Download implements storagetypes.Provider
func (*Provider) GetPresignedURL ¶
func (p *Provider) GetPresignedURL(ctx context.Context, file *storagetypes.File, opts *storagetypes.PresignedURLOptions) (string, error)
GetPresignedURL implements storagetypes.Provider
func (*Provider) ListBuckets ¶
ListBuckets lists the buckets in the current account.
func (*Provider) ProviderType ¶
func (p *Provider) ProviderType() storagetypes.ProviderType
func (*Provider) Upload ¶
func (p *Provider) Upload(ctx context.Context, reader io.Reader, opts *storagetypes.UploadFileOptions) (*storagetypes.UploadedFileMetadata, error)
Upload implements storagetypes.Provider