awss3

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 18 Imported by: 5 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// StoreType = "s3" this is used to define the storage type to create
	// from cloudstorage.NewStore(config)
	StoreType = "s3"

	// ConfKeyAccessKey config key name of the aws access_key(id) for auth
	ConfKeyAccessKey = "access_key"
	// ConfKeyAccessSecret config key name of the aws acccess secret
	ConfKeyAccessSecret = "access_secret"
	// ConfKeyARN config key name of the aws ARN name of user
	ConfKeyARN = "arn"
	// ConfKeyDisableSSL config key name of disabling ssl flag
	ConfKeyDisableSSL = "disable_ssl"
	// ConfKeyDebugLog config key to enable LogDebug log level
	ConfKeyDebugLog = "debug_log"

	// AuthAccessKey is for using aws access key/secret pairs
	AuthAccessKey cloudstorage.AuthMethod = "aws_access_key"
)

Variables

View Source
var (
	// Retries number of times to retry upon failures.
	Retries = 3
	// PageSize is default page size
	PageSize = 2000

	// ErrNoS3Session no valid session
	ErrNoS3Session = fmt.Errorf("no valid aws session was created")
	// ErrNoAccessKey error for no access_key
	ErrNoAccessKey = fmt.Errorf("no settings.access_key")
	// ErrNoAccessSecret error for no settings.access_secret
	ErrNoAccessSecret = fmt.Errorf("no settings.access_secret")
	// ErrNoAuth error for no findable auth
	ErrNoAuth = fmt.Errorf("No auth provided")
)

Functions

func NewClient

func NewClient(conf *cloudstorage.Config) (*s3.S3, *session.Session, error)

NewClient create new AWS s3 Client. Uses cloudstorage.Config to read necessary config settings such as bucket, region, auth.

Types

type FS

type FS struct {
	PageSize int
	ID       string
	// contains filtered or unexported fields
}

FS Simple wrapper for accessing s3 files, it doesn't currently implement a Reader/Writer interface so not useful for stream reading of large files yet.

func NewStore

func NewStore(c *s3.S3, sess *session.Session, conf *cloudstorage.Config) (*FS, error)

NewStore Create AWS S3 storage client of type cloudstorage.Store

func (*FS) Client

func (f *FS) Client() interface{}

Client gets access to the underlying s3 cloud storage client.

func (*FS) Delete

func (f *FS) Delete(ctx context.Context, obj string) error

Delete requested object path string.

func (*FS) Folders

func (f *FS) Folders(ctx context.Context, q cloudstorage.Query) ([]string, error)

Folders get folders list.

func (*FS) Get

func (f *FS) Get(ctx context.Context, objectpath string) (cloudstorage.Object, error)

Get a single File Object

func (*FS) List

List objects from this store.

func (*FS) NewObject

func (f *FS) NewObject(objectname string) (cloudstorage.Object, error)

NewObject of Type s3.

func (*FS) NewReader

func (f *FS) NewReader(o string) (io.ReadCloser, error)

NewReader create file reader.

func (*FS) NewReaderWithContext

func (f *FS) NewReaderWithContext(ctx context.Context, objectname string) (io.ReadCloser, error)

NewReaderWithContext create new File reader with context.

func (*FS) NewWriter

func (f *FS) NewWriter(objectName string, metadata map[string]string) (io.WriteCloser, error)

NewWriter create Object Writer.

func (*FS) NewWriterWithContext

func (f *FS) NewWriterWithContext(ctx context.Context, objectName string, metadata map[string]string, opts ...cloudstorage.Opts) (io.WriteCloser, error)

NewWriterWithContext create writer with provided context and metadata.

func (*FS) Objects

Objects returns an iterator over the objects in the s3 bucket that match the Query q. If q is nil, no filtering is done.

func (*FS) String

func (f *FS) String() string

String function to provide s3://..../file path

func (*FS) Type

func (f *FS) Type() string

Type of store = "s3"

Jump to

Keyboard shortcuts

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