Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stscreds/assume_role_provider usage documentation is incorrect #1273

Closed
brodie-slater opened this issue May 23, 2021 · 2 comments · Fixed by #1275
Closed

stscreds/assume_role_provider usage documentation is incorrect #1273

brodie-slater opened this issue May 23, 2021 · 2 comments · Fixed by #1275
Labels
documentation This is a problem with documentation.

Comments

@brodie-slater
Copy link

brodie-slater commented May 23, 2021

Describe the issue with documentation
When using the stscreds.NewAssumeRoleProvider for the first time, I looked at the examples in the source code which, at time of writing shows:

cfg, err := config.LoadDefaultConfig(context.TODO())
	if err != nil {
		log.Fatal(err)
	}

stsSvc := sts.NewFromConfig(cfg)
creds := stscreds.NewAssumeRoleProvider(stsSvc, "myRoleArn")

cfg.Credentials = &aws.CredentialsCache{Provider: creds}
}

The issue is that, using cfg.Credentials = &aws.CredentialsCache{Provider: creds} doesn't compile. aws.CredentialsCache doesn't export the field Provider. If it once did, it is now a private field used by aws.NewCredentialsCache.

To Reproduce (observed behavior)
Follow the example code in the source file here

Expected behavior
A working example of how to use stscreds.NewAssumeRoleProvider

Additional information
I was able to get my program working with:

cfg, err := config.LoadDefaultConfig(context.TODO())
if err != nil {
	log.Fatal(err)
}

stsSvc := sts.NewFromConfig(cfg)
creds := stscreds.NewAssumeRoleProvider(stsSvc, "myRoleArn")

cfg.Credentials = creds << assigning creds directly

I didn't want to raise a PR suggesting this as a fix because I'm not sure if this is the best way to do it, or if it's better to use a CredentialsCache in some way.

Sorry if this sounds nitpicky. Thanks for all the work on this SDK, I love using it ❤️

@brodie-slater brodie-slater added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels May 23, 2021
@skmcgrail skmcgrail removed the needs-triage This issue or PR still needs to be triaged. label May 25, 2021
@skmcgrail
Copy link
Member

Thank you for bringing this to our attention @brodie-slater, this is an example we missed updating before we released the SDK for general availability. We will put together a PR to get this example fixed up.

jasdel pushed a commit that referenced this issue Jun 17, 2021
Fixes the code usage example for aws.CredentialsCache.

Fixes: #1273
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

jrichard8 pushed a commit to jrichard8/aws-sdk-go-v2 that referenced this issue Feb 14, 2022
Fixes the code usage example for aws.CredentialsCache.

Fixes: aws#1273
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a problem with documentation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants