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

[#367] Enhanced multi-lang AWSCredentialsProvider=... decoder and c… #1184

Merged
merged 3 commits into from
Aug 7, 2023

Conversation

stair-aws
Copy link
Contributor

Issue #, if available:
#367

Description of changes:
[#367] Enhanced multi-lang AWSCredentialsProvider=... decoder and construction.

mvn clean verify yields:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Amazon Kinesis Client Library 2.5.2-SNAPSHOT:
[INFO] 
[INFO] Amazon Kinesis Client Library ...................... SUCCESS [  1.018 s]
[INFO] Amazon Kinesis Client Library for Java ............. SUCCESS [14:57 min]
[INFO] amazon-kinesis-client-multilang .................... SUCCESS [ 13.918 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15:12 min
[INFO] Finished at: 2023-08-03T15:04:21-04:00

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

@stair-aws stair-aws added enhancement v2.x Issues related to the 2.x version labels Aug 3, 2023
@stair-aws
Copy link
Contributor Author

With this commit, KCL multi-lang customers should have greater control over the STS provider. For example, a CredentialsProvider string might change from:

AWSCredentialsProvider = STSAssumeRoleSessionCredentialsProvider|<arn>|<sessionName>

... to:

AWSCredentialsProvider = KclSTSAssumeRoleSessionCredentialsProvider|<arn>|<sessionName>|externalId=<eid>

... which satisfies the external id request (issue #367).

Additionally, STS-via-VPC should be accessible via:

AWSCredentialsProvider = KclSTSAssumeRoleSessionCredentialsProvider|<arn>|<sessionName>|endpoint=<url>^<region>

externalId= and endpoint= can also co-exist, in any order. Please see NestedPropertyKeys enum for further details.

@stair-aws stair-aws force-pushed the creds-provider branch 2 times, most recently from 5389a0f to c0be0cb Compare August 3, 2023 21:46
…r and construction.

+ added support for external ids (issue awslabs#367)
+ added support for endpoint+region (e.g., STS via VPC)
Copy link
Contributor

@akidambisrinivasan akidambisrinivasan left a comment

Choose a reason for hiding this comment

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

Looks good

+ added `ENDPOINT_REGION` nested key for a simpler Cx experience
+ deduplicated, and improved, logic w.r.t. CredentialsProvider
construction to NOT swallow Exceptions
@stair-aws
Copy link
Contributor Author

A new simpler option now exists for STS-via-VPC:

AWSCredentialsProvider = KclSTSAssumeRoleSessionCredentialsProvider|<arn>|<sessionName>|endpointRegion=<region>

With this, a Cx only needs to provide the region (e.g., |endpointRegion=us-east-1), and the SDK client will determine the endpoint URL on its own. If Cx need to specify the endpoint and region, the |endpoint=<url>^<region> optional parameter provides more explicit control.

@akidambisrinivasan
Copy link
Contributor

I have a general question, how can customers find out all the supported property kv pairs that can provided to MultiLangDaemon and what the valid values are? I see your detailed javadoc for NestedPropertyKey, but I as a customer would not know to look there unless I read the code. I see MultiLangDaemon has javadoc for the minimum properties that must be passed in.
At the minimum we should add a comment there to look at NestedPropertyKey javadoc to know how to format the value of the AWSCredentialsProvider property.

@@ -0,0 +1,93 @@
# The script that abides by the multi-language protocol. This script will
Copy link
Contributor

Choose a reason for hiding this comment

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

If this used only for test, can it be in src/test/resources?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely, and the correct thing to do; was an oversight in folder assignment. Thanks!

@@ -200,4 +198,9 @@ public void testPropertyValidation() {
}
}

@Test
public void testActualPropertiesFile() throws Exception {
new MultiLangDaemonConfig(FILENAME);
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this testing? Just constructor works fine?
Maybe we want to assert constructed instance is not null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is this testing? Just constructor works fine?

I added Javadoc. Snippet: "catch any issues which might arise if there is a discrepancy between reality and mocking".

Maybe we want to assert constructed instance is not null?

assertNotNull(...) gets marked as redundant because the construction is guaranteed non-null iff an Exception is not thrown.

Copy link
Contributor

Choose a reason for hiding this comment

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

But if you dont assert and the test throws exception it may not show as failed, isnt it?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it does mark the test failed, so this is okay.

@stair-aws
Copy link
Contributor Author

#1184 (comment)

I have a general question, how can customers find out all the supported property kv pairs that can provided to MultiLangDaemon and what the valid values are? I see your detailed javadoc for NestedPropertyKey, but I as a customer would not know to look there unless I read the code. I see MultiLangDaemon has javadoc for the minimum properties that must be passed in.
At the minimum we should add a comment there to look at NestedPropertyKey javadoc to know how to format the value of the AWSCredentialsProvider property.

Yes, discoverability is an issue. This will be addressed by the following:

  1. WIP, PR pending: provide a README-esque doc in this KCL repo
    • PR purposefully kept separate soas not to slow, or impede, the approval+merge of this PR
  2. WIP, PR pending: point to this new documentation in https://github.com/awslabs/amazon-kinesis-client-python/
    • We can propagate outward to other KCL multilang variants, but Python is the need-now
  3. Being explored: work w/ the AWS docs team to author a top-level doc (e.g., https://docs.aws.amazon.com/streams/latest/dev/kcl-migration.html)

If you have further questions/suggestions about the discovery process, let's bring that conversation internal so I can share more details. I believe we're aligned in wanting to equip our KCL Cx to self-service (and make it easy for Cx to contribute new use cases).

@stair-aws stair-aws merged commit 2f4ff65 into awslabs:master Aug 7, 2023
1 check passed
@stair-aws stair-aws deleted the creds-provider branch August 7, 2023 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement multi lang daemon v2.x Issues related to the 2.x version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants