From 88ce2ff1420c110e94d9ca131ab86f34c5bda6d4 Mon Sep 17 00:00:00 2001 From: Sean McGrail Date: Thu, 17 Jun 2021 23:50:05 +0000 Subject: [PATCH] credentials: Fix aws.CredentialsCache code usage examples (#1275) Fixes the code usage example for aws.CredentialsCache. Fixes: #1273 --- .../14067f87820c48f9bb15fc3cb4c1d24c.json | 8 ++++++++ credentials/ec2rolecreds/doc.go | 10 +++++----- credentials/processcreds/doc.go | 20 +++++++++---------- credentials/stscreds/assume_role_provider.go | 6 +++--- 4 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 .changelog/14067f87820c48f9bb15fc3cb4c1d24c.json diff --git a/.changelog/14067f87820c48f9bb15fc3cb4c1d24c.json b/.changelog/14067f87820c48f9bb15fc3cb4c1d24c.json new file mode 100644 index 00000000000..d82a5083c13 --- /dev/null +++ b/.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" + ] +} diff --git a/credentials/ec2rolecreds/doc.go b/credentials/ec2rolecreds/doc.go index 0bec6526b58..ae25c3a489c 100644 --- a/credentials/ec2rolecreds/doc.go +++ b/credentials/ec2rolecreds/doc.go @@ -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 diff --git a/credentials/processcreds/doc.go b/credentials/processcreds/doc.go index b028bea4246..d56dd8260d7 100644 --- a/credentials/processcreds/doc.go +++ b/credentials/processcreds/doc.go @@ -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. diff --git a/credentials/stscreds/assume_role_provider.go b/credentials/stscreds/assume_role_provider.go index 1ea13c77764..89df533256e 100644 --- a/credentials/stscreds/assume_role_provider.go +++ b/credentials/stscreds/assume_role_provider.go @@ -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. @@ -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. @@ -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.