miniox

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMinioCTL added in v1.2.0

func InitMinioCTL(conf *Config)

初始化minio控制器

Types

type Config

type Config struct {
	Endpoint string `yaml:"endpoint"`

	Secure     bool   `yaml:"secure"`
	BucketName string `yaml:"bucketName"`
	// contains filtered or unexported fields
}
var CONFIG *Config

func (*Config) Format added in v1.2.0

func (conf *Config) Format() string

配置信息格式化

func (*Config) NewMinioCTL added in v1.2.0

func (conf *Config) NewMinioCTL() (ctl *Control, err error)

初始化minio控制

func (*Config) NewMinioClient added in v1.2.0

func (conf *Config) NewMinioClient() (client *minio.Client, err error)

初始化minio客户端

type Control added in v1.2.4

type Control struct {
	Config *Config            // minio配置
	Client *minio.Client      // minio客户端
	Ctx    context.Context    // 上下文
	Cancel context.CancelFunc // Cancel方法
}

minio控制器

var CTL *Control

func (*Control) BucketExists added in v1.2.4

func (ctl *Control) BucketExists(bucketName string) (bool, error)

判断桶是否存在

func (*Control) CreateBucket added in v1.2.4

func (ctl *Control) CreateBucket(bucketName string) error

创建桶

func (*Control) FileUpload added in v1.2.4

func (ctl *Control) FileUpload(bucketName string, objectName string, fileUrl string, contentType string) (string,
	error)

通过文件路径上传文件到桶

func (*Control) ObjectExist added in v1.2.4

func (ctl *Control) ObjectExist(bucketName string, objectName string) (bool, error)

获取对象是否存在

func (*Control) RemoveObjects added in v1.2.4

func (ctl *Control) RemoveObjects(bucketName string, objectNames []string) error

通过文件名称删除文件

func (*Control) SetBucketPolicy added in v1.2.4

func (ctl *Control) SetBucketPolicy(bucketName, policy string) error

设置桶的权限

func (*Control) SetCancel added in v1.2.4

func (ctl *Control) SetCancel(fn context.CancelFunc)

更新上下文配置

func (*Control) SetContext added in v1.2.4

func (ctl *Control) SetContext(ctx context.Context)

更新上下文配置

func (*Control) UploadToMinio added in v1.2.4

func (ctl *Control) UploadToMinio(bucketName string, objectName string, file *multipart.FileHeader, contentType string) (fileUrl string, err error)

上传文件

type Policy

type Policy struct {
	Version   string        `json:"Version"`
	Statement StatementList `json:"Statement"`
}

type Principal

type Principal struct {
	AWS []string `json:"AWS"`
}

type Statement

type Statement struct {
	Action    []string  `json:"Action"`
	Effect    string    `json:"Effect"`
	Principal Principal `json:"Principal"`
	Resource  []string  `json:"Resource"`
	Sid       string    `json:"Sid"`
}

type StatementList

type StatementList []*Statement

Jump to

Keyboard shortcuts

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