Skip to content

Remove identity join in async client for endpoint discovery #3947

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

Merged

Conversation

gosar
Copy link
Contributor

@gosar gosar commented Apr 25, 2023

Motivation and Context

Identity resolution is async now. Inside async client we shouldn't join(). This removes earlier use of join() in endpoint discovery logic in async clients, addressing #3829 (comment).

Modifications

Uses combination of thenApply and thenCompose to get from credentials->endpoint->execute.

Testing

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

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 3 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 56 Code Smells

55.8% 55.8% Coverage
2.1% 2.1% Duplication

@gosar gosar marked this pull request as ready for review April 25, 2023 16:25
@gosar gosar requested a review from a team as a code owner April 25, 2023 16:25
@gosar gosar requested a review from millems April 25, 2023 16:27
.addCode(" .flatMap($T::credentialsIdentityProvider)", AwsRequestOverrideConfiguration.class)
.addCode(" .orElseGet(() -> clientConfiguration.option($T.CREDENTIALS_IDENTITY_PROVIDER))",
AwsClientOption.class)
// TODO: avoid join inside async
.addCode(" .resolveIdentity().join().accessKeyId();");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR only changes the handling in AsyncClientClass.java. A join will remain in SyncClientClass.java, though it will change slightly for exception handling - that'll be in a separate PR.

Comment on lines -243 to +245
builder.add("\n\n$T<$T> executeFuture = clientHandler.execute(new $T<$T, $T>()\n",
CompletableFuture.class, executeFutureValueType, ClientExecutionParams.class, requestType, responseType)
builder.add("\n\n$T<$T> executeFuture = ", CompletableFuture.class, executeFutureValueType)
.add(opModel.getEndpointDiscovery() != null ? "endpointFuture.thenCompose(cachedEndpoint -> " : "")
.add("clientHandler.execute(new $T<$T, $T>()\n", ClientExecutionParams.class, requestType, responseType)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only JsonProtocolSpec changed. No other ProtocolSpec has handling in its asyncExecutionHandler for discoveredEndpoint.

@gosar gosar merged commit 04b6730 into feature/master/sra-identity-auth May 2, 2023
@gosar gosar deleted the gosar/sra-ia-identity-async-endpoint branch May 2, 2023 21:20
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.

2 participants