s3

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package s3 implements the storage contract with AWS S3 (or a compatible API such as LocalStack/MinIO).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Bucket       string `mapstructure:"bucket"`
	AwsRegion    string `mapstructure:"aws_region"`
	Key          string `mapstructure:"key"`
	Secret       string `mapstructure:"secret"`
	Endpoint     string `mapstructure:"endpoint"`
	UsePathStyle bool   `mapstructure:"use_path_style"`
	BaseURL      string `mapstructure:"base_url"`
}

Config holds S3 connection settings. Services embed it in their config structs; the mapstructure tags live here so every service shares the same config schema.

type S3

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

S3 is a per-region storage backend backed by AWS S3 (or a compatible API).

func New

func New(sc Config) (*S3, error)

New creates an S3 backend. Uses static credentials if Key/Secret are set; otherwise falls back to the default AWS credential chain.

func (*S3) Delete

func (s *S3) Delete(ctx context.Context, path string) error

Delete removes an object from the bucket.

func (*S3) DownloadURL

func (s *S3) DownloadURL(ctx context.Context, path string, expiry time.Duration) (string, error)

DownloadURL returns a presigned GET URL for direct client download from S3.

func (*S3) Move

func (s *S3) Move(ctx context.Context, src, dst string) error

Move relocates an object within the bucket via server-side copy + delete.

func (*S3) UploadURL

func (s *S3) UploadURL(ctx context.Context, path string, expiry time.Duration) (string, error)

UploadURL returns a presigned PUT URL for direct client upload to S3.

Jump to

Keyboard shortcuts

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