s3

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendConfig

type BackendConfig struct {
	BackendName string `yaml:"name"`
	Endpoint    string `yaml:"endpoint"`
	Bucket      string `yaml:"bucketname"`
	Region      string `yaml:"region"`
	AccessKey   string `yaml:"accesskey"`
	SecretKey   string `yaml:"secretkey"`
}

BackendConfig is the data structure containing all information required to connect to an S3 backend

func (*BackendConfig) Name

func (conf *BackendConfig) Name() string

Name returns the name configured for this S3 Backend

func (*BackendConfig) Validate

func (conf *BackendConfig) Validate() error

Validate validates the S3 Storage Backend and returns the first error that occured during validation.

type Client

type Client struct {
	Conn   *minio.Client
	Config BackendConfig
}

Client is an S3 Backend Client Object

func New

func New(ctx context.Context, conf BackendConfig) *Client

New creates a new S3 Backend client

func (*Client) BackendName

func (c *Client) BackendName() string

BackendName returns 'S3'

func (*Client) Bucket

func (c *Client) Bucket() string

Bucket returns the S3 Bucket Name

func (*Client) BucketExists

func (c *Client) BucketExists(ctx context.Context, name string) (bool, error)

BucketExists returns if a particular bucket exists and is reachable by the S3 client

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

Connect connects the S3 Backend client to the backend service and authenticates

func (*Client) Disconnect

func (c *Client) Disconnect(ctx context.Context) error

Disconnect terminates the connection of the S3 client with the backend server

func (*Client) Name

func (c *Client) Name() string

Name returns the S3 Client Name

func (*Client) ObjectExists

func (c *Client) ObjectExists(ctx context.Context, name string) (bool, error)

ObjectExists returns if a particular object exists and is reachable by the S3 client

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, name string, file io.Reader, filesize int64) error

UploadFile uploads a file to the S3 Backend, with a name of name.

Jump to

Keyboard shortcuts

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