s3

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRetries = 3

DefaultRetries is the number of retries for a S3 upload until an error is raised

Variables

This section is empty.

Functions

func ParseURL

func ParseURL(u string) (bucket, key string, err error)

Types

type Client

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

Client downloads and uploads objects from/to S3.

func NewClient

func NewClient(ctx context.Context, logger Logger) (*Client, error)

NewClient returns a new S3 Client, configuration is read from env variables or configuration files, see https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html

func (*Client) Download

func (c *Client) Download(ctx context.Context, bucket, key, filepath string) error

func (*Client) Upload

func (c *Client) Upload(filepath, bucket, key string) (string, error)

Upload uploads a file to an s3 bucket, on success it returns the s3:// URL of the object.

type Logger

type Logger interface {
	Debugf(format string, v ...any)
}

Logger defines the interface for an S3 logger

Jump to

Keyboard shortcuts

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