s3manager-web/internal/app/s3manager/s3.go
2021-08-17 15:44:49 +02:00

21 lines
893 B
Go

package s3manager
import (
"context"
"io"
"github.com/minio/minio-go/v7"
)
//go:generate moq -out mocks/s3.go -pkg mocks . S3
// S3 is a client to interact with S3 storage.
type S3 interface {
GetObject(ctx context.Context, bucketName, objectName string, opts minio.GetObjectOptions) (*minio.Object, error)
ListBuckets(ctx context.Context) ([]minio.BucketInfo, error)
ListObjects(ctx context.Context, bucketName string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo
MakeBucket(ctx context.Context, bucketName string, opts minio.MakeBucketOptions) error
PutObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts minio.PutObjectOptions) (minio.UploadInfo, error)
RemoveBucket(ctx context.Context, bucketName string) error
RemoveObject(ctx context.Context, bucketName, objectName string, opts minio.RemoveObjectOptions) error
}