File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed
client-runtime/aws-client-rt/common
src/aws/sdk/kotlin/runtime/endpoint/internal
test/aws/sdk/kotlin/runtime/endpoint/internal Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -108,10 +108,10 @@ internal fun Partition.resolveEndpoint(region: String): Endpoint? {
108108}
109109
110110private fun Partition.endpointDefinitionForRegion (region : String ): EndpointDefinition {
111- val match = if ( ! isRegionalized) {
112- endpoints[partitionEndpoint ]
113- } else {
114- endpoints[region]
111+ val match = when {
112+ endpoints.containsKey(region) -> endpoints[region ]
113+ ! isRegionalized -> endpoints[partitionEndpoint]
114+ else -> null
115115 }
116116
117117 // return a matching definition or create an empty one that will be used for
Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ val testPartitions = listOf(
4848 " partition" to EndpointDefinition (
4949 hostname = " some-global-thing.amazonaws.cn" ,
5050 credentialScope = CredentialScope (region = " cn-east-1" )
51+ ),
52+ " fips-partition" to EndpointDefinition (
53+ hostname = " some-global-thing-fips.amazonaws.cn" ,
54+ credentialScope = CredentialScope (region = " cn-east-1" )
5155 )
5256 )
5357 ),
@@ -109,7 +113,27 @@ class EndpointsTest {
109113 signingRegion = " eu-west-1" ,
110114 signingName = " foo"
111115 )
112- )
116+ ),
117+ ResolveTest (
118+ description = " specified partition endpoint" ,
119+ region = " partition" ,
120+ Endpoint (
121+ hostname = " some-global-thing.amazonaws.cn" ,
122+ protocol = " https" ,
123+ signingRegion = " cn-east-1" ,
124+ signingName = " foo"
125+ )
126+ ),
127+ ResolveTest (
128+ description = " fips partition endpoint" ,
129+ region = " fips-partition" ,
130+ Endpoint (
131+ hostname = " some-global-thing-fips.amazonaws.cn" ,
132+ protocol = " https" ,
133+ signingRegion = " cn-east-1" ,
134+ signingName = " foo"
135+ )
136+ ),
113137 )
114138
115139 @Test
You can’t perform that action at this time.
0 commit comments