controller

package
v0.0.0-...-3bd58ec Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AccessKey  string `yaml:"-" json:"-"`
	SecretKey  string `yaml:"-" json:"-"`
	ClientType string `yaml:"client_type" json:"client_type"`
	Endpoint   string `yaml:"endpoint" json:"endpoint"`
	Bucket     string `yaml:"bucket" json:"bucket"`
}

func NewConfig

func NewConfig() (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(opts ...Option) *Controller

func (*Controller) Download

func (c *Controller) Download(opts DownloadOptions) error

func (*Controller) List

func (c *Controller) List(opts ListOptions) error

func (*Controller) Upload

func (c *Controller) Upload(opts UploadOptions) error

func (*Controller) UploadDirectoryOrFile

func (c *Controller) UploadDirectoryOrFile(
	endpoint, bucket, prefix, path, encryptKey string, client internal.IS3Client) error

type DownloadOptions

type DownloadOptions struct {
	S3ClientType S3ClientType
	Endpoint     string
	Bucket       string
	OutputDir    string
	DecryptKey   string
	S3keys       []string
}

type ListOptions

type ListOptions struct {
	S3ClientType S3ClientType
	Endpoint     string
	Bucket       string
	Prefix       string
}

type Option

type Option func(c *Controller)

func WithBucket

func WithBucket(bucket string) Option

func WithCompression

func WithCompression() Option

func WithDefaultLogger

func WithDefaultLogger() Option

func WithEndpoint

func WithEndpoint(endPoint string) Option

func WithFileHandler

func WithFileHandler(handler internal.IFileHandler) Option

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithS3Client

func WithS3Client(key S3ClientType, client internal.IS3Client) Option

type S3ClientType

type S3ClientType string
const (
	S3ClientTypeOSS S3ClientType = "oss"
)

func (S3ClientType) Validate

func (t S3ClientType) Validate() error

type S3Clients

type S3Clients map[S3ClientType]internal.IS3Client

type UploadOptions

type UploadOptions struct {
	S3ClientType S3ClientType
	Endpoint     string
	Bucket       string
	Prefix       string
	EncryptKey   string
	Paths        []string
}

Jump to

Keyboard shortcuts

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