s3

package
v1.1.72 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(baseConfig *common_utils.BaseConfig) (*s3.Client, error)

func PreSignClient

func PreSignClient(client *s3.Client) *s3.PresignClient

Types

type ListObjectsV2Pager

type ListObjectsV2Pager interface {
	HasMorePages() bool
	NextPage(context.Context, ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
}

type S3Client

type S3Client interface {
	ListObjectsV2(ctx context.Context,
		params *s3.ListObjectsV2Input,
		optFns ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
	PutObject(ctx context.Context,
		params *s3.PutObjectInput,
		optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
	CreateMultipartUpload(ctx context.Context,
		params *s3.CreateMultipartUploadInput,
		optFns ...func(*s3.Options)) (*s3.CreateMultipartUploadOutput, error)
	DeleteObject(ctx context.Context,
		params *s3.DeleteObjectInput,
		optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
	UploadPart(ctx context.Context,
		params *s3.UploadPartInput,
		optFns ...func(*s3.Options)) (*s3.UploadPartOutput, error)
	CompleteMultipartUpload(ctx context.Context,
		params *s3.CompleteMultipartUploadInput,
		optFns ...func(*s3.Options)) (*s3.CompleteMultipartUploadOutput, error)
}

type S3ClientImpl

type S3ClientImpl struct {
	// contains filtered or unexported fields
}

func (*S3ClientImpl) BuildPublicUrl

func (s *S3ClientImpl) BuildPublicUrl(path string) string

func (*S3ClientImpl) DeleteFile

func (s *S3ClientImpl) DeleteFile(ctx context.Context, bucketName string, path string) error

func (*S3ClientImpl) GetPreSignUrl

func (s *S3ClientImpl) GetPreSignUrl(ctx context.Context, path string) (string, error)

func (*S3ClientImpl) UploadPartPublicFile

func (s *S3ClientImpl) UploadPartPublicFile(ctx context.Context, file multipart.File, path string) (string, error)

func (*S3ClientImpl) UploadPrivateFile

func (s *S3ClientImpl) UploadPrivateFile(ctx context.Context, file multipart.File, path string) (string, error)

func (*S3ClientImpl) UploadPublicFile

func (s *S3ClientImpl) UploadPublicFile(ctx context.Context, file multipart.File, path string) (string, error)

type S3File

type S3File interface {
	UploadPrivateFile(ctx context.Context, file multipart.File, path string) (string, error)
	UploadPublicFile(ctx context.Context, file multipart.File, path string) (string, error)
	UploadPartPublicFile(ctx context.Context, file multipart.File, path string) (string, error)
	DeleteFile(ctx context.Context, bucketName string, path string) error
	GetPreSignUrl(ctx context.Context, path string) (string, error)
	BuildPublicUrl(path string) string
}

func NewS3Client

func NewS3Client(
	client S3Client,
	preSign S3PreSign,
	config *common_utils.BaseConfig,
) S3File

type S3PreSign

type S3PreSign interface {
	PresignGetObject(
		ctx context.Context,
		params *s3.GetObjectInput,
		optFns ...func(*s3.PresignOptions)) (*v4.PresignedHTTPRequest, error)
}

Jump to

Keyboard shortcuts

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