storagekit

package
v0.0.0-...-fe7ef4e Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MinIOClient

type MinIOClient struct {
	*minio.Client
	// contains filtered or unexported fields
}

func NewMinIOClient

func NewMinIOClient(ctx context.Context, conf *MinIOConfig) *MinIOClient

func (*MinIOClient) Bucket

func (c *MinIOClient) Bucket() string

func (*MinIOClient) Endpoint

func (c *MinIOClient) Endpoint() string

func (*MinIOClient) PutObject

func (c *MinIOClient) PutObject(ctx context.Context, objectName string, reader io.Reader, objectSize int64, opts PutObjectOptions) error

type MinIOConfig

type MinIOConfig struct {
	Endpoint string `long:"endpoint" env:"ENDPOINT" description:"the endpoint of MinIO server" required:"true"`
	Bucket   string `long:"bucket" env:"BUCKET" description:"the bucket name" required:"true"`
	Username string `long:"username" env:"USERNAME" description:"the access key id (username) to the MinIO server" required:"true"`
	Password string `long:"password" env:"PASSWORD" description:"the secret access key (password) to the MinIO server" required:"true"`
	Insecure bool   `long:"insecure" env:"INSECURE" description:"disable HTTPS or not"`
	Policy   string `long:"policy" env:"POLICY" description:"the bucket policy" default:"public"`
}

type PutObjectOptions

type PutObjectOptions struct {
	ContentType string
}

type Storage

type Storage interface {
	// Endpoint returns the endpoint of the object storage
	Endpoint() string
	// Bucket returns the bucket name in the object storage
	Bucket() string

	// PutObject add an object into the storage bucket
	PutObject(ctx context.Context, objectName string, reader io.Reader, objectSize int64, opts PutObjectOptions) error
}

Provide a simplifier interface to upload file

Directories

Path Synopsis
mock
storagemock
Package storagemock is a generated GoMock package.
Package storagemock is a generated GoMock package.

Jump to

Keyboard shortcuts

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