Fix aws endpoint deprecation

This commit is contained in:
2025-12-04 06:20:19 +01:00
parent 2b64b31393
commit 48b68d3410
2 changed files with 4 additions and 14 deletions

View File

@@ -515,7 +515,6 @@ func (fsa *FsArchive) Iter(loadMetricData bool) <-chan JobContainer {
cclog.Errorf("in %s: %s", filepath.Join(dirpath, startTimeDir.Name()), err.Error())
}
ch <- JobContainer{Meta: job, Data: &data}
cclog.Errorf("in %s: %s", filepath.Join(dirpath, startTimeDir.Name()), err.Error())
} else {
ch <- JobContainer{Meta: job, Data: nil}
}

View File

@@ -90,17 +90,6 @@ func (s3a *S3Archive) Init(rawConfig json.RawMessage) (uint64, error) {
if cfg.AccessKey != "" && cfg.SecretKey != "" {
// Use static credentials
customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
if cfg.Endpoint != "" {
return aws.Endpoint{
URL: cfg.Endpoint,
HostnameImmutable: cfg.UsePathStyle,
Source: aws.EndpointSourceCustom,
}, nil
}
return aws.Endpoint{}, &aws.EndpointNotFoundError{}
})
awsCfg, err = awsconfig.LoadDefaultConfig(ctx,
awsconfig.WithRegion(cfg.Region),
awsconfig.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(
@@ -108,7 +97,6 @@ func (s3a *S3Archive) Init(rawConfig json.RawMessage) (uint64, error) {
cfg.SecretKey,
"",
)),
awsconfig.WithEndpointResolverWithOptions(customResolver),
)
} else {
// Use default credential chain
@@ -122,9 +110,12 @@ func (s3a *S3Archive) Init(rawConfig json.RawMessage) (uint64, error) {
return 0, err
}
// Create S3 client with path-style option
// Create S3 client with path-style option and custom endpoint if specified
s3a.client = s3.NewFromConfig(awsCfg, func(o *s3.Options) {
o.UsePathStyle = cfg.UsePathStyle
if cfg.Endpoint != "" {
o.BaseEndpoint = aws.String(cfg.Endpoint)
}
})
s3a.bucket = cfg.Bucket