Skip to content

Commit 14923a8

Browse files
authored
awss3receiver: Remove use of deprecated AWS SDK v2 API (open-telemetry#34171)
**Description:** Remove use of deprecated AWS SDK v2 Endpoint resolver API **Link to tracking Issue:** open-telemetry#30750 **Testing:** Tested against a locally running localstack instance. **Documentation:** N/A
1 parent 358ab68 commit 14923a8

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

receiver/awss3receiver/s3intf.go

+5-11
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@ func newS3Client(ctx context.Context, cfg S3DownloaderConfig) (ListObjectsAPI, G
3737
if cfg.Region != "" {
3838
optionsFuncs = append(optionsFuncs, config.WithRegion(cfg.Region))
3939
}
40-
41-
if cfg.Endpoint != "" {
42-
customResolver := aws.EndpointResolverWithOptionsFunc(func(_, _ string, _ ...any) (aws.Endpoint, error) {
43-
return aws.Endpoint{
44-
PartitionID: cfg.EndpointPartitionID,
45-
URL: cfg.Endpoint,
46-
SigningRegion: cfg.Region,
47-
}, nil
48-
})
49-
optionsFuncs = append(optionsFuncs, config.WithEndpointResolverWithOptions(customResolver))
50-
}
5140
awsCfg, err := config.LoadDefaultConfig(ctx, optionsFuncs...)
5241
if err != nil {
5342
log.Fatalf("unable to load SDK config, %v", err)
@@ -59,6 +48,11 @@ func newS3Client(ctx context.Context, cfg S3DownloaderConfig) (ListObjectsAPI, G
5948
o.UsePathStyle = true
6049
})
6150
}
51+
if cfg.Endpoint != "" {
52+
s3OptionFuncs = append(s3OptionFuncs, func(o *s3.Options) {
53+
o.BaseEndpoint = aws.String(cfg.Endpoint)
54+
})
55+
}
6256
client := s3.NewFromConfig(awsCfg, s3OptionFuncs...)
6357

6458
return &s3ListObjectsAPIImpl{client: client}, client, nil

0 commit comments

Comments
 (0)