refactor: migrate from deprecated s3/manager to s3/transfermanager
storage / test (pull_request) Successful in 1m25s
storage / vulnerabilities (pull_request) Successful in 1m58s
pre-commit / pre-commit (pull_request) Successful in 5m0s

Replace feature/s3/manager (deprecated) with feature/s3/transfermanager.
Updates Uploader interface, constructor, and all tests to use the new
UploadObject API with transfermanager types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 01:03:19 +01:00
parent f260d3c3c0
commit d8decc411e
4 changed files with 19 additions and 19 deletions
+6 -6
View File
@@ -8,13 +8,13 @@ import (
"github.com/aws/aws-sdk-go-v2/aws"
v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager"
"github.com/aws/aws-sdk-go-v2/service/s3"
)
// Uploader is the interface for uploading objects to S3 using the upload manager
// Uploader is the interface for uploading objects to S3 using the transfer manager
type Uploader interface {
Upload(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error)
UploadObject(ctx context.Context, input *transfermanager.UploadObjectInput, opts ...func(*transfermanager.Options)) (*transfermanager.UploadObjectOutput, error)
}
// DirectUploader is the interface for uploading objects directly to S3
@@ -45,7 +45,7 @@ func (s *S3) Store(path string, content io.Reader, contentType string) (string,
}
func (s *S3) storeWithManager(path string, content io.Reader, contentType string) (string, error) {
out, err := s.svc.Upload(context.Background(), &s3.PutObjectInput{
out, err := s.svc.UploadObject(context.Background(), &transfermanager.UploadObjectInput{
Bucket: aws.String(s.bucket),
Key: aws.String(path),
Body: content,
@@ -100,8 +100,8 @@ func New(bucket string) (*S3, error) {
return nil, err
}
client := s3.NewFromConfig(cfg)
uploader := manager.NewUploader(client, func(u *manager.Uploader) {
u.PartSize = 5 * 1024 * 1024
uploader := transfermanager.New(client, func(o *transfermanager.Options) {
o.PartSizeBytes = 5 * 1024 * 1024
})
presignClient := s3.NewPresignClient(client)
return &S3{