31 lines
579 B
Go
31 lines
579 B
Go
package minio
|
|
|
|
import (
|
|
"git.hpds.cc/Component/logging"
|
|
"github.com/minio/minio-go"
|
|
)
|
|
|
|
type MinClient struct {
|
|
Client *minio.Client
|
|
Logger *logging.Logger
|
|
}
|
|
|
|
func NewClient(ak, sak, ep string, useSSL bool, logger *logging.Logger) *MinClient {
|
|
client, err := minio.New(ep, ak, sak, useSSL)
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
return &MinClient{
|
|
Client: client,
|
|
Logger: logger,
|
|
}
|
|
}
|
|
|
|
func (cli *MinClient) UploadObject(fn, dst, bucket string) error {
|
|
_, err := cli.Client.FPutObject(bucket, dst, fn, minio.PutObjectOptions{})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|