minioclient

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MinioError is class for minio errors.
	MinioError = errs.Class("nodeshift error")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	MakeBucket(ctx context.Context, bucket string) error
	RemoveBucket(ctx context.Context, bucket string) error
	ListBuckets(ctx context.Context) ([]string, error)

	Upload(ctx context.Context, bucket, objectName string, data []byte, metadata map[string]string) error
	Download(ctx context.Context, bucket, objectName string, buffer []byte) ([]byte, error)
	Delete(ctx context.Context, bucket, objectName string) error
	ListObjects(ctx context.Context, bucket, prefix string) ([]string, error)

	GetBucketVersioning(ctx context.Context, bucket string) (_ string, err error)
	EnableVersioning(ctx context.Context, bucketName string) error
	DisableVersioning(ctx context.Context, bucketName string) error
}

Client is the common interface for different implementations.

func NewMinio

func NewMinio(conf Config) (Client, error)

NewMinio creates new Client.

type Config

type Config struct {
	S3Gateway     string
	Satellite     string
	AccessKey     string
	SecretKey     string
	APIKey        string
	EncryptionKey string
	NoSSL         bool
	ConfigDir     string
}

Config is the setup for a particular client.

type Minio

type Minio struct {
	API *minio.Client
}

Minio implements basic S3 Client with minio.

func (*Minio) Delete

func (client *Minio) Delete(ctx context.Context, bucket, objectName string) (err error)

Delete deletes object.

func (*Minio) DisableVersioning

func (client *Minio) DisableVersioning(ctx context.Context, bucket string) (err error)

DisableVersioning disable versioning for bucket.

func (*Minio) Download

func (client *Minio) Download(ctx context.Context, bucket, objectName string, buffer []byte) (_ []byte, err error)

Download downloads object data.

func (*Minio) EnableVersioning

func (client *Minio) EnableVersioning(ctx context.Context, bucket string) (err error)

EnableVersioning enable versioning for bucket.

func (*Minio) GetBucketVersioning

func (client *Minio) GetBucketVersioning(ctx context.Context, bucket string) (_ string, err error)

GetBucketVersioning gets bucket versioning state.

func (*Minio) ListBuckets

func (client *Minio) ListBuckets(ctx context.Context) (names []string, err error)

ListBuckets lists all buckets.

func (*Minio) ListObjects

func (client *Minio) ListObjects(ctx context.Context, bucket, prefix string) (names []string, err error)

ListObjects lists objects.

func (*Minio) MakeBucket

func (client *Minio) MakeBucket(ctx context.Context, bucket string) (err error)

MakeBucket makes a new bucket.

func (*Minio) RemoveBucket

func (client *Minio) RemoveBucket(ctx context.Context, bucket string) (err error)

RemoveBucket removes a bucket.

func (*Minio) Upload

func (client *Minio) Upload(ctx context.Context, bucket, objectName string, data []byte, metadata map[string]string) (err error)

Upload uploads object data to the specified path.

func (*Minio) UploadMultipart

func (client *Minio) UploadMultipart(ctx context.Context, bucket, objectName string, data []byte, partSize int, threshold int, metadata map[string]string) (err error)

UploadMultipart uses multipart uploads, has hardcoded threshold.

Jump to

Keyboard shortcuts

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