-
Notifications
You must be signed in to change notification settings - Fork 859
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
Add a RdsUtilities with the ability to generate an IAM auth token #2057
Conversation
This was based on a conversation with Matt. Looking for feedback on direction before writing tests and finishing testing + docs |
.putRawQueryParameter("Action", "connect") | ||
.build(); | ||
|
||
Instant expirationTime = Instant.now().plus(15, ChronoUnit.MINUTES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs a link to the doc where it states this must be 15 min
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, our doc pages all say 15 mins: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html
SonarCloud Quality Gate failed. 0 Bugs 0.0% Coverage The version of Java (1.8.0_252) you have used to run this analysis is deprecated and we will stop accepting it from October 2020. Please update to at least Java 11. |
Ping. Still looking for feedback on direction before committing any more time to this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall.
.../main/java/software/amazon/awssdk/services/rds/model/GenerateAuthenticationTokenRequest.java
Show resolved
Hide resolved
services/rds/src/main/java/software/amazon/awssdk/services/rds/RdsUtilities.java
Outdated
Show resolved
Hide resolved
services/rds/src/main/java/software/amazon/awssdk/services/rds/RdsUtilities.java
Outdated
Show resolved
Hide resolved
Sorry, re:invent kept me from getting back to this Zoe. Thank you for the initial review. Will work on marching this forward |
@zoewangg Should we stick region/credProvider in:
S3 seems to do both 3 |
@abrooksv I'd vote # 3 to be consistent with s3 utilities. |
Okay, new revision pushed:
Let me know if you want them broken out into 4 files, happy to do it. Or w/e layout you feel is best.
Need to figure out how we should test this. V1 has no tests for its version of the class 😢 Standard pre-signer methods have access to Should we have a test only constructor on DefaultRdsUtilities to takes a signer? |
Codecov Report
@@ Coverage Diff @@
## master #2057 +/- ##
============================================
+ Coverage 77.62% 77.64% +0.01%
Complexity 367 367
============================================
Files 1237 1240 +3
Lines 38904 39001 +97
Branches 3064 3068 +4
============================================
+ Hits 30201 30283 +82
- Misses 7239 7253 +14
- Partials 1464 1465 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WRT testing, I don't think it should have access to AwsRequestOverrideConfiguration
or SdkRequestOverrideConfiguration
. A test ctor with a test singer injected sounds good to me.
services/rds/src/main/java/software/amazon/awssdk/services/rds/RdsUtilities.java
Show resolved
Hide resolved
.../main/java/software/amazon/awssdk/services/rds/model/GenerateAuthenticationTokenRequest.java
Show resolved
Hide resolved
.../main/java/software/amazon/awssdk/services/rds/model/GenerateAuthenticationTokenRequest.java
Outdated
Show resolved
Hide resolved
services/rds/src/main/java/software/amazon/awssdk/services/rds/DefaultRdsUtilities.java
Outdated
Show resolved
Hide resolved
services/rds/src/main/java/software/amazon/awssdk/services/rds/DefaultRdsUtilities.java
Outdated
Show resolved
Hide resolved
5819133
to
0542027
Compare
|
||
public class DefaultRdsUtilitiesTest { | ||
private final ZoneId utcZone = ZoneId.of("UTC").normalized(); | ||
private final Clock fixedClock = Clock.fixed(ZonedDateTime.of(2016, 11, 7, 17, 39, 33, 0, utcZone).toInstant(), utcZone); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test data came from AWS CLI: https://github.com/aws/aws-cli/blob/master/tests/functional/rds/test_generate_db_auth_token.py#L50
f178c96
to
1ef3854
Compare
services/rds/src/main/java/software/amazon/awssdk/services/rds/RdsUtilities.java
Outdated
Show resolved
Hide resolved
Left one minor comment, otherwise LGTM. Can you squash all commits into one? |
Just a few clarifications. If so, then why model it as if there is? Specifically:
Overall, I reckon the idea is to model it after Why not simply a class with static methods, named |
Hi @lbruun, first of all, thank you for reviewing the design and providing feedback!
Yes, it is correct.
We will work on the javadocs to make it clear that |
1ef3854
to
4348a5d
Compare
Hi @zoewangg
And speaking of hidden utility classes: Why not take advantage of use like this: AwsHostNameUtils.parseSigningRegion(hostname, "rds"); Of course it should be optional. User should still be able to provide the Region explicitly. But providing the Region this way is IMO very likely to be correct. In fact I struggle to see when it won't yield the correct result given that the value used for |
@lbruun thanks for the javadoc suggestions! I think they make sense. We have added a note in
|
4348a5d
to
0c064a0
Compare
Kudos, SonarCloud Quality Gate passed! |
I would like to check this changes committed to 2.17.14 version. I couldn't able to locate the software.amazon.awssdk.services.rds.DefaultRdsUtilities.DefaultBuilder newer version. |
…d3cfe9a03 Pull request: release <- staging/1bea35fc-9413-467d-87b8-50ed3cfe9a03
Description
Add a new Rds Utilities class that can generate the auth token.
V1 Parity feature
More info: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.AWSCLI.html
Utilities pattern is used instead of Presigner due to this is a pseudo request. There does not exist a modeled API call so it does not make sense to make a presigner for it.
Motivation and Context
Upstream this code out of the AWS Toolkit for JetBrains
#1157
Testing
Need to write the tests
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsLicense