Skip to content

Commit d00f3da

Browse files
authored
credentials: Fix aws.CredentialsCache code usage examples (#1275)
Fixes the code usage example for aws.CredentialsCache. Fixes: #1273
1 parent 7cdbfce commit d00f3da

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "14067f87-820c-48f9-bb15-fc3cb4c1d24c",
3+
"type": "bugfix",
4+
"description": "Fixed example usages of aws.CredentialsCache ([#1275](https://github.com/aws/aws-sdk-go-v2/pull/1275))",
5+
"modules": [
6+
"credentials"
7+
]
8+
}

credentials/ec2rolecreds/doc.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
// it with the CredentialsCache before assigning the provider to the Amazon S3 API
3131
// client's Credentials option.
3232
//
33-
// provider := imds.New(imds.Options{})
33+
// provider := imds.New(imds.Options{})
3434
//
35-
// // Create the service client value configured for credentials.
36-
// svc := s3.New(s3.Options{
37-
// Credentials: &aws.CredentialsCache{Provider: provider},
38-
// })
35+
// // Create the service client value configured for credentials.
36+
// svc := s3.New(s3.Options{
37+
// Credentials: aws.NewCredentialsCache(provider),
38+
// })
3939
//
4040
// If you need more control, you can set the configuration options on the
4141
// credentials provider using the imds.Options type to configure the EC2 IMDS

credentials/processcreds/doc.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,22 @@
4747
// it with the CredentialsCache before assigning the provider to the Amazon S3 API
4848
// client's Credentials option.
4949
//
50-
// // Create credentials using the Provider.
50+
// // Create credentials using the Provider.
5151
// provider := processcreds.NewProvider("/path/to/command")
5252
//
53-
// // Create the service client value configured for credentials.
54-
// svc := s3.New(s3.Options{
55-
// Credentials: &aws.CredentialsCache{Provider: provider},
56-
// })
53+
// // Create the service client value configured for credentials.
54+
// svc := s3.New(s3.Options{
55+
// Credentials: aws.NewCredentialsCache(provider),
56+
// })
5757
//
5858
// If you need more control, you can set any configurable options in the
5959
// credentials using one or more option functions.
6060
//
61-
// provider := processcreds.NewProvider("/path/to/command",
62-
// func(o *processcreds.Options) {
63-
// // Override the provider's default timeout
64-
// o.Timeout = 2 * time.Minute
65-
// })
61+
// provider := processcreds.NewProvider("/path/to/command",
62+
// func(o *processcreds.Options) {
63+
// // Override the provider's default timeout
64+
// o.Timeout = 2 * time.Minute
65+
// })
6666
//
6767
// You can also use your own `exec.Cmd` value by satisfying a value that satisfies
6868
// the `NewCommandBuilder` interface and use the `NewProviderCommand` constructor.

credentials/stscreds/assume_role_provider.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// stsSvc := sts.NewFromConfig(cfg)
2727
// creds := stscreds.NewAssumeRoleProvider(stsSvc, "myRoleArn")
2828
//
29-
// cfg.Credentials = &aws.CredentialsCache{Provider: creds}
29+
// cfg.Credentials = aws.NewCredentialsCache(creds)
3030
//
3131
// // Create service client value configured for credentials
3232
// // from assumed role.
@@ -55,7 +55,7 @@
5555
// o.TokenCode = aws.String("00000000")
5656
// })
5757
//
58-
// cfg.Credentials = &aws.CredentialsCache{Provider: creds}
58+
// cfg.Credentials = aws.NewCredentialsCache(creds)
5959
//
6060
// // Create service client value configured for credentials
6161
// // from assumed role.
@@ -88,7 +88,7 @@
8888
// o.TokenProvider = stscreds.StdinTokenProvider
8989
// })
9090
//
91-
// cfg.Credentials = &aws.CredentialsCache{Provider: creds}
91+
// cfg.Credentials = aws.NewCredentialsCache(creds)
9292
//
9393
// // Create service client value configured for credentials
9494
// // from assumed role.

0 commit comments

Comments
 (0)