From 8c9e46b1037e2da05e5ea63442df1414092d3657 Mon Sep 17 00:00:00 2001 From: Matas Lauzadis Date: Tue, 18 Jun 2024 17:09:23 -0500 Subject: [PATCH] Support `implicitGlobalRegion` --- .../aws/sdk/kotlin/runtime/endpoint/functions/Functions.kt | 2 ++ .../sdk/kotlin/runtime/endpoint/functions/FunctionsTest.kt | 2 ++ .../aws/sdk/kotlin/codegen/endpoints/PartitionsGenerator.kt | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/aws-runtime/aws-endpoint/common/src/aws/sdk/kotlin/runtime/endpoint/functions/Functions.kt b/aws-runtime/aws-endpoint/common/src/aws/sdk/kotlin/runtime/endpoint/functions/Functions.kt index 2dbdb62828d..6493cc1d4d1 100644 --- a/aws-runtime/aws-endpoint/common/src/aws/sdk/kotlin/runtime/endpoint/functions/Functions.kt +++ b/aws-runtime/aws-endpoint/common/src/aws/sdk/kotlin/runtime/endpoint/functions/Functions.kt @@ -67,6 +67,7 @@ public data class PartitionConfig( public val dualStackDnsSuffix: String? = null, public val supportsFIPS: Boolean? = null, public val supportsDualStack: Boolean? = null, + public val implicitGlobalRegion: String? = null, ) { public fun mergeWith(other: PartitionConfig): PartitionConfig = PartitionConfig( @@ -75,6 +76,7 @@ public data class PartitionConfig( other.dualStackDnsSuffix ?: dualStackDnsSuffix, other.supportsFIPS ?: supportsFIPS, other.supportsDualStack ?: supportsDualStack, + other.implicitGlobalRegion ?: implicitGlobalRegion, ) } diff --git a/aws-runtime/aws-endpoint/common/test/aws/sdk/kotlin/runtime/endpoint/functions/FunctionsTest.kt b/aws-runtime/aws-endpoint/common/test/aws/sdk/kotlin/runtime/endpoint/functions/FunctionsTest.kt index f1abd69f4be..a2d35f7fc23 100644 --- a/aws-runtime/aws-endpoint/common/test/aws/sdk/kotlin/runtime/endpoint/functions/FunctionsTest.kt +++ b/aws-runtime/aws-endpoint/common/test/aws/sdk/kotlin/runtime/endpoint/functions/FunctionsTest.kt @@ -100,6 +100,7 @@ class FunctionsTest { "us-west-2" to PartitionConfig(), "aws-global" to PartitionConfig( dnsSuffix = "override.amazonaws.com", + implicitGlobalRegion = "implicit-global-region" ), ), baseConfig = PartitionConfig( @@ -144,6 +145,7 @@ class FunctionsTest { dualStackDnsSuffix = "api.aws", supportsFIPS = true, supportsDualStack = true, + implicitGlobalRegion = "implicit-global-region" ), actual = partition(testPartitions, "aws-global"), ) diff --git a/codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/endpoints/PartitionsGenerator.kt b/codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/endpoints/PartitionsGenerator.kt index b70fe275d72..6a8cd4aef86 100644 --- a/codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/endpoints/PartitionsGenerator.kt +++ b/codegen/aws-sdk-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/endpoints/PartitionsGenerator.kt @@ -81,6 +81,9 @@ class PartitionsGenerator( regionConfig.getBooleanMember("supportsDualStack").ifPresent { write("supportsDualStack = #L,", it.value) } + regionConfig.getStringMember("implicitGlobalRegion").ifPresent { + write("implicitGlobalRegion = #S,", it.value) + } } } } @@ -90,6 +93,7 @@ class PartitionsGenerator( write("dualStackDnsSuffix = #S,", baseConfig.expectStringMember("dualStackDnsSuffix").value) write("supportsFIPS = #L,", baseConfig.expectBooleanMember("supportsFIPS").value) write("supportsDualStack = #L,", baseConfig.expectBooleanMember("supportsDualStack").value) + write("implicitGlobalRegion = #S,", baseConfig.expectStringMember("implicitGlobalRegion").value) } } }