s3

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateS3KeyName

func GenerateS3KeyName(keypfx string, repo string, commitsha string) string

GenerateS3KeyName returns the S3 key name for a given repo & commit SHA

Types

type ImageDescription

type ImageDescription struct {
	GitHubRepo string
	CommitSHA  string
}

ImageDescription contains all info needed to find a specific image within the object store

type ObjectStorageManager

type ObjectStorageManager interface {
	Push(ImageDescription, io.Reader, interface{}) error
	Pull(ImageDescription, io.WriterAt, interface{}) error
	Size(ImageDescription, interface{}) (int64, error)
	Exists(desc ImageDescription, opts interface{}) (bool, error)
	WriteFile(string, ImageDescription, string, io.Reader, interface{}) (string, error)
}

ObjectStorageManger describes an object capable of pushing/pulling images from an object store

type S3Options

type S3Options struct {
	Region            string
	Bucket            string
	KeyPrefix         string
	PresignTTLMinutes uint
}

S3Options contains the information needed to push/pull an image from S3

type S3StorageManager

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

S3StorageManager is an object capable of pushing/pulling from S3

func NewS3StorageManager

func NewS3StorageManager(config config.AWSConfig, mc metrics.MetricsCollector, logger *log.Logger) *S3StorageManager

NewS3StorageManager returns a new S3 manager

func (*S3StorageManager) Exists

func (sm *S3StorageManager) Exists(desc ImageDescription, opts interface{}) (bool, error)

Exists checks whether the image tarball exists in S3

func (*S3StorageManager) Pull

func (sm *S3StorageManager) Pull(desc ImageDescription, out io.WriterAt, opts interface{}) error

Pull downloads an image from S3 and writes it to out

func (*S3StorageManager) Push

func (sm *S3StorageManager) Push(desc ImageDescription, in io.Reader, opts interface{}) error

Push reads an image from in and pushes it to S3

func (*S3StorageManager) Size

func (sm *S3StorageManager) Size(desc ImageDescription, opts interface{}) (int64, error)

Size returns the size in bytes of the object in S3 if found or error

func (*S3StorageManager) WriteFile

func (sm *S3StorageManager) WriteFile(name string, desc ImageDescription, contentType string, in io.Reader, opts interface{}) (string, error)

WriteFile writes a named file to the configured bucket and returns the S3 location URL

Jump to

Keyboard shortcuts

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