Documentation ¶
Index ¶
- type Config
- type MinioClient
- func (mc *MinioClient) CreateBucket(ctx context.Context, bucketName string) (err error)
- func (mc *MinioClient) ExistBucket(ctx context.Context, bucketName string) (exist bool, err error)
- func (mc *MinioClient) FPutObject(ctx context.Context, bucketName, objectName, path string, ext ...string) (fileUrl string, err error)
- func (mc *MinioClient) GetFileUrl(ctx context.Context, bucketName string, objectName string, expireTime ...int64) (fileUrl string, err error)
- func (mc *MinioClient) PutObject(ctx context.Context, bucketName, objectName string, reader io.Reader, ...) (fileUrl string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // object store internal endpoint InternalEndpoint string // object get external endpoint. // it may be a domain or ip+port address ExternalEndpoint string // bucket region, default empty string Region string // minio access key AccessKey string // minio secret key SecretKey string // http or https, default http Secure bool // file url expire time. Remember that expired time can't greater than 7 days ExpireTime time.Duration }
Config minio client config
type MinioClient ¶
type MinioClient struct {
// contains filtered or unexported fields
}
MinioClient minio client struct
func New ¶
func New(cfg *Config) (clnt *MinioClient, err error)
New returns MinioClient instance, it default use S3 V2 signature because it will be override if endpoint is S3 or GCS schema
func (*MinioClient) CreateBucket ¶
func (mc *MinioClient) CreateBucket(ctx context.Context, bucketName string) (err error)
CreateBucket create a new bucket with bucketName with a context to control cancellations and timeouts
func (*MinioClient) ExistBucket ¶
ExistBucket verifies if bucket exists and you have permission to access it Allows for a Context to control cancellations and timeouts
func (*MinioClient) FPutObject ¶
func (mc *MinioClient) FPutObject(ctx context.Context, bucketName, objectName, path string, ext ...string) (fileUrl string, err error)
FPutObject create an object in a bucket, with contents from file at filePath
func (*MinioClient) GetFileUrl ¶
func (mc *MinioClient) GetFileUrl(ctx context.Context, bucketName string, objectName string, expireTime ...int64) (fileUrl string, err error)
GetFileUrl generate presigned get object url
func (*MinioClient) PutObject ¶
func (mc *MinioClient) PutObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, ext ...string) (fileUrl string, err error)
PutObject creates an object in a bucket.
You must have WRITE permissions on a bucket to create an object.
- For size smaller than 128MiB PutObject automatically does a single atomic Put operation.
- For size larger than 128MiB PutObject automatically does a multipart Put operation.
- For size input as -1 PutObject does a multipart Put operation until input stream reaches EOF. Maximum object size that can be uploaded through this operation will be 5TiB.