mirror of
https://github.com/nabbar/golib.git
synced 2025-09-27 04:06:05 +08:00
Package AWS:
- fix bug whos aws config checksum not loaded from config struct, using callback on config process - bump to latest sdk release Other: - bump dependencies
This commit is contained in:
@@ -160,3 +160,7 @@ func (c *awsModel) SetChecksumValidation(req sdkaws.RequestChecksumCalculation,
|
|||||||
Response: rsp,
|
Response: rsp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *awsModel) GetChecksumValidation() (req sdkaws.RequestChecksumCalculation, rsp sdkaws.ResponseChecksumValidation) {
|
||||||
|
return c.checksum.Request, c.checksum.Response
|
||||||
|
}
|
||||||
|
@@ -172,3 +172,7 @@ func (c *awsModel) SetChecksumValidation(req sdkaws.RequestChecksumCalculation,
|
|||||||
Response: rsp,
|
Response: rsp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *awsModel) GetChecksumValidation() (req sdkaws.RequestChecksumCalculation, rsp sdkaws.ResponseChecksumValidation) {
|
||||||
|
return c.checksum.Request, c.checksum.Response
|
||||||
|
}
|
||||||
|
@@ -75,6 +75,7 @@ type Config interface {
|
|||||||
SetBucketName(bucket string)
|
SetBucketName(bucket string)
|
||||||
|
|
||||||
SetChecksumValidation(req sdkaws.RequestChecksumCalculation, rsp sdkaws.ResponseChecksumValidation)
|
SetChecksumValidation(req sdkaws.RequestChecksumCalculation, rsp sdkaws.ResponseChecksumValidation)
|
||||||
|
GetChecksumValidation() (req sdkaws.RequestChecksumCalculation, rsp sdkaws.ResponseChecksumValidation)
|
||||||
}
|
}
|
||||||
|
|
||||||
type AWS interface {
|
type AWS interface {
|
||||||
|
14
aws/model.go
14
aws/model.go
@@ -197,18 +197,28 @@ func (c *client) _NewClientS3(ctx context.Context, httpClient libhtc.HttpClient,
|
|||||||
Retryer: ret,
|
Retryer: ret,
|
||||||
HTTPClient: httpClient,
|
HTTPClient: httpClient,
|
||||||
UsePathStyle: c.p,
|
UsePathStyle: c.p,
|
||||||
})
|
}, c.updateConfigS3)
|
||||||
} else {
|
} else {
|
||||||
opt := cli.Options()
|
opt := cli.Options()
|
||||||
opt.HTTPClient = httpClient
|
opt.HTTPClient = httpClient
|
||||||
opt.HTTPSignerV4 = sig
|
opt.HTTPSignerV4 = sig
|
||||||
opt.UsePathStyle = c.p
|
opt.UsePathStyle = c.p
|
||||||
sss = sdksss.New(opt)
|
sss = sdksss.New(opt, c.updateConfigS3)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sss, nil
|
return sss, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *client) updateConfigIAM(opt *sdkiam.Options) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *client) updateConfigS3(opt *sdksss.Options) {
|
||||||
|
req, rsp := c.c.GetChecksumValidation()
|
||||||
|
opt.RequestChecksumCalculation = req
|
||||||
|
opt.ResponseChecksumValidation = rsp
|
||||||
|
}
|
||||||
|
|
||||||
func (c *client) NewForConfig(ctx context.Context, cfg Config) (AWS, error) {
|
func (c *client) NewForConfig(ctx context.Context, cfg Config) (AWS, error) {
|
||||||
c.m.Lock()
|
c.m.Lock()
|
||||||
defer c.m.Unlock()
|
defer c.m.Unlock()
|
||||||
|
4
go.mod
4
go.mod
@@ -10,7 +10,7 @@ require (
|
|||||||
github.com/aws/aws-sdk-go-v2/config v1.29.9
|
github.com/aws/aws-sdk-go-v2/config v1.29.9
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.62
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.62
|
||||||
github.com/aws/aws-sdk-go-v2/service/iam v1.40.1
|
github.com/aws/aws-sdk-go-v2/service/iam v1.40.1
|
||||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.78.1
|
github.com/aws/aws-sdk-go-v2/service/s3 v1.78.2
|
||||||
github.com/aws/smithy-go v1.22.3
|
github.com/aws/smithy-go v1.22.3
|
||||||
github.com/bits-and-blooms/bitset v1.21.0
|
github.com/bits-and-blooms/bitset v1.21.0
|
||||||
github.com/c-bata/go-prompt v0.2.6
|
github.com/c-bata/go-prompt v0.2.6
|
||||||
@@ -84,7 +84,7 @@ require (
|
|||||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
|
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.34 // indirect
|
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.34 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
|
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.6.2 // indirect
|
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.7.0 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect
|
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.15 // indirect
|
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.15 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/sso v1.25.1 // indirect
|
github.com/aws/aws-sdk-go-v2/service/sso v1.25.1 // indirect
|
||||||
|
Reference in New Issue
Block a user