vendor: github.com/aws/aws-sdk-go-v2/config v1.26.6

vendor github.com/aws/aws-sdk-go-v2/config v1.26.6 and related dependencies.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-02-05 18:08:03 +01:00
parent 089982153f
commit 43ed470208
190 changed files with 12340 additions and 13837 deletions

View File

@ -2,18 +2,11 @@ package config
import (
"context"
"os"
"github.com/aws/aws-sdk-go-v2/aws"
)
// defaultLoaders are a slice of functions that will read external configuration
// sources for configuration values. These values are read by the AWSConfigResolvers
// using interfaces to extract specific information from the external configuration.
var defaultLoaders = []loader{
loadEnvConfig,
loadSharedConfigIgnoreNotExist,
}
// defaultAWSConfigResolvers are a slice of functions that will resolve external
// configuration values into AWS configuration values.
//
@ -76,6 +69,17 @@ var defaultAWSConfigResolvers = []awsConfigResolver{
// Sets the resolved bearer authentication token API clients will use for
// httpBearerAuth authentication scheme.
resolveBearerAuthToken,
// Sets the sdk app ID if present in env var or shared config profile
resolveAppID,
resolveBaseEndpoint,
// Sets the DisableRequestCompression if present in env var or shared config profile
resolveDisableRequestCompression,
// Sets the RequestMinCompressSizeBytes if present in env var or shared config profile
resolveRequestMinCompressSizeBytes,
}
// A Config represents a generic configuration value or set of values. This type
@ -167,7 +171,7 @@ func (cs configs) ResolveConfig(f func(configs []interface{}) error) error {
// or the custom data will be ignored by the resolvers and config loaders.
//
// cfg, err := config.LoadDefaultConfig( context.TODO(),
// WithSharedConfigProfile("test-profile"),
// config.WithSharedConfigProfile("test-profile"),
// )
// if err != nil {
// panic(fmt.Sprintf("failed loading config, %v", err))
@ -187,7 +191,7 @@ func LoadDefaultConfig(ctx context.Context, optFns ...func(*LoadOptions) error)
// assign Load Options to configs
var cfgCpy = configs{options}
cfgCpy, err = cfgCpy.AppendFromLoaders(ctx, defaultLoaders)
cfgCpy, err = cfgCpy.AppendFromLoaders(ctx, resolveConfigLoaders(&options))
if err != nil {
return aws.Config{}, err
}
@ -199,3 +203,17 @@ func LoadDefaultConfig(ctx context.Context, optFns ...func(*LoadOptions) error)
return cfg, nil
}
func resolveConfigLoaders(options *LoadOptions) []loader {
loaders := make([]loader, 2)
loaders[0] = loadEnvConfig
// specification of a profile should cause a load failure if it doesn't exist
if os.Getenv(awsProfileEnvVar) != "" || options.SharedConfigProfile != "" {
loaders[1] = loadSharedConfig
} else {
loaders[1] = loadSharedConfigIgnoreNotExist
}
return loaders
}