Skip to content

Commit

Permalink
credentials: Fix aws.CredentialsCache code usage examples (#1275)
Browse files Browse the repository at this point in the history
Fixes the code usage example for aws.CredentialsCache.

Fixes: #1273
  • Loading branch information
skmcgrail committed Jun 17, 2021
1 parent 7cdbfce commit d00f3da
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
8 changes: 8 additions & 0 deletions .changelog/14067f87820c48f9bb15fc3cb4c1d24c.json
@@ -0,0 +1,8 @@
{
"id": "14067f87-820c-48f9-bb15-fc3cb4c1d24c",
"type": "bugfix",
"description": "Fixed example usages of aws.CredentialsCache ([#1275](https://github.com/aws/aws-sdk-go-v2/pull/1275))",
"modules": [
"credentials"
]
}
10 changes: 5 additions & 5 deletions credentials/ec2rolecreds/doc.go
Expand Up @@ -30,12 +30,12 @@
// it with the CredentialsCache before assigning the provider to the Amazon S3 API
// client's Credentials option.
//
// provider := imds.New(imds.Options{})
// provider := imds.New(imds.Options{})
//
// // Create the service client value configured for credentials.
// svc := s3.New(s3.Options{
// Credentials: &aws.CredentialsCache{Provider: provider},
// })
// // Create the service client value configured for credentials.
// svc := s3.New(s3.Options{
// Credentials: aws.NewCredentialsCache(provider),
// })
//
// If you need more control, you can set the configuration options on the
// credentials provider using the imds.Options type to configure the EC2 IMDS
Expand Down
20 changes: 10 additions & 10 deletions credentials/processcreds/doc.go
Expand Up @@ -47,22 +47,22 @@
// it with the CredentialsCache before assigning the provider to the Amazon S3 API
// client's Credentials option.
//
// // Create credentials using the Provider.
// // Create credentials using the Provider.
// provider := processcreds.NewProvider("/path/to/command")
//
// // Create the service client value configured for credentials.
// svc := s3.New(s3.Options{
// Credentials: &aws.CredentialsCache{Provider: provider},
// })
// // Create the service client value configured for credentials.
// svc := s3.New(s3.Options{
// Credentials: aws.NewCredentialsCache(provider),
// })
//
// If you need more control, you can set any configurable options in the
// credentials using one or more option functions.
//
// provider := processcreds.NewProvider("/path/to/command",
// func(o *processcreds.Options) {
// // Override the provider's default timeout
// o.Timeout = 2 * time.Minute
// })
// provider := processcreds.NewProvider("/path/to/command",
// func(o *processcreds.Options) {
// // Override the provider's default timeout
// o.Timeout = 2 * time.Minute
// })
//
// You can also use your own `exec.Cmd` value by satisfying a value that satisfies
// the `NewCommandBuilder` interface and use the `NewProviderCommand` constructor.
Expand Down
6 changes: 3 additions & 3 deletions credentials/stscreds/assume_role_provider.go
Expand Up @@ -26,7 +26,7 @@
// stsSvc := sts.NewFromConfig(cfg)
// creds := stscreds.NewAssumeRoleProvider(stsSvc, "myRoleArn")
//
// cfg.Credentials = &aws.CredentialsCache{Provider: creds}
// cfg.Credentials = aws.NewCredentialsCache(creds)
//
// // Create service client value configured for credentials
// // from assumed role.
Expand Down Expand Up @@ -55,7 +55,7 @@
// o.TokenCode = aws.String("00000000")
// })
//
// cfg.Credentials = &aws.CredentialsCache{Provider: creds}
// cfg.Credentials = aws.NewCredentialsCache(creds)
//
// // Create service client value configured for credentials
// // from assumed role.
Expand Down Expand Up @@ -88,7 +88,7 @@
// o.TokenProvider = stscreds.StdinTokenProvider
// })
//
// cfg.Credentials = &aws.CredentialsCache{Provider: creds}
// cfg.Credentials = aws.NewCredentialsCache(creds)
//
// // Create service client value configured for credentials
// // from assumed role.
Expand Down

0 comments on commit d00f3da

Please sign in to comment.