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

Replace AWSCredentialProvider with AwsCredentialProvider #6

Merged
merged 4 commits into from
Sep 23, 2024

Conversation

ethkatnic
Copy link
Owner

Replace AWSCredentialProvider with AwsCredentialProvider to be consistent with SDK v2 naming convention.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.


private String processKey(Map.Entry<Object, Object> e) {
String key = (String) e.getKey();
// utilsBean expects key like 'awsCredentialsProvider' to call bean setter setAwsCredentialsProvider
Copy link
Owner Author

@ethkatnic ethkatnic Sep 10, 2024

Choose a reason for hiding this comment

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

BeanUtilsBean automatically processes the config keys and tries to find a corresponding setter for each. Previously, key: AWSCredentialsProvider mapped to setAWSCredentialsProvider properly.
With new key key: AwsCredentialsProvider, BeanUtilsBean fails to find a setter for this, as setter setAwsCredentialsProvider expects a key like awsCredentialsProvider. Because of this, key: AwsCredentialsProvider never finds a valid setter, no matter what we name the setAwsCredentialsProvider fn.

processKey ensures that any config string that starts with case insensitive awscredentialsprovider__ gets replaced with awsCredentialsProvider__, so the BeanUtil can find the corresponding setAwsCredentialsProvider__ setter.

This should properly map multilang.properties config strings so all of the following reach the setter...

AWSCredentialsProvider / AWSCredentialsProviderDynamoDB / AWSCredentialsProviderCloudWatch
AwsCredentialsProvider / AwsCredentialsProviderDynamoDB / AwsCredentialsProviderCloudWatch
awsCredentialsProvider / awsCredentialsProviderDynamoDB / awsCredentialsProviderCloudWatch

etc...

@ethkatnic ethkatnic marked this pull request as ready for review September 10, 2024 19:52
Comment on lines 114 to 116

private String processKey(Map.Entry<Object, Object> e) {
String key = (String) e.getKey();

Choose a reason for hiding this comment

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

do we have a test for this?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Changed to default access modifier to allow testing. Added a few tests for expected keys.

@@ -8,30 +8,30 @@ This document should help multilang customers configure a suitable `CredentialPr

## Sample Provider Configuration

In a Properties file, an `AWSCredentialsProperty` configuration might look like:
In a Properties file, an `AwsCredentialsProperty` configuration might look like:

Choose a reason for hiding this comment

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

Let's call out these are v2 credential providers, and maybe provide a link to the public doc that has a list of v2 providers

Copy link
Owner Author

Choose a reason for hiding this comment

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

Added documentation a few lines below.

@ethkatnic ethkatnic merged commit fa361ca into multilang-sdk-upgrade Sep 23, 2024
@ethkatnic ethkatnic deleted the multilang-naming-convention-change branch September 23, 2024 20:05
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