s3manager-web/internal/app/s3manager/s3.go
2023-08-20 16:21:04 +02:00

30 lines
1.1 KiB
Go

package s3manager
import (
"context"
"io"
"net/url"
"time"
"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
PresignedGetObject(ctx context.Context, bucketName, objectName string, expiry time.Duration, reqParams url.Values) (*url.URL, 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
}
type SSEType struct {
Type string
Key string
}