aws-sdk-go-v2
aws-sdk-go-v2 copied to clipboard
fix LoadDefaultConfig optFns
I want to use config.LoadOptionsFunc as below
// var opts []func(*config.LoadOptions) error
var opts []config.LoadOptionsFunc // now this will result in an error
if c.AccessKey != "" && c.SecretKey != "" {
opts = append(opts, config.WithCredentialsProvider(
&credentials.StaticCredentialsProvider{
Value: aws.Credentials{
AccessKeyID: c.AccessKey,
SecretAccessKey: c.SecretKey,
},
},
))
}
if c.Profile != "" {
opts = append(opts, config.WithSharedConfigProfile(c.Profile))
}
if c.Filename != "" {
opts = append(opts, config.WithSharedConfigFiles([]string{c.Filename}))
}
return config.LoadDefaultConfig(context.TODO(), opts...)