s3api

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRegion          = errors.New("s3api.Config: no region env var name defined")
	ErrNoAccessKeyID     = errors.New("s3api.Config: no access key id env var name defined")
	ErrNoSecretAccessKey = errors.New("s3api.Config: no secret access key env var name defined")
	ErrNoBucketName      = errors.New("s3api.Config: no bucket name env var name defined")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	BucketName string `json:"bucketName"`
	PathStyle  bool   `json:"pathStyle"`
}

func (Config) Valid

func (c Config) Valid() error

type Factory

type Factory struct {
	Client S3API
}

Factory builds an S3-backed store. Tests can inject a Mock via Client. Factory can optionally carry a preconstructed S3 client (e.g., a mock in tests).

func (Factory) Build

func (f Factory) Build(ctx context.Context, data json.RawMessage) (store.Interface, error)

func (Factory) Valid

func (Factory) Valid(data json.RawMessage) error

type S3API

type S3API interface {
	PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
	GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
	DeleteObject(ctx context.Context, params *s3.DeleteObjectInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
	HeadObject(ctx context.Context, params *s3.HeadObjectInput, optFns ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
}

S3API is the subset of the AWS S3 client used by this store. It enables mocking in tests.

type Store

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

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) ([]byte, error)

func (Store) IsPersistent

func (Store) IsPersistent() bool

func (*Store) Set

func (s *Store) Set(ctx context.Context, key string, value []byte, expiry time.Duration) error

Jump to

Keyboard shortcuts

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