bucket

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bucket manages the AWS S3 bucket uploads.

Index

Constants

View Source
const (

	// AccessKeyID is the env variable to check for the AWS access key id
	AccessKeyID = "AWS_ACCESS_KEY_ID"

	// AccessSecretKey is the env variable to check for the AWS secret key
	AccessSecretKey = "AWS_SECRET_ACCESS_KEY"

	// DefaultRegion is the AWS region to use for S3 bucket upload
	DefaultRegion = "eu-west-2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

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

Bucket is used to pass AWS and S3 information around Archer.

TODO: this is used to interface with the S3 upload manager - I've used functional option setter so that we can add more fields here as needed when we have a clearer brief.

func New

func New(opts ...Option) (*Bucket, error)

New will construct a new bucket info struct.

func (*Bucket) Check

func (b *Bucket) Check() error

Check will check the bucket details and AWS authentication are provided.

func (*Bucket) Upload

func (b *Bucket) Upload(reader io.Reader, key string) (string, error)

Upload will upload the contents of a reader to an S3 bucket using the provided key. It returns the upload location and any error.

type Option

type Option func(bucket *Bucket) error

Option is a wrapper struct used to pass functional options to the Bucket constructor.

func SetName

func SetName(name string) Option

SetName is an option setter for the New bucket constructor that sets the name field of a Bucket struct.

func SetRegion

func SetRegion(region string) Option

SetRegion is an option setter for the New bucket constructor that sets the region field of a Bucket struct.

Jump to

Keyboard shortcuts

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