s3

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")

Functions

func AwsBucketToMap

func AwsBucketToMap(m map[string]string, b AwsS3Bucket) map[string]string

Types

type AwsS3Bucket

type AwsS3Bucket struct {
	Name   string `errorTxt:"bucket name" mandatory:"yes"`
	Prefix string `errorTxt:"bucket prefix"`
	Region string `errorTxt:"bucket region" mandatory:"yes"`
	Dsn    string
}

func NewAwsBucket

func NewAwsBucket(c *shared.ConnectionDetails) *AwsS3Bucket

func ParseDSN

func ParseDSN(bucketPrefix string, region string) (retval AwsS3Bucket, err error)

ParseDSN expects bucketPrefix to be of the form [s3://]<bucket>/<prefix> It returns an AwsS3Bucket populated with the components of bucketPrefix and the supplied region. If there is a parsing error it returns an error. The region may be empty.

func (AwsS3Bucket) GetMap

func (d AwsS3Bucket) GetMap(m map[string]string) map[string]string

func (AwsS3Bucket) GetScheme

func (d AwsS3Bucket) GetScheme() (string, error)

func (AwsS3Bucket) Parse

func (d AwsS3Bucket) Parse() error

type BasicClient

type BasicClient interface {
	Lister
	Getter
	Putter
	BufferPutter
	Deleter
}

func NewBasicClient

func NewBasicClient(bucket, region, prefix string) BasicClient

type BufferPutter

type BufferPutter interface {
	BufferPut(key string, buf io.ReadSeeker) (err error)
}

BufferPutter can be used to put a file to S3 since File implements Read and Seek.

type Client

type Client interface {
	BasicClient
	Mover
}

func NewClient

func NewClient(bucket, region, prefix string) Client

func NewClientFromBasic

func NewClientFromBasic(basicClient BasicClient) Client

type Deleter

type Deleter interface {
	Delete(key string) error
}

type Getter

type Getter interface {
	// Get returns ErrKeyNotFound if the given key doesn't exist.
	Get(key string) (data []byte, err error)
}

type Lister

type Lister interface {
	List(key string) (keys []string, err error)
}

type Mover

type Mover interface {
	// Move returns ErrKeyNotFound if the src key doesn't exist.
	Move(src, dst string) error
}

type Putter

type Putter interface {
	Put(key string, data []byte) (err error)
}

Jump to

Keyboard shortcuts

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