Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package aws.sdk.kotlin.codegen.endpoints

object AwsBuiltins {
const val ACCOUNT_ID = "AWS::Auth::AccountId"
const val ACCOUNT_ID_ENDPOINT_MODE = "AWS::Auth::AccountIdEndpointMode"
const val USE_FIPS = "AWS::UseFIPS"
const val USE_DUAL_STACK = "AWS::UseDualStack"
const val S3_ACCELERATE = "AWS::S3::Accelerate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

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.

it.defaultName(),
AccountIdEndpointBuiltinCustomization.AccountIdEndpointModeProp.propertyName,
)
}
}
}
}
Expand Down
Loading