s3

package
v0.0.0-...-64e8fac Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	Params
	S3 *awss3.S3
}

func (*Driver) CopyObject

func (d *Driver) CopyObject(ctx context.Context, srcPath, destPath string) error

func (*Driver) DeleteObjects

func (d *Driver) DeleteObjects(ctx context.Context, prefix string) error

func (*Driver) GetBucket

func (d *Driver) GetBucket(ctx context.Context) string

func (*Driver) GetObject

func (d *Driver) GetObject(ctx context.Context, path string) ([]byte, error)

func (*Driver) GetSignedObjectURL

func (d *Driver) GetSignedObjectURL(path string, expire time.Duration) (string, error)

func (*Driver) ListObjects

func (d *Driver) ListObjects(ctx context.Context, prefix string, maxKeys int64) ([]*awss3.Object, error)

func (*Driver) PutObject

func (d *Driver) PutObject(ctx context.Context, path string, content io.ReadSeeker, metadata map[string]string) error

type Interface

type Interface interface {
	PutObject(ctx context.Context, path string, content io.ReadSeeker, metadata map[string]string) error
	GetObject(ctx context.Context, path string) ([]byte, error)
	CopyObject(ctx context.Context, srcPath, destPath string) error
	// ListObjects NOTE: The returned results of the func are sorted alphabetically by key, not by upload time
	// Ref: https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html
	ListObjects(ctx context.Context, prefix string, maxKeys int64) ([]*awss3.Object, error)
	DeleteObjects(ctx context.Context, prefix string) error
	GetSignedObjectURL(path string, expire time.Duration) (string, error)
	GetBucket(ctx context.Context) string
}

func NewDriver

func NewDriver(params Params) (Interface, error)

type Params

type Params struct {
	AccessKey        string
	SecretKey        string
	Region           string
	Endpoint         string
	Bucket           string
	DisableSSL       bool
	SkipVerify       bool
	S3ForcePathStyle bool
	ContentType      string
	LogLevel         *aws.LogLevelType
}

Jump to

Keyboard shortcuts

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