s3

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 23 Imported by: 1

Documentation

Overview

Package s3 provides a storage driver to upload module files to amazon s3 storage bucket.

Configuration

Environment variables:

AWS_REGION				// region for this storage, e.g 'us-west-2'
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN		// [optional]
AWS_FORCE_PATH_STYLE	// [optional]
ATHENS_S3_BUCKET_NAME

For information how to get your keyId and access key turn to official aws docs: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/setting-up.html

Example:

Bash:
	export AWS_REGION="us-west-2"
Fish:
	set -x AWS_REGION us-west-2

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage implements (./pkg/storage).Backend and also provides a function to fetch the location of a module. Storage uses amazon aws go SDK which expects these env variables. - AWS_REGION - region for this storage, e.g 'us-west-2' - AWS_ACCESS_KEY_ID - [optional] - AWS_SECRET_ACCESS_KEY - [optional] - AWS_SESSION_TOKEN - [optional] - AWS_FORCE_PATH_STYLE - [optional] For information how to get your keyId and access key turn to official aws docs: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/setting-up.html.

func New

func New(s3Conf *config.S3Config, timeout time.Duration, options ...func(*aws.Config)) (*Storage, error)

New creates a new AWS S3 CDN saver.

func (*Storage) Catalog added in v0.3.0

func (s *Storage) Catalog(ctx context.Context, token string, pageSize int) ([]paths.AllPathParams, string, error)

Catalog implements the (./pkg/storage).Cataloger interface. It returns a list of modules and versions contained in the storage.

func (*Storage) Delete added in v0.2.0

func (s *Storage) Delete(ctx context.Context, module, version string) error

Delete implements the (./pkg/storage).Deleter interface and removes a version of a module from storage. Returning ErrNotFound if the version does not exist.

func (*Storage) Exists added in v0.2.0

func (s *Storage) Exists(ctx context.Context, module, version string) (bool, error)

Exists implements the (./pkg/storage).Checker interface returning true if the module at version exists in storage.

func (*Storage) GoMod added in v0.2.0

func (s *Storage) GoMod(ctx context.Context, module, version string) ([]byte, error)

GoMod implements the (./pkg/storage).Getter interface.

func (*Storage) Info added in v0.2.0

func (s *Storage) Info(ctx context.Context, module, version string) ([]byte, error)

Info implements the (./pkg/storage).Getter interface.

func (*Storage) List added in v0.2.0

func (s *Storage) List(ctx context.Context, module string) ([]string, error)

List implements the (./pkg/storage).Lister interface. It returns a list of versions, if any, for a given module.

func (*Storage) Save

func (s *Storage) Save(ctx context.Context, module, version string, mod []byte, zip io.Reader, info []byte) error

Save implements the (github.com/gomods/athens/pkg/storage).Saver interface.

func (*Storage) Zip added in v0.2.0

func (s *Storage) Zip(ctx context.Context, module, version string) (storage.SizeReadCloser, error)

Zip implements the (./pkg/storage).Getter interface.

Jump to

Keyboard shortcuts

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