s3

package
v0.0.0-...-b206e69 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	ErrFileStorageFileNotFound = errors.New("File not found")
)

Errors specific to interface

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) CreateAccessToken

func (s *SimpleStorageService) CreateAccessToken() (string, error)

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) (*model.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) (*model.Link, error)

PutRequest duration is limited to 7 days (AWS limitation)

func (*SimpleStorageService) SyncArtifact

func (s *SimpleStorageService) SyncArtifact(ctx context.Context, objectId string, uri string) (int64, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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