Skip to content

Commit cbce7fb

Browse files
committed
Merge branch 'main' of https://github.com/awslabs/aws-sdk-kotlin into release-readiness-v2
2 parents f29c55f + 452976d commit cbce7fb

File tree

18 files changed

+3841
-323
lines changed

18 files changed

+3841
-323
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "8d7689ef-8acf-4fb3-84b9-712b704725e8",
3+
"type": "feature",
4+
"description": "Add `authSchemePreference` configuration"
5+
}

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## [1.4.72] - 04/28/2025
4+
5+
### Features
6+
* (**acm**) Add support for file-based HTTP domain control validation, available through Amazon CloudFront.
7+
* (**bedrockruntime**) This release adds native h2 support for the bedrock runtime API, the support is only limited to SDKs that support h2 requests natively.
8+
* (**cloudfront**) Add distribution tenant, connection group, and multi-tenant distribution APIs to the CloudFront SDK.
9+
* (**imagebuilder**) Add integration with SSM Parameter Store to Image Builder.
10+
11+
### Documentation
12+
* (**dynamodb**) Doc only update for GSI descriptions.
13+
14+
## [1.4.71] - 04/25/2025
15+
16+
### Features
17+
* (**bedrockruntime**) You can now reference images and documents stored in Amazon S3 when using InvokeModel and Converse APIs with Amazon Nova Lite and Nova Pro. This enables direct integration of S3-stored multimedia assets in your model requests without manual downloading or base64 encoding.
18+
19+
### Documentation
20+
* (**ecs**) Documentation only release for Amazon ECS.
21+
* (**marketplacedeployment**) Doc only update for the AWS Marketplace Deployment Service that fixes several customer-reported issues.
22+
323
## [1.4.70] - 04/24/2025
424

525
### Features

aws-runtime/aws-config/api/aws-config.api

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ public final class aws/sdk/kotlin/runtime/config/AwsSdkSetting {
252252
public final fun getAwsAccountId ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
253253
public final fun getAwsAccountIdEndpointMode ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
254254
public final fun getAwsAppId ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
255+
public final fun getAwsAuthSchemePreference ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
255256
public final fun getAwsConfigFile ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
256257
public final fun getAwsContainerAuthorizationToken ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
257258
public final fun getAwsContainerAuthorizationTokenFile ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
@@ -287,6 +288,11 @@ public final class aws/sdk/kotlin/runtime/config/AwsSdkSettingKt {
287288
public static final fun resolveEndpointUrl (Laws/sdk/kotlin/runtime/config/AwsSdkSetting;Laws/smithy/kotlin/runtime/util/PlatformProvider;Ljava/lang/String;Ljava/lang/String;)Laws/smithy/kotlin/runtime/net/url/Url;
288289
}
289290

291+
public final class aws/sdk/kotlin/runtime/config/auth/ResolveAuthSchemePreferenceKt {
292+
public static final fun resolveAuthSchemePreference (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
293+
public static synthetic fun resolveAuthSchemePreference$default (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
294+
}
295+
290296
public final class aws/sdk/kotlin/runtime/config/checksums/ResolveFlexibleChecksumsConfigKt {
291297
public static final fun resolveRequestChecksumCalculation (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
292298
public static synthetic fun resolveRequestChecksumCalculation$default (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
@@ -499,6 +505,7 @@ public final class aws/sdk/kotlin/runtime/config/profile/AwsConfigurationSource
499505

500506
public final class aws/sdk/kotlin/runtime/config/profile/AwsProfileKt {
501507
public static final fun getAccountIdEndpointMode (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Laws/sdk/kotlin/runtime/config/endpoints/AccountIdEndpointMode;
508+
public static final fun getAuthSchemePreference (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/String;
502509
public static final fun getAwsAccessKeyId (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/String;
503510
public static final fun getAwsSecretAccessKey (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/String;
504511
public static final fun getAwsSessionToken (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/String;

aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/AbstractAwsSdkClientFactory.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package aws.sdk.kotlin.runtime.config
77

88
import aws.sdk.kotlin.runtime.client.AwsSdkClientConfig
9+
import aws.sdk.kotlin.runtime.config.auth.resolveAuthSchemePreference
910
import aws.sdk.kotlin.runtime.config.checksums.resolveRequestChecksumCalculation
1011
import aws.sdk.kotlin.runtime.config.checksums.resolveResponseChecksumValidation
1112
import aws.sdk.kotlin.runtime.config.compression.resolveDisableRequestCompression
@@ -26,6 +27,7 @@ import aws.smithy.kotlin.runtime.client.config.ClientSettings
2627
import aws.smithy.kotlin.runtime.client.config.CompressionClientConfig
2728
import aws.smithy.kotlin.runtime.client.config.HttpChecksumConfig
2829
import aws.smithy.kotlin.runtime.config.resolve
30+
import aws.smithy.kotlin.runtime.http.auth.HttpAuthConfig
2931
import aws.smithy.kotlin.runtime.telemetry.TelemetryConfig
3032
import aws.smithy.kotlin.runtime.telemetry.TelemetryProvider
3133
import aws.smithy.kotlin.runtime.telemetry.trace.withSpan
@@ -105,6 +107,10 @@ public abstract class AbstractAwsSdkClientFactory<
105107
config.responseChecksumValidation ?: resolveResponseChecksumValidation(platform, profile)
106108
}
107109

110+
if (config is HttpAuthConfig.Builder) {
111+
config.authSchemePreference = config.authSchemePreference ?: resolveAuthSchemePreference(platform, profile)
112+
}
113+
108114
finalizeConfig(builder)
109115
finalizeEnvironmentalConfig(builder, sharedConfig, profile)
110116
}

aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/AwsSdkSetting.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ public object AwsSdkSetting {
230230
*/
231231
public val AwsResponseChecksumValidation: EnvironmentSetting<ResponseHttpChecksumConfig> =
232232
enumEnvSetting<ResponseHttpChecksumConfig>("aws.responseChecksumValidation", "AWS_RESPONSE_CHECKSUM_VALIDATION")
233+
234+
/**
235+
* Configures an ordered preference of auth schemes
236+
*/
237+
public val AwsAuthSchemePreference: EnvironmentSetting<String> = strEnvSetting("aws.authSchemePreference", "AWS_AUTH_SCHEME_PREFERENCE")
233238
}
234239

235240
/**
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package aws.sdk.kotlin.runtime.config.auth
2+
3+
import aws.sdk.kotlin.runtime.InternalSdkApi
4+
import aws.sdk.kotlin.runtime.config.AwsSdkSetting
5+
import aws.sdk.kotlin.runtime.config.profile.AwsProfile
6+
import aws.sdk.kotlin.runtime.config.profile.authSchemePreference
7+
import aws.smithy.kotlin.runtime.auth.AuthSchemeId
8+
import aws.smithy.kotlin.runtime.config.resolve
9+
import aws.smithy.kotlin.runtime.util.LazyAsyncValue
10+
import aws.smithy.kotlin.runtime.util.PlatformProvider
11+
12+
@InternalSdkApi
13+
public suspend fun resolveAuthSchemePreference(platform: PlatformProvider = PlatformProvider.System, profile: LazyAsyncValue<AwsProfile>): List<AuthSchemeId> {
14+
val content = AwsSdkSetting.AwsAuthSchemePreference.resolve(platform) ?: profile.get().authSchemePreference
15+
16+
return content
17+
?.split(",")
18+
?.map { it.trim() }
19+
?.filter { it.isNotEmpty() }
20+
?.map(::AuthSchemeId)
21+
?.toList()
22+
?: emptyList()
23+
}

aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsProfile.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import aws.sdk.kotlin.runtime.config.endpoints.AccountIdEndpointMode
1111
import aws.smithy.kotlin.runtime.client.config.RequestHttpChecksumConfig
1212
import aws.smithy.kotlin.runtime.client.config.ResponseHttpChecksumConfig
1313
import aws.smithy.kotlin.runtime.client.config.RetryMode
14+
import aws.smithy.kotlin.runtime.http.auth.AuthScheme
1415
import aws.smithy.kotlin.runtime.net.url.Url
1516

1617
/**
@@ -169,6 +170,13 @@ public val AwsProfile.requestChecksumCalculation: RequestHttpChecksumConfig?
169170
public val AwsProfile.responseChecksumValidation: ResponseHttpChecksumConfig?
170171
get() = getEnumOrNull<ResponseHttpChecksumConfig>("response_checksum_validation")
171172

173+
/**
174+
* The ordered preference of [AuthScheme] that this client will use
175+
*/
176+
@InternalSdkApi
177+
public val AwsProfile.authSchemePreference: String?
178+
get() = getOrNull("auth_scheme_preference")
179+
172180
/**
173181
* Specifies a named EC2 instance profile to use which allows bypassing auto-discovery
174182
*/
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
package aws.sdk.kotlin.runtime.config.auth
6+
7+
import aws.sdk.kotlin.runtime.config.profile.AwsConfigurationSource
8+
import aws.sdk.kotlin.runtime.config.profile.FileType
9+
import aws.sdk.kotlin.runtime.config.profile.parse
10+
import aws.sdk.kotlin.runtime.config.profile.toSharedConfig
11+
import aws.smithy.kotlin.runtime.auth.AuthSchemeId
12+
import aws.smithy.kotlin.runtime.telemetry.logging.Logger
13+
import aws.smithy.kotlin.runtime.util.TestPlatformProvider
14+
import aws.smithy.kotlin.runtime.util.asyncLazy
15+
import kotlinx.coroutines.test.runTest
16+
import kotlin.test.Test
17+
import kotlin.test.assertEquals
18+
19+
class ResolveAuthSchemePreferenceTest {
20+
@Test
21+
fun testProfile() = runTest {
22+
assertEquals(
23+
AuthSchemeId("sigv4"),
24+
testResolveAuthSchemePreference(
25+
profileContent = """
26+
[default]
27+
auth_scheme_preference = sigv4
28+
""".trimIndent(),
29+
).single(),
30+
)
31+
}
32+
33+
@Test
34+
fun testEnvironment() = runTest {
35+
// Environment takes precedence over profile
36+
assertEquals(
37+
AuthSchemeId("sigv4a"),
38+
testResolveAuthSchemePreference(
39+
env = mapOf("AWS_AUTH_SCHEME_PREFERENCE" to "sigv4a"),
40+
profileContent = """
41+
[default]
42+
auth_scheme_preference = sigv4
43+
""".trimIndent(),
44+
).single(),
45+
)
46+
}
47+
48+
@Test
49+
fun testSystemProperties() = runTest {
50+
// System properties take precedence over environment and profile
51+
assertEquals(
52+
AuthSchemeId("httpBearerAuth"),
53+
testResolveAuthSchemePreference(
54+
env = mapOf("AWS_AUTH_SCHEME_PREFERENCE" to "sigv4a"),
55+
sysProps = mapOf("aws.authSchemePreference" to "httpBearerAuth"),
56+
profileContent = """
57+
[default]
58+
auth_scheme_preference = sigv4
59+
""".trimIndent(),
60+
).single(),
61+
)
62+
}
63+
64+
@Test
65+
fun testResolveMultipleSchemes() = runTest {
66+
assertEquals(
67+
listOf(AuthSchemeId("httpBearerAuth"), AuthSchemeId("sigv4a"), AuthSchemeId("sigv4")),
68+
testResolveAuthSchemePreference(
69+
env = mapOf("AWS_AUTH_SCHEME_PREFERENCE" to "httpBearerAuth, sigv4a, sigv4"),
70+
),
71+
)
72+
}
73+
74+
@Test
75+
fun testIgnoreWhitespace() = runTest {
76+
assertEquals(
77+
listOf(AuthSchemeId("httpBearerAuth"), AuthSchemeId("sigv4a")),
78+
testResolveAuthSchemePreference(
79+
env = mapOf("AWS_AUTH_SCHEME_PREFERENCE" to "httpBearerAuth , sigv4a "),
80+
),
81+
)
82+
}
83+
84+
@Test
85+
fun testDontFailOnInvalidSchemes() = runTest {
86+
assertEquals(
87+
listOf(AuthSchemeId("httpBearerAuth"), AuthSchemeId("whatIsThisScheme"), AuthSchemeId("sigv4")),
88+
testResolveAuthSchemePreference(
89+
env = mapOf("AWS_AUTH_SCHEME_PREFERENCE" to "httpBearerAuth, whatIsThisScheme, sigv4"),
90+
),
91+
)
92+
}
93+
94+
private suspend fun testResolveAuthSchemePreference(
95+
env: Map<String, String> = mapOf(),
96+
sysProps: Map<String, String> = mapOf(),
97+
profileContent: String = "",
98+
): List<AuthSchemeId> {
99+
val platform = TestPlatformProvider(env = env, props = sysProps)
100+
val source = AwsConfigurationSource("default", "", "")
101+
val profile = asyncLazy {
102+
parse(Logger.None, FileType.CONFIGURATION, profileContent).toSharedConfig(source).activeProfile
103+
}
104+
105+
return resolveAuthSchemePreference(platform, profile)
106+
}
107+
}

codegen/aws-sdk-codegen/src/main/resources/aws/sdk/kotlin/codegen/endpoints.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21417,6 +21417,7 @@
2141721417
"ap-southeast-2" : { },
2141821418
"ap-southeast-3" : { },
2141921419
"ap-southeast-4" : { },
21420+
"ap-southeast-7" : { },
2142021421
"ca-central-1" : { },
2142121422
"ca-west-1" : { },
2142221423
"eu-central-1" : { },
@@ -21430,6 +21431,7 @@
2143021431
"il-central-1" : { },
2143121432
"me-central-1" : { },
2143221433
"me-south-1" : { },
21434+
"mx-central-1" : { },
2143321435
"sa-east-1" : { },
2143421436
"us-east-1" : {
2143521437
"variants" : [ {
@@ -36528,6 +36530,11 @@
3652836530
"us-iso-west-1" : { }
3652936531
}
3653036532
},
36533+
"batch" : {
36534+
"endpoints" : {
36535+
"us-iso-east-1" : { }
36536+
}
36537+
},
3653136538
"bedrock" : {
3653236539
"endpoints" : {
3653336540
"bedrock-runtime-us-iso-east-1" : {
@@ -37658,6 +37665,12 @@
3765837665
} ]
3765937666
}
3766037667
}
37668+
},
37669+
"xray" : {
37670+
"endpoints" : {
37671+
"us-iso-east-1" : { },
37672+
"us-iso-west-1" : { }
37673+
}
3766137674
}
3766237675
}
3766337676
}, {
@@ -37742,6 +37755,11 @@
3774237755
"us-isob-east-1" : { }
3774337756
}
3774437757
},
37758+
"batch" : {
37759+
"endpoints" : {
37760+
"us-isob-east-1" : { }
37761+
}
37762+
},
3774537763
"budgets" : {
3774637764
"endpoints" : {
3774737765
"aws-iso-b-global" : {

0 commit comments

Comments
 (0)