-
Notifications
You must be signed in to change notification settings - Fork 914
Add initial AuthSchemeProvider codegen #4025
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 initial AuthSchemeProvider codegen #4025
Conversation
This includes: * AuthSchemeParams interface and implementation. * AuthSchemeProvider interface * AuthSchemeProvider implementation is stubbed out for now. * Plumbing to generate authscheme related code
247ec75
to
d843a6f
Compare
This is needed for setting authSchemeProvider client configuration option.
...en/src/test/resources/software/amazon/awssdk/codegen/poet/authscheme/auth-scheme-params.java
Outdated
Show resolved
Hide resolved
codegen/src/main/java/software/amazon/awssdk/codegen/poet/authscheme/AuthSchemeSpecUtils.java
Outdated
Show resolved
Hide resolved
@@ -70,6 +70,9 @@ public final class Constant { | |||
|
|||
public static final String PACKAGE_NAME_RULES_PATTERN = "%s.endpoints"; | |||
|
|||
// TODO: reviewer: maybe just auth instead of authscheme? or auth.scheme? |
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.
my.service.package.name.auth.authscheme
is also another option that sounds good to me. Does it make sense to have authscheme
a sub-package of the auth
package?
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.
I like auth
as prefix
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.
Updated to use .auth.scheme
.
codegen/src/main/java/software/amazon/awssdk/codegen/poet/authscheme/AuthSchemeParamsSpec.java
Outdated
Show resolved
Hide resolved
codegen/src/main/java/software/amazon/awssdk/codegen/poet/authscheme/AuthSchemeParamsSpec.java
Outdated
Show resolved
Hide resolved
.addParameter(ParameterSpec.builder(String.class, "region").build()) | ||
.returns(authSchemeSpecUtils.parametersInterfaceBuilderInterfaceName()) | ||
.addJavadoc("Set the region. The region parameter may be used with the $S auth scheme.", | ||
"aws.auth#sigv4") // TODO: Could the known auth schemes be defined somewhere? |
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.
If we're not exposing the auth scheme id (slightly unsure), do we need to reference it? Can we reference the AuthScheme class for Sigv4 instead?
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.
I think they can be considered public. I used it in the javadoc for HttpAuthScheme. Good point about using the AuthScheme class. It doesn't exist yet. So will keep the TODO to update when that exists.
Also, removed/updated some TODOs.
SonarCloud Quality Gate failed.
|
Motivation and Context
Modifications
This includes:
First I'd like to get feedback on whether the generated code itself looks good and the general setup of everything. There are some
TODO: reviewer
questions.Second, if there are suggestions to improve the code within the
Spec
classes, lmk.Note
This assumes that the service has model-based resolvers, which is most of AWS service, except S3 and EventBridge. Special handling for those 2 services will be added in separate PRs.
Testing
Added codegen tests for each file.
Ran
./mvnw clean install -pl :codegen,:s3
to confirm generated code builds within real service module.