From 52fa3a0e31d0e51fd76a0cab7918ba98037b407f Mon Sep 17 00:00:00 2001 From: MaineK00n Date: Mon, 17 Jun 2024 21:43:52 +0900 Subject: [PATCH] refactor(report/s3): remove deprecated method for s3 endpoint (#1967) --- reporter/s3.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/reporter/s3.go b/reporter/s3.go index 8cc3ecc7..d356326c 100644 --- a/reporter/s3.go +++ b/reporter/s3.go @@ -33,11 +33,6 @@ type S3Writer struct { func (w S3Writer) getS3() (*s3.Client, error) { var optFns []func(*awsConfig.LoadOptions) error - if w.S3Endpoint != "" { - optFns = append(optFns, awsConfig.WithEndpointResolverWithOptions(aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) { - return aws.Endpoint{URL: w.S3Endpoint}, nil - }))) - } if w.Region != "" { optFns = append(optFns, awsConfig.WithRegion(w.Region)) } @@ -55,7 +50,14 @@ func (w S3Writer) getS3() (*s3.Client, error) { if err != nil { return nil, xerrors.Errorf("Failed to load config. err: %w", err) } - return s3.NewFromConfig(cfg, func(o *s3.Options) { o.UsePathStyle = w.S3UsePathStyle }), nil + return s3.NewFromConfig(cfg, + func(o *s3.Options) { + if w.S3Endpoint != "" { + o.BaseEndpoint = aws.String(w.S3Endpoint) + } + }, + func(o *s3.Options) { o.UsePathStyle = w.S3UsePathStyle }, + ), nil } // Write results to S3