s3

package
v0.0.0-...-0557d4e Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2018 License: Apache-2.0, Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExpireMaxLimit                 = 7 * 24 * time.Hour
	ExpireMinLimit                 = 1 * time.Minute
	ErrCodeBucketAlreadyOwnedByYou = "BucketAlreadyOwnedByYou"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleStorageService

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

SimpleStorageService - AWS S3 client. Data layer for file storage. Implements model.FileStorage interface

func NewSimpleStorageServiceDefaults

func NewSimpleStorageServiceDefaults(bucket, region string) (*SimpleStorageService, error)

NewSimpleStorageServiceDefaults create new S3 client model. Use default authentication provides which looks at env variables, Aws profile file and ec2 iam role

func NewSimpleStorageServiceStatic

func NewSimpleStorageServiceStatic(bucket, key, secret, region, token, uri string, tag_artifact bool) (*SimpleStorageService, error)

NewSimpleStorageServiceStatic create new S3 client model. AWS authentication keys are automatically reloaded from env variables.

func (*SimpleStorageService) Delete

func (s *SimpleStorageService) Delete(ctx context.Context, objectID string) error

Delete removes delected file from storage. Noop if ID does not exist.

func (*SimpleStorageService) Exists

func (s *SimpleStorageService) Exists(ctx context.Context, objectID string) (bool, error)

Exists check if selected object exists in the storage

func (*SimpleStorageService) GetRequest

func (s *SimpleStorageService) GetRequest(ctx context.Context, objectID string,
	duration time.Duration, responseContentType string) (*images.Link, error)

GetRequest duration is limited to 7 days (AWS limitation)

func (*SimpleStorageService) LastModified

func (s *SimpleStorageService) LastModified(ctx context.Context, objectID string) (time.Time, error)

LastModified returns last file modification time. If object not found return ErrFileStorageFileNotFound

func (*SimpleStorageService) PutRequest

func (s *SimpleStorageService) PutRequest(ctx context.Context, objectID string,
	duration time.Duration) (*images.Link, error)

PutRequest duration is limited to 7 days (AWS limitation)

func (*SimpleStorageService) UploadArtifact

func (s *SimpleStorageService) UploadArtifact(ctx context.Context,
	objectID string, size int64, artifact io.Reader, contentType string) error

UploadArtifact uploads given artifact into the file server (AWS S3 or minio) using objectID as a key

Jump to

Keyboard shortcuts

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