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

fix: account ID based endpoints #1535

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

fix: account ID based endpoints #1535

wants to merge 5 commits into from

Conversation

0marperez
Copy link
Contributor

Issue #

N/A

Description of changes

Routes accountIdEndpointMode to AWS built in endpoint parameters

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

@0marperez 0marperez added the no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly. label Feb 20, 2025
Copy link

A new generated diff is ready to view.

This comment has been minimized.

@0marperez 0marperez marked this pull request as ready for review February 20, 2025 14:37
@0marperez 0marperez requested a review from a team as a code owner February 20, 2025 14:37
@@ -106,6 +106,14 @@ fun renderBindAwsBuiltins(ctx: ProtocolGenerator.GenerationContext, writer: Kotl
AwsRuntimeTypes.Config.Endpoints.resolveAccountId,
AccountIdEndpointBuiltinCustomization.AccountIdEndpointModeProp.propertyName,
)

AwsBuiltins.ACCOUNT_ID_ENDPOINT_MODE -> {
Copy link
Member

Choose a reason for hiding this comment

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

The comment at the top of this function says "In practice, all of these values are sourced from the client config."

Is that still true? Isn't AccountId being sourced exclusively from endpoint rules in your manual test cases?

Copy link
Contributor Author

@0marperez 0marperez Feb 20, 2025

Choose a reason for hiding this comment

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

Is that still true? Isn't AccountId being sourced exclusively from endpoint rules in your manual test cases?

Account ID isn't being sourced exclusively from endpoint rules. It's sourced from client config as a built in and from the operation context params using JMESPath.

The endpoint rules use both values for different conditions


AwsBuiltins.ACCOUNT_ID_ENDPOINT_MODE -> {
writer.write(
"#L = config.#L.toString().lowercase()", // DDB endpoint rules assume lowercase value
Copy link
Member

Choose a reason for hiding this comment

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

Remove comment about DDB since this rule applies for all AWS endpoints

Copy link
Contributor

@ianbotsf ianbotsf left a comment

Choose a reason for hiding this comment

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

Correctness: Please add unit test(s)


AwsBuiltins.ACCOUNT_ID_ENDPOINT_MODE -> {
writer.write(
"#L = config.#L.toString().lowercase()", // DDB endpoint rules assume lowercase value
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: DDB isn't adding any special constraints here. The spec says:

The value will be propagated to endpoint rules as the built-in endpoint parameter AWS::Auth::AccountIdEndpointMode. This setting is an enum with the values required, disabled and preferred.

We should tweak this comment so that we don't get confused later about which services require lowercase values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can just remove the comment in that case

Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine to mention that the enum values are expected to be lowercase

Copy link
Contributor

Choose a reason for hiding this comment

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

Especially since it's different from how we treat basically all other enums in Kotlin.

Copy link

A new generated diff is ready to view.

This comment has been minimized.

Copy link

A new generated diff is ready to view.

Copy link

Affected Artifacts

Changed in size
Artifact Pull Request (bytes) Latest Release (bytes) Delta (bytes) Delta (percentage)
dynamodb-jvm.jar 3,434,655 3,434,508 147 0.00%
dynamodb-jvm.jar closure 11,294,716 11,294,567 149 0.00%
rds-jvm.jar 7,411,072 7,411,066 6 0.00%
applicationsignals-jvm.jar closure 8,764,747 8,764,740 7 0.00%
applicationautoscaling-jvm.jar closure 8,872,865 8,872,859 6 0.00%
mediaconnect-jvm.jar closure 10,375,093 10,375,087 6 0.00%
rds-jvm.jar closure 15,271,133 15,271,125 8 0.00%
sagemaker-jvm.jar closure 27,675,075 27,676,734 -1,659 -0.01%
sagemaker-jvm.jar 19,815,014 19,816,675 -1,661 -0.01%
codebuild-jvm.jar closure 10,377,986 10,386,579 -8,593 -0.08%
codebuild-jvm.jar 2,517,925 2,526,520 -8,595 -0.34%
workspacesweb-jvm.jar closure 9,886,720 9,938,061 -51,341 -0.52%
workspacesweb-jvm.jar 2,026,659 2,078,002 -51,343 -2.47%

Copy link

A new generated diff is ready to view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a changelog entry isn't required for a pull request. Use sparingly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants