s3

package
v0.0.0-...-23a9210 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHANGE_TIME_NSEC_METADATA_KEY = "change-time-nsec"
	CHANGE_TIME_SEC_METADATA_KEY  = "change-time-sec"
)

Variables

View Source
var ErrPageOutOfBounds = errors.New("Start is bigger then slice length")
View Source
var TimeNowFunc = time.Now

for testing override

Functions

This section is empty.

Types

type Bucket

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

func (*Bucket) AddMetadata

func (b *Bucket) AddMetadata(ctx context.Context, addMetadata Metadata) error

func (*Bucket) AddMetadataKey

func (b *Bucket) AddMetadataKey(ctx context.Context, key string, value string) error

func (*Bucket) Create

func (b *Bucket) Create(ctx context.Context, location string) error

Create creates the bucket in s3

func (*Bucket) Delete

func (b *Bucket) Delete(ctx context.Context) error

func (*Bucket) Empty

func (b *Bucket) Empty(ctx context.Context) error

func (*Bucket) Exists

func (b *Bucket) Exists(ctx context.Context) bool

func (*Bucket) GetMetadata

func (b *Bucket) GetMetadata(ctx context.Context) (Metadata, error)

type Client

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

func NewClient

func NewClient(cfg aws.Config, opts ...func(o *s3.Options)) *Client

func (*Client) DeleteObjects

func (c *Client) DeleteObjects(ctx context.Context, bucketName string, objs []*Object) error

func (*Client) ListBuckets

func (c *Client) ListBuckets(ctx context.Context, pageOpts *PageOpts) ([]*Bucket, error)

func (*Client) ListObjects

func (c *Client) ListObjects(ctx context.Context, bucketName string, opts *ListOpts) ([]*Object, error)

func (*Client) NewBucket

func (c *Client) NewBucket(name string) *Bucket

NewBucket creates an instance of the Bucket struct. This does not imply that the object exists in S3. To create the bucket inside S3, see the Create method.

func (*Client) NewObject

func (c *Client) NewObject(bucketName string, key string) *Object

NewObject creates an instance of the Object struct. This does not imply that the object exists in S3. To create the object inside S3, see the Create method.

type ErrAccessDenied

type ErrAccessDenied struct {
	Message string
}

func (*ErrAccessDenied) Error

func (e *ErrAccessDenied) Error() string

type ErrBucketNotFound

type ErrBucketNotFound struct {
	Bucket string
}

func (*ErrBucketNotFound) Error

func (e *ErrBucketNotFound) Error() string

type ErrCheckFunc

type ErrCheckFunc func(err error) error

ErrCheckFunc provides functionality to check if error matches a certain condition If error matches, a custom error should be returned. If not, the provided error is returned

type ErrObjectNotFound

type ErrObjectNotFound struct {
	Key    string
	Bucket string
}

func (*ErrObjectNotFound) Error

func (e *ErrObjectNotFound) Error() string

type ListOpts

type ListOpts struct {
	Prefix string
}

type Metadata

type Metadata map[string]string

type Object

type Object struct {
	Bucket string
	Key    string
	// contains filtered or unexported fields
}

Object represents an S3 Object

func (*Object) Copy

func (o *Object) Copy(ctx context.Context, newKey string) (*Object, error)

func (*Object) Create

func (o *Object) Create(ctx context.Context, metadata Metadata) error

func (*Object) Delete

func (o *Object) Delete(ctx context.Context) error

func (*Object) Exists

func (o *Object) Exists(ctx context.Context) bool

func (*Object) GetAttrs

func (o *Object) GetAttrs(ctx context.Context) (*ObjectAttrs, error)

func (*Object) Move

func (o *Object) Move(ctx context.Context, newKey string) error

func (*Object) Read

func (o *Object) Read(ctx context.Context, readRange *ReadRange) (io.Reader, error)

func (*Object) SetAttrs

func (o *Object) SetAttrs(ctx context.Context, attrs *ObjectAttrs) error

func (*Object) Write

func (o *Object) Write(ctx context.Context, data io.Reader, metadata Metadata) error

type ObjectAttrs

type ObjectAttrs struct {
	Size       uint64
	ModifyTime *time.Time
	AccessTime *time.Time
	ChangeTime *time.Time
}

type PageOpts

type PageOpts struct {
	Start int
	// Size can be used to set the Size of pages
	// if 0, will be interpreted to return everything till the end
	Size int
}

type ReadRange

type ReadRange struct {
	Start int64
	End   int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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