refactor(report/s3): remove deprecated method for s3 endpoint (#1967)

This commit is contained in:
MaineK00n
2024-06-17 21:43:52 +09:00
committed by GitHub
parent ad4f66d551
commit 52fa3a0e31

View File

@@ -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