-
Notifications
You must be signed in to change notification settings - Fork 955
Update codegen to automatically add chunked encoding signer property … #6551
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
Draft
zoewangg
wants to merge
1
commit into
master
Choose a base branch
from
zoewang/chunkedEncoding
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+36,512
−369
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
309 changes: 226 additions & 83 deletions
309
...n/java/software/amazon/awssdk/codegen/poet/auth/scheme/ModelAuthSchemeKnowledgeIndex.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,11 +161,24 @@ static List<TestCase> parameters() { | |
| .caseName("ops-with-no-auth") | ||
| .outputFileSuffix("default-provider") | ||
| .build(), | ||
| // Service with signature version with the same value as S3 | ||
| // S3 | ||
| TestCase.builder() | ||
| .modelProvider(ClientTestModels::serviceMiniS3) | ||
| .modelProvider(ClientTestModels::serviceS3) | ||
| .classSpecProvider(EndpointBasedAuthSchemeProviderSpec::new) | ||
| .caseName("s3-test") | ||
| .outputFileSuffix("default-provider") | ||
| .build(), | ||
| TestCase.builder() | ||
| .modelProvider(ClientTestModels::serviceS3) | ||
| .classSpecProvider(ModelBasedAuthSchemeProviderSpec::new) | ||
| .caseName("mini-s3") | ||
| .caseName("s3-test") | ||
| .outputFileSuffix("fallback-provider") | ||
| .build(), | ||
| // S3 control | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added s3 control because it uses legacy signature version |
||
| TestCase.builder() | ||
| .modelProvider(ClientTestModels::serviceS3Control) | ||
| .classSpecProvider(ModelBasedAuthSchemeProviderSpec::new) | ||
| .caseName("s3control-test") | ||
| .outputFileSuffix("default-provider") | ||
| .build(), | ||
| TestCase.builder() | ||
|
|
@@ -227,6 +240,13 @@ static List<TestCase> parameters() { | |
| .classSpecProvider(AuthSchemeInterceptorSpec::new) | ||
| .caseName("env-bearer-token") | ||
| .outputFileSuffix("interceptor") | ||
| .build(), | ||
| // Rest Json service with checksum | ||
| TestCase.builder() | ||
| .modelProvider(ClientTestModels::restJsonServiceModels) | ||
| .classSpecProvider(ModelBasedAuthSchemeProviderSpec::new) | ||
| .caseName("rest-json-checksum") | ||
| .outputFileSuffix("provider") | ||
| .build() | ||
| ); | ||
| } | ||
|
|
||
52 changes: 52 additions & 0 deletions
52
...tware/amazon/awssdk/codegen/poet/auth/scheme/rest-json-checksum-auth-scheme-provider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package software.amazon.awssdk.services.json.auth.scheme.internal; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import software.amazon.awssdk.annotations.Generated; | ||
| import software.amazon.awssdk.annotations.SdkInternalApi; | ||
| import software.amazon.awssdk.http.auth.aws.signer.AwsV4HttpSigner; | ||
| import software.amazon.awssdk.http.auth.spi.scheme.AuthSchemeOption; | ||
| import software.amazon.awssdk.services.json.auth.scheme.JsonAuthSchemeParams; | ||
| import software.amazon.awssdk.services.json.auth.scheme.JsonAuthSchemeProvider; | ||
|
|
||
| @Generated("software.amazon.awssdk:codegen") | ||
| @SdkInternalApi | ||
| public final class DefaultJsonAuthSchemeProvider implements JsonAuthSchemeProvider { | ||
| private static final DefaultJsonAuthSchemeProvider DEFAULT = new DefaultJsonAuthSchemeProvider(); | ||
|
|
||
| private DefaultJsonAuthSchemeProvider() { | ||
| } | ||
|
|
||
| public static DefaultJsonAuthSchemeProvider create() { | ||
| return DEFAULT; | ||
| } | ||
|
|
||
| @Override | ||
| public List<AuthSchemeOption> resolveAuthScheme(JsonAuthSchemeParams params) { | ||
| List<AuthSchemeOption> options = new ArrayList<>(); | ||
| switch (params.operation()) { | ||
| case "BearerAuthOperation": | ||
| options.add(AuthSchemeOption.builder().schemeId("smithy.api#httpBearerAuth").build()); | ||
| break; | ||
| case "StreamingInputOutputOperation": | ||
| options.add(AuthSchemeOption.builder().schemeId("aws.auth#sigv4") | ||
| .putSignerProperty(AwsV4HttpSigner.SERVICE_SIGNING_NAME, "json-service") | ||
| .putSignerProperty(AwsV4HttpSigner.REGION_NAME, params.region().id()) | ||
| .putSignerProperty(AwsV4HttpSigner.PAYLOAD_SIGNING_ENABLED, false).build()); | ||
| break; | ||
| case "PutOperationWithChecksum": | ||
| options.add(AuthSchemeOption.builder().schemeId("aws.auth#sigv4") | ||
| .putSignerProperty(AwsV4HttpSigner.SERVICE_SIGNING_NAME, "json-service") | ||
| .putSignerProperty(AwsV4HttpSigner.REGION_NAME, params.region().id()) | ||
| .putSignerProperty(AwsV4HttpSigner.CHUNK_ENCODING_ENABLED, true).build()); | ||
| break; | ||
| default: | ||
| options.add(AuthSchemeOption.builder().schemeId("aws.auth#sigv4") | ||
| .putSignerProperty(AwsV4HttpSigner.SERVICE_SIGNING_NAME, "json-service") | ||
| .putSignerProperty(AwsV4HttpSigner.REGION_NAME, params.region().id()).build()); | ||
| break; | ||
| } | ||
| return Collections.unmodifiableList(options); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 changed it to use real s3 model because why not 🤷🏼♀️ and it may help us catch S3 issues