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

Lets AsyncSignedRequest and SignedRequest implement CopyableBuilder #4607

Merged
merged 4 commits into from
Nov 1, 2023

Conversation

cenedhryn
Copy link
Contributor

Motivation and Context

In the new signing flow, the input to the signer is a SignRequest (AsyncSignRequest) and the output is a SignedRequest (AsyncSignedRequest). SignRequest implements CopyableBuilder which means it supports toBuilder and copy, but SignedRequest does not. For use cases where a SignedRequest needs modification, for instance to manipulate headers in the SdkHttpRequest within the SignedRequest, it should implement this interface

Modifications

  • Added changes to SignedRequest / AsyncSignedRequest to implement CopyableBuilder
  • Removed the anonymous implementation of SignedRequest / AsyncSignedRequest in the signer of DefaultNoAuthAuthSchema and instead lets that (anonymous) signer use the default builders
  • Added unit tests for SignedRequest / AsyncSignedRequest.

Testing

Unit tested

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@cenedhryn cenedhryn requested a review from a team as a code owner October 17, 2023 23:43
Comment on lines 23 to 24
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary import

@@ -15,6 +15,7 @@

package software.amazon.awssdk.http.auth.spi.internal.signer;

import java.util.Objects;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary import

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I missed running checkstyle locally, fixing...

Comment on lines 433 to 436
List<String> concreteClassBuilderFields = builderFields.get(concreteClass);
if (concreteClassBuilderFields == null) {
concreteClassBuilderFields = new ArrayList<>();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getOrDefault?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'd be nice(r)

@cenedhryn cenedhryn enabled auto-merge (squash) November 1, 2023 17:30
@cenedhryn cenedhryn merged commit 0a308d3 into master Nov 1, 2023
12 of 13 checks passed
Copy link

sonarcloud bot commented Nov 1, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 31 Code Smells

82.8% 82.8% Coverage
2.6% 2.6% Duplication

@cenedhryn cenedhryn deleted the salande/signed-request-copyable branch November 1, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants