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] 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 ¶
- type Storage
- func (s *Storage) Catalog(ctx context.Context, token string, pageSize int) ([]paths.AllPathParams, string, error)
- func (s *Storage) Delete(ctx context.Context, module, version string) error
- func (s *Storage) Exists(ctx context.Context, module, version string) (bool, error)
- func (s *Storage) GoMod(ctx context.Context, module, version string) ([]byte, error)
- func (s *Storage) Info(ctx context.Context, module, version string) ([]byte, error)
- func (s *Storage) List(ctx context.Context, module string) ([]string, error)
- func (s *Storage) Save(ctx context.Context, module, version string, mod []byte, zip io.Reader, ...) error
- func (s *Storage) Zip(ctx context.Context, module, version string) (io.ReadCloser, error)
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] 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
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
Exists implements the (./pkg/storage).Checker interface returning true if the module at version exists in storage
func (*Storage) List ¶ added in v0.2.0
List implements the (./pkg/storage).Lister interface It returns a list of versions, if any, for a given module