chore: upgrade dependencies
This commit is contained in:
53
vendor/github.com/aws/aws-sdk-go-v2/config/resolve_credentials.go
generated
vendored
53
vendor/github.com/aws/aws-sdk-go-v2/config/resolve_credentials.go
generated
vendored
@@ -59,8 +59,8 @@ func resolveCredentials(ctx context.Context, cfg *aws.Config, configs configs) e
|
||||
//
|
||||
// Config providers used:
|
||||
// * credentialsProviderProvider
|
||||
func resolveCredentialProvider(ctx context.Context, cfg *aws.Config, cfgs configs) (bool, error) {
|
||||
credProvider, found, err := getCredentialsProvider(ctx, cfgs)
|
||||
func resolveCredentialProvider(ctx context.Context, cfg *aws.Config, configs configs) (bool, error) {
|
||||
credProvider, found, err := getCredentialsProvider(ctx, configs)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -68,7 +68,10 @@ func resolveCredentialProvider(ctx context.Context, cfg *aws.Config, cfgs config
|
||||
return false, nil
|
||||
}
|
||||
|
||||
cfg.Credentials = wrapWithCredentialsCache(credProvider)
|
||||
cfg.Credentials, err = wrapWithCredentialsCache(ctx, configs, credProvider)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
@@ -105,7 +108,10 @@ func resolveCredentialChain(ctx context.Context, cfg *aws.Config, configs config
|
||||
}
|
||||
|
||||
// Wrap the resolved provider in a cache so the SDK will cache credentials.
|
||||
cfg.Credentials = wrapWithCredentialsCache(cfg.Credentials)
|
||||
cfg.Credentials, err = wrapWithCredentialsCache(ctx, configs, cfg.Credentials)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -248,9 +254,12 @@ func resolveHTTPCredProvider(ctx context.Context, cfg *aws.Config, url, authToke
|
||||
|
||||
provider := endpointcreds.New(url, optFns...)
|
||||
|
||||
cfg.Credentials = wrapWithCredentialsCache(provider, func(options *aws.CredentialsCacheOptions) {
|
||||
cfg.Credentials, err = wrapWithCredentialsCache(ctx, configs, provider, func(options *aws.CredentialsCacheOptions) {
|
||||
options.ExpiryWindow = 5 * time.Minute
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -296,9 +305,10 @@ func resolveEC2RoleCredentials(ctx context.Context, cfg *aws.Config, configs con
|
||||
|
||||
provider := ec2rolecreds.New(optFns...)
|
||||
|
||||
cfg.Credentials = wrapWithCredentialsCache(provider, func(options *aws.CredentialsCacheOptions) {
|
||||
options.ExpiryWindow = 5 * time.Minute
|
||||
})
|
||||
cfg.Credentials, err = wrapWithCredentialsCache(ctx, configs, provider)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -430,12 +440,31 @@ func credsFromAssumeRole(ctx context.Context, cfg *aws.Config, sharedCfg *Shared
|
||||
return nil
|
||||
}
|
||||
|
||||
// wrapWithCredentialsCache will wrap provider with an aws.CredentialsCache with the provided options if the provider is not already a aws.CredentialsCache.
|
||||
func wrapWithCredentialsCache(provider aws.CredentialsProvider, optFns ...func(options *aws.CredentialsCacheOptions)) aws.CredentialsProvider {
|
||||
// wrapWithCredentialsCache will wrap provider with an aws.CredentialsCache
|
||||
// with the provided options if the provider is not already a
|
||||
// aws.CredentialsCache.
|
||||
func wrapWithCredentialsCache(
|
||||
ctx context.Context,
|
||||
cfgs configs,
|
||||
provider aws.CredentialsProvider,
|
||||
optFns ...func(options *aws.CredentialsCacheOptions),
|
||||
) (aws.CredentialsProvider, error) {
|
||||
_, ok := provider.(*aws.CredentialsCache)
|
||||
if ok {
|
||||
return provider
|
||||
return provider, nil
|
||||
}
|
||||
|
||||
return aws.NewCredentialsCache(provider, optFns...)
|
||||
credCacheOptions, found, err := getCredentialsCacheOptionsProvider(ctx, cfgs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// force allocation of a new slice if the additional options are
|
||||
// needed, to prevent overwriting the passed in slice of options.
|
||||
optFns = optFns[:len(optFns):len(optFns)]
|
||||
if found {
|
||||
optFns = append(optFns, credCacheOptions)
|
||||
}
|
||||
|
||||
return aws.NewCredentialsCache(provider, optFns...), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user