storage

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	S3Type    storageType = "s3"
	MinioType storageType = "minio"
	FakeType  storageType = "fake"
)

Variables

View Source
var (
	ErrInvalidStorageType = errors.New("Invalid storage type")
)

Functions

func NewFake

func NewFake() *fake

Types

type Config

type Config struct {
	Type                storageType `envconfig:"type" default:"s3"`
	AwsKey              string      `envconfig:"aws_key"`
	AwsSecret           string      `envconfig:"aws_secret"`
	AwsRegion           string      `envconfig:"aws_region"`
	AwsBucket           string      `envconfig:"aws_bucket"`
	AwsEndpoint         string      `envconfig:"aws_endpoint" default:""`
	AwsDisableSSL       bool        `envconfig:"aws_disable_ssl" default:"false"`
	AwsS3ForcePathStyle bool        `envconfig:"aws_s3_force_path_style" default:"false"`
}

type Minio

type Minio struct {
	Storage
}

func (*Minio) PodEnvVars

func (m *Minio) PodEnvVars() map[string]string

func (*Minio) Type

func (m *Minio) Type() string

type Object added in v0.24.0

type Object struct {
	Name         string
	LastModified time.Time
}

type S3

type S3 struct {
	Client           S3Client
	Key              string
	Secret           string
	Region           string
	Bucket           string
	Endpoint         string
	DisableSSL       bool
	S3ForcePathStyle bool
}

func (*S3) AccessData

func (s *S3) AccessData() map[string][]byte

func (*S3) Delete added in v0.24.0

func (s *S3) Delete(path string) error

func (*S3) K8sSecretName

func (s *S3) K8sSecretName() string

func (*S3) List added in v0.24.0

func (s *S3) List(path string) ([]*Object, error)

func (*S3) PodEnvVars

func (s *S3) PodEnvVars() map[string]string

func (*S3) Type

func (s *S3) Type() string

func (*S3) UploadFile

func (s *S3) UploadFile(path string, file io.ReadSeeker) error

type S3Client

type S3Client interface {
	PutObject(*s3.PutObjectInput) (*s3.PutObjectOutput, error)
	ListObjects(*s3.ListObjectsInput) (*s3.ListObjectsOutput, error)
	DeleteObject(*s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
}

type Storage

type Storage interface {
	K8sSecretName() string
	AccessData() map[string][]byte
	UploadFile(path string, file io.ReadSeeker) error
	Type() string
	PodEnvVars() map[string]string
	List(path string) ([]*Object, error)
	Delete(path string) error
}

func New

func New(conf *Config) (Storage, error)

Jump to

Keyboard shortcuts

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