awss3

package
v0.5.41 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsS3

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

func NewAwsS3

func NewAwsS3(options ...Option) *AwsS3

func (*AwsS3) AbortMultipartUpload

func (awsS3 *AwsS3) AbortMultipartUpload(conf *CancelMultipartUploadConfig) error

AbortMultipartUpload 取消分片上传

func (*AwsS3) Client

func (awsS3 *AwsS3) Client() *s3.Client

func (*AwsS3) CompleteMultipartUpload

func (awsS3 *AwsS3) CompleteMultipartUpload(conf *CompleteMultipartUploadConfig) error

CompleteMultipartUpload 完成分片上传, 将会合并所有分片 conf 包含了完成分片上传所需的参数

func (*AwsS3) CreateMultipartUpload

func (awsS3 *AwsS3) CreateMultipartUpload(conf *GetPreSignURLConf) (*MultipartResponse, error)

CreateMultipartUpload 创建分片上传

func (*AwsS3) DeleteFile

func (awsS3 *AwsS3) DeleteFile(conf *DeleteObjectConfig) error

func (*AwsS3) GetMultipartUploadPreSignURL

func (awsS3 *AwsS3) GetMultipartUploadPreSignURL(conf *MultipartUploadPreSignConfig) (string, error)

GetMultipartUploadPreSignURL 获取预签名分片上传链接 bucket: 存储桶 uploadId: 上传ID objectKey: 对象键 partNumber: 分片编号 expires: 预签 URL 过期时间

func (*AwsS3) GetPreSignDownloadURL

func (awsS3 *AwsS3) GetPreSignDownloadURL(bucket, key string, expires time.Duration) (string, error)

GetPreSignDownloadURL 获取预签名下载链接

func (*AwsS3) GetPreSignUploadURL

func (awsS3 *AwsS3) GetPreSignUploadURL(conf *GetPreSignURLConf) (string, error)

GetPreSignUploadURL 获取预签名上传链接

func (*AwsS3) ListFileByPrefix

func (awsS3 *AwsS3) ListFileByPrefix(bucket, prefix string) ([]types.Object, error)

ListFileByPrefix 获取指定前缀的文件列表

func (*AwsS3) PreSignClient

func (awsS3 *AwsS3) PreSignClient() *s3.PresignClient

func (*AwsS3) Provide

func (awsS3 *AwsS3) Provide(ctx context.Context) any

type CancelMultipartUploadConfig

type CancelMultipartUploadConfig struct {
	Bucket              string
	ObjectKey           string
	UploadId            string
	ExpectedBucketOwner string
}

type CompleteMultipartUploadConfig

type CompleteMultipartUploadConfig struct {
	Bucket      string
	UploadId    string         // 上传ID
	ObjectKey   string         // 对象名称
	ContentType string         // 文件类型
	Parts       []CompletePart // 分片列表
}

type CompletePart

type CompletePart struct {
	PartNumber int32  // 分片编号
	ETag       string // 分片的ETag
}

type DeleteObjectConfig

type DeleteObjectConfig struct {
	Bucket              string
	ObjectKey           string
	ExpectedBucketOwner string
	VersionId           string
}

type GetPreSignURLConf

type GetPreSignURLConf struct {
	Bucket       string
	ObjectKey    string
	Expires      time.Duration
	ContentType  string
	CacheControl string
}

type MultipartResponse

type MultipartResponse struct {
	UploadId string
}

type MultipartUploadPreSignConfig

type MultipartUploadPreSignConfig struct {
	Bucket     string        // 存储桶名称
	UploadId   string        // 上传ID
	ObjectKey  string        // 对象名称
	PartNumber int32         // 分片编号
	Expires    time.Duration // 预签名URL过期时间
}

type Option

type Option func(*Options)

func WithAccessKey

func WithAccessKey(accessKey string) Option

func WithCacheControl

func WithCacheControl(cacheControl string) Option

func WithRegion

func WithRegion(region string) Option

func WithSecretKey

func WithSecretKey(secretKey string) Option

type Options

type Options struct {
	Region       string
	AccessKey    string
	SecretKey    string
	CacheControl string
}

Jump to

Keyboard shortcuts

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