upload

package
v0.0.0-...-c25ae0e Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PresignedKeyDuration TODO: Roll this into the Config struct
	PresignedKeyDuration = 15 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Bucket  string
	Region  string
	IsLocal bool
}

Config holds the configuration to interact with s3

type S3Client

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

S3Client is an MINT s3 client wrapper

func NewS3Client

func NewS3Client(config Config) S3Client

NewS3Client creates a new s3 service client

func NewS3ClientUsingClient

func NewS3ClientUsingClient(s3Client s3iface.S3API, config Config) S3Client

NewS3ClientUsingClient creates a new s3 wrapper using the specified s3 client This is most useful for testing where the s3 client needs to be mocked out.

func (S3Client) GetBucket

func (c S3Client) GetBucket() *string

GetBucket returns a *string containing the S3 Bucket as defined by the S3Configuration

func (S3Client) KeyFromURL

func (c S3Client) KeyFromURL(url *url.URL) (string, error)

KeyFromURL extracts an S3 key from a URL.

func (S3Client) NewGetPresignedURL

func (c S3Client) NewGetPresignedURL(key string) (*string, error)

NewGetPresignedURL returns a pre-signed URL used for GET-ing objects

func (S3Client) NewPutPresignedURL

func (c S3Client) NewPutPresignedURL(fileType string) (*models.PreSignedURL, error)

NewPutPresignedURL returns a pre-signed URL used for PUT-ing objects

func (S3Client) SetTagValueForKey

func (c S3Client) SetTagValueForKey(key string, tagName string, tagValue string) error

SetTagValueForKey sets the tag value and returns an error if any was encountered.

func (S3Client) TagValueForKey

func (c S3Client) TagValueForKey(key string, tagName string) (string, error)

TagValueForKey returns the tag value and if that tag was found for the specified key and tag name. If no value is found, returns an empty string.

func (S3Client) UploadFile

func (c S3Client) UploadFile(file io.Reader, key string) error

UploadFile uploads a io.Reader to the bucket configured in the S3Client

Jump to

Keyboard shortcuts

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