awss3

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 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 added in v0.4.9

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

AbortMultipartUpload 取消分片上传

func (*AwsS3) Client added in v0.4.3

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

func (*AwsS3) CompleteMultipartUpload added in v0.4.3

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

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

func (*AwsS3) CreateMultipartUpload added in v0.4.3

func (awsS3 *AwsS3) CreateMultipartUpload(bucket, key, fileType string) (*MultipartResponse, error)

CreateMultipartUpload 创建分片上传

func (*AwsS3) DeleteFile added in v0.4.10

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

func (*AwsS3) GetMultipartUploadPreSignURL added in v0.4.3

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

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

func (*AwsS3) GetPreSignDownloadURL added in v0.4.3

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

GetPreSignDownloadURL 获取预签名下载链接

func (*AwsS3) GetPreSignUploadURL added in v0.4.3

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

GetPreSignUploadURL 获取预签名上传链接

func (*AwsS3) PreSignClient added in v0.4.3

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

func (*AwsS3) Provide

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

type CancelMultipartUploadConfig added in v0.4.9

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

type CompleteMultipartUploadConfig added in v0.4.3

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

type CompletePart added in v0.4.3

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

type DeleteObjectConfig added in v0.4.10

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

type MultipartResponse added in v0.4.3

type MultipartResponse struct {
	UploadId string
}

type MultipartUploadPreSignConfig added in v0.4.3

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 WithRegion

func WithRegion(region string) Option

func WithSecretKey

func WithSecretKey(secretKey string) Option

type Options

type Options struct {
	Region    string
	AccessKey string
	SecretKey string
}

Jump to

Keyboard shortcuts

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