minio

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	TargetBucket string
	Endpoint     string
	AccessKey    string
	SecretKey    string
	UseSSL       bool
	PutOptions   minio.PutObjectOptions
	GetOptions   minio.GetObjectOptions
	Client       *minio.Client
}

Config is a structure holding all relevant information regarding the minio storage used by Iterum

func NewMinioConfig

func NewMinioConfig(endpoint, accessKey, secretAccessKey, targetBucket string, useSSL bool) Config

NewMinioConfig initiates a new minio configuration with all its necessary information

func NewMinioConfigFromEnv

func NewMinioConfigFromEnv() (Config, error)

NewMinioConfigFromEnv uses environment variables to initialize a new MinioConfig configured for a step's output

func (*Config) Connect

func (config *Config) Connect() error

Connect tries to initialize the Client element of a minio config

func (Config) EnsureBucket

func (config Config) EnsureBucket(bucket string, retries int) (err error)

EnsureBucket makes sure that the target bucket exists and rights are owned to it. It will retry for 'retries' times and return an error if it fails in the end

func (Config) GetFile

func (config Config) GetFile(descriptor desc.RemoteFileDesc, targetFolder string) (localFile desc.LocalFileDesc, err error)

GetFile retrieves the file associated with the RemoteFileDesc onto local disk It does not ensure any existing connection neither the bucket. This is the responsibility of the user targetFolder is the folder in which to store the data

func (Config) IsConnected

func (config Config) IsConnected() bool

IsConnected returns whether the client of a MinioConfig is initialized

func (Config) PutFile

func (config Config) PutFile(localFile desc.LocalFileDesc) (remoteFile desc.RemoteFileDesc, err error)

PutFile send the file associated with localPath into the minioStorage It ensures that the target bucket exists and otherwise creates it filePath is the target remote path

func (Config) PutFileFromReader

func (config Config) PutFileFromReader(fileHandle io.ReadCloser, contentSize int64, localFile desc.LocalFileDesc) (remoteFile desc.RemoteFileDesc, err error)

PutFileFromReader send the data associated with a fileHandler into the minioStorage It assumes that the target bucket exists and access is granted to it ia the config remotePath is the target remote path to store to. fileName is used in the RemoteFileDesc

Jump to

Keyboard shortcuts

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