Skip to content

Making client suppliers composable #163

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
merged 4 commits into from
Mar 16, 2020
Merged

Making client suppliers composable #163

merged 4 commits into from
Mar 16, 2020

Conversation

WesleyRosenblum
Copy link
Contributor

Description of changes:

Making the Aws KMS client suppliers composable to match the design of the Python and JS ESDKs

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

@@ -73,10 +72,10 @@ public MultiRegionRecordPusherExample(final Region[] regions, final String kmsAl
.build());

keyrings.add(StandardKeyrings.awsKmsBuilder()
.awsKmsClientSupplier(AwsKmsClientSupplier.builder()
.awsKmsClientSupplier(new AllowRegionsAwsKmsClientSupplier(Collections.singleton(region.getName()),
Copy link
Contributor

Choose a reason for hiding this comment

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

You have all of these nice builders, why is this one new?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seemed like it might be overkill to have a builder here, but I can make one too. I wasn't really satisfied with the mix of builders and constructors either

Copy link
Contributor

@SalusaSecondus SalusaSecondus left a comment

Choose a reason for hiding this comment

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

Do we need to worry about thread-safety?


private AWSCredentialsProvider credentialsProvider;
private ClientConfiguration clientConfiguration;
private final Map<String, AWSKMS> clientsCache = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't look to be thread-safe. Should this be a ConcurrentHashMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I'll make it ConcurrentHashMap. The RegionalClientSupplier that MKPs use also used a ConcurrentHashMap

Copy link
Contributor

@SalusaSecondus SalusaSecondus left a comment

Choose a reason for hiding this comment

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

LGTM

@WesleyRosenblum WesleyRosenblum merged commit c60ad59 into keyring Mar 16, 2020
@WesleyRosenblum WesleyRosenblum deleted the clientsupplier branch April 2, 2020 18:32
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