Skip to content

Commit 575f9d1

Browse files
authored
chore: v1.5-main sync from main (#1651)
1 parent fab5ee2 commit 575f9d1

File tree

56 files changed

+642
-585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+642
-585
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "05ac561b-963f-4953-bb4f-1fc19fc1207c",
3+
"type": "feature",
4+
"description": "Add `regionProvider` property to client config",
5+
"issues": [
6+
"awslabs/aws-sdk-kotlin#1478"
7+
]
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"id": "49af01b8-6fed-4add-ace0-9f027e83425a",
3+
"type": "feature",
4+
"description": "⚠️ **IMPORTANT**: Refactor endpoint discoverer classes into interfaces so custom implementations may be provided",
5+
"issues": [
6+
"awslabs/aws-sdk-kotlin#1413"
7+
],
8+
"requiresMinorVersionBump": true
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"id": "929f0e2a-3af9-4f73-9f1b-b4e97f91f0db",
3+
"type": "feature",
4+
"description": "⚠️ **IMPORTANT**: Add support for enabling/disabling endpoint discovery via [standard cross-SDK config mechanisms](https://docs.aws.amazon.com/sdkref/latest/guide/feature-endpoint-discovery.html)",
5+
"issues": [
6+
"awslabs/aws-sdk-kotlin#1413"
7+
],
8+
"requiresMinorVersionBump": true
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "e6515649-dab5-4be9-b4b4-b289369960d5",
3+
"type": "bugfix",
4+
"description": "Favor `endpointUrl` instead of endpoint discovery if both are provided",
5+
"issues": [
6+
"awslabs/aws-sdk-kotlin#1413"
7+
]
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "f56de67b-6779-4296-a7d0-dcdefa0d4acd",
3+
"type": "feature",
4+
"description": "Upgrade to Kotlin 2.2.0"
5+
}

.github/workflows/merge-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ jobs:
1414
uses: awslabs/aws-kotlin-repo-tools/.github/actions/merge-main@main
1515
with:
1616
ci-user-pat: ${{ secrets.CI_USER_PAT }}
17-
exempt-branches: # Add any if required
17+
exempt-branches: # Add any if required

.github/workflows/sync-mirror.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
source_repo: "https://aws-sdk-kotlin-ci:${{ secrets.CI_USER_PAT }}@github.com/awslabs/aws-sdk-kotlin.git"
2020
source_branch: "main"
2121
destination_repo: "https://aws-sdk-kotlin-ci:${{ secrets.CI_USER_PAT }}@github.com/awslabs/private-aws-sdk-kotlin-staging.git"
22-
destination_branch: "main"
22+
destination_branch: "main"

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

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,27 @@ public abstract class aws/sdk/kotlin/runtime/config/AbstractAwsSdkClientFactory
246246
public static synthetic fun fromEnvironment$default (Laws/sdk/kotlin/runtime/config/AbstractAwsSdkClientFactory;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
247247
}
248248

249+
public abstract interface class aws/sdk/kotlin/runtime/config/AwsSdkClientConfig : aws/smithy/kotlin/runtime/client/SdkClientConfig {
250+
public abstract fun getApplicationId ()Ljava/lang/String;
251+
public abstract fun getRegion ()Ljava/lang/String;
252+
public abstract fun getRegionProvider ()Laws/smithy/kotlin/runtime/client/region/RegionProvider;
253+
public abstract fun getUseDualStack ()Z
254+
public abstract fun getUseFips ()Z
255+
}
256+
257+
public abstract interface class aws/sdk/kotlin/runtime/config/AwsSdkClientConfig$Builder {
258+
public abstract fun getApplicationId ()Ljava/lang/String;
259+
public abstract fun getRegion ()Ljava/lang/String;
260+
public abstract fun getRegionProvider ()Laws/smithy/kotlin/runtime/client/region/RegionProvider;
261+
public abstract fun getUseDualStack ()Ljava/lang/Boolean;
262+
public abstract fun getUseFips ()Ljava/lang/Boolean;
263+
public abstract fun setApplicationId (Ljava/lang/String;)V
264+
public abstract fun setRegion (Ljava/lang/String;)V
265+
public abstract fun setRegionProvider (Laws/smithy/kotlin/runtime/client/region/RegionProvider;)V
266+
public abstract fun setUseDualStack (Ljava/lang/Boolean;)V
267+
public abstract fun setUseFips (Ljava/lang/Boolean;)V
268+
}
269+
249270
public final class aws/sdk/kotlin/runtime/config/AwsSdkSetting {
250271
public static final field INSTANCE Laws/sdk/kotlin/runtime/config/AwsSdkSetting;
251272
public final fun getAwsAccessKeyId ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
@@ -263,6 +284,7 @@ public final class aws/sdk/kotlin/runtime/config/AwsSdkSetting {
263284
public final fun getAwsEc2MetadataDisabled ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
264285
public final fun getAwsEc2MetadataServiceEndpoint ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
265286
public final fun getAwsEc2MetadataServiceEndpointMode ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
287+
public final fun getAwsEndpointDiscoveryEnabled ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
266288
public final fun getAwsEndpointUrl ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
267289
public final fun getAwsExecutionEnv ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
268290
public final fun getAwsIgnoreEndpointUrls ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
@@ -324,6 +346,8 @@ public final class aws/sdk/kotlin/runtime/config/endpoints/ResolversKt {
324346
public static final fun resolveAccountId (Laws/sdk/kotlin/runtime/config/endpoints/AccountIdEndpointMode;Laws/smithy/kotlin/runtime/collections/Attributes;)Ljava/lang/String;
325347
public static final fun resolveAccountIdEndpointMode (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
326348
public static synthetic fun resolveAccountIdEndpointMode$default (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
349+
public static final fun resolveEndpointDiscoveryEnabled (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
350+
public static synthetic fun resolveEndpointDiscoveryEnabled$default (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;ZLkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
327351
public static final fun resolveEndpointUrl (Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
328352
public static synthetic fun resolveEndpointUrl$default (Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
329353
public static final fun resolveUseDualStack (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -513,8 +537,7 @@ public final class aws/sdk/kotlin/runtime/config/profile/AwsProfileKt {
513537
public static synthetic fun getBooleanOrNull$default (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/Boolean;
514538
public static final fun getCredentialProcess (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/String;
515539
public static final fun getDisableRequestCompression (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/Boolean;
516-
public static final fun getEc2InstanceProfileName (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/String;
517-
public static final fun getEc2MetadataDisabled (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/Boolean;
540+
public static final fun getEndpointDiscoveryEnabled (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/Boolean;
518541
public static final fun getEndpointUrl (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Laws/smithy/kotlin/runtime/net/url/Url;
519542
public static final fun getIgnoreEndpointUrls (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/Boolean;
520543
public static final fun getIntOrNull (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Integer;
@@ -570,55 +593,43 @@ public final class aws/sdk/kotlin/runtime/config/useragent/ResolveUserAgentKt {
570593
public static synthetic fun resolveUserAgentAppId$default (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
571594
}
572595

573-
public final class aws/sdk/kotlin/runtime/region/DefaultRegionProviderChain : aws/sdk/kotlin/runtime/region/RegionProviderChain, aws/sdk/kotlin/runtime/region/RegionProvider, java/io/Closeable {
596+
public final class aws/sdk/kotlin/runtime/region/DefaultRegionProviderChain : aws/smithy/kotlin/runtime/client/region/RegionProviderChain, aws/smithy/kotlin/runtime/client/region/RegionProvider, java/io/Closeable {
574597
public fun <init> ()V
575598
public fun <init> (Laws/smithy/kotlin/runtime/util/PlatformProvider;Lkotlin/Lazy;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;)V
576599
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/PlatformProvider;Lkotlin/Lazy;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
577600
public fun close ()V
578601
}
579602

580-
public final class aws/sdk/kotlin/runtime/region/EnvironmentRegionProvider : aws/sdk/kotlin/runtime/region/RegionProvider {
603+
public final class aws/sdk/kotlin/runtime/region/EnvironmentRegionProvider : aws/smithy/kotlin/runtime/client/region/RegionProvider {
581604
public fun <init> ()V
582605
public fun <init> (Laws/smithy/kotlin/runtime/util/EnvironmentProvider;)V
583606
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/EnvironmentProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
584607
public fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
585608
}
586609

587-
public final class aws/sdk/kotlin/runtime/region/ImdsRegionProvider : aws/sdk/kotlin/runtime/region/RegionProvider, java/io/Closeable {
610+
public final class aws/sdk/kotlin/runtime/region/ImdsRegionProvider : aws/smithy/kotlin/runtime/client/region/RegionProvider, java/io/Closeable {
588611
public fun <init> ()V
589612
public fun <init> (Lkotlin/Lazy;Laws/smithy/kotlin/runtime/util/PlatformEnvironProvider;)V
590613
public synthetic fun <init> (Lkotlin/Lazy;Laws/smithy/kotlin/runtime/util/PlatformEnvironProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
591614
public fun close ()V
592615
public fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
593616
}
594617

595-
public final class aws/sdk/kotlin/runtime/region/JvmSystemPropRegionProvider : aws/sdk/kotlin/runtime/region/RegionProvider {
618+
public final class aws/sdk/kotlin/runtime/region/JvmSystemPropRegionProvider : aws/smithy/kotlin/runtime/client/region/RegionProvider {
596619
public fun <init> ()V
597620
public fun <init> (Laws/smithy/kotlin/runtime/util/PropertyProvider;)V
598621
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/PropertyProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
599622
public fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
600623
}
601624

602-
public final class aws/sdk/kotlin/runtime/region/ProfileRegionProvider : aws/sdk/kotlin/runtime/region/RegionProvider {
625+
public final class aws/sdk/kotlin/runtime/region/ProfileRegionProvider : aws/smithy/kotlin/runtime/client/region/RegionProvider {
603626
public fun <init> ()V
604627
public fun <init> (Laws/smithy/kotlin/runtime/util/LazyAsyncValue;)V
605628
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/LazyAsyncValue;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
606629
public fun <init> (Ljava/lang/String;)V
607630
public fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
608631
}
609632

610-
public abstract interface class aws/sdk/kotlin/runtime/region/RegionProvider {
611-
public abstract fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
612-
}
613-
614-
public class aws/sdk/kotlin/runtime/region/RegionProviderChain : aws/sdk/kotlin/runtime/region/RegionProvider {
615-
public fun <init> (Ljava/util/List;)V
616-
public fun <init> ([Laws/sdk/kotlin/runtime/region/RegionProvider;)V
617-
protected final fun getProviders ()[Laws/sdk/kotlin/runtime/region/RegionProvider;
618-
public fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
619-
public fun toString ()Ljava/lang/String;
620-
}
621-
622633
public final class aws/sdk/kotlin/runtime/region/ResolveRegionKt {
623634
public static final fun resolveRegion (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
624635
public static synthetic fun resolveRegion$default (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;

aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public class EcsCredentialsProvider(
8787
}
8888

8989
val op = SdkHttpOperation.build<Unit, Credentials> {
90-
serializer = EcsCredentialsSerializer(authToken)
91-
deserializer = EcsCredentialsDeserializer()
90+
serializeWith = EcsCredentialsSerializer(authToken)
91+
deserializeWith = EcsCredentialsDeserializer()
9292
operationName = "EcsCredentialsProvider"
9393
serviceName = "EcsContainerMetadata"
9494
execution.endpointResolver = EndpointResolver { Endpoint(url) }
@@ -196,14 +196,14 @@ public class EcsCredentialsProvider(
196196
override fun toString(): String = this.simpleClassName
197197
}
198198

199-
private class EcsCredentialsDeserializer : HttpDeserialize<Credentials> {
200-
override suspend fun deserialize(context: ExecutionContext, call: HttpCall): Credentials {
199+
private class EcsCredentialsDeserializer : HttpDeserializer.NonStreaming<Credentials> {
200+
override fun deserialize(context: ExecutionContext, call: HttpCall, payload: ByteArray?): Credentials {
201201
val response = call.response
202202
if (!response.status.isSuccess()) {
203-
throwCredentialsResponseException(response)
203+
throwCredentialsResponseException(response, payload)
204204
}
205205

206-
val payload = response.body.readAll() ?: throw CredentialsProviderException("HTTP credentials response did not contain a payload")
206+
if (payload == null) throw CredentialsProviderException("HTTP credentials response did not contain a payload")
207207
val deserializer = JsonDeserializer(payload)
208208
val resp = deserializeJsonCredentials(deserializer)
209209
if (resp !is JsonCredentialsResponse.SessionCredentials) {
@@ -221,8 +221,8 @@ private class EcsCredentialsDeserializer : HttpDeserialize<Credentials> {
221221
}
222222
}
223223

224-
private suspend fun throwCredentialsResponseException(response: HttpResponse): Nothing {
225-
val errorResp = tryParseErrorResponse(response)
224+
private fun throwCredentialsResponseException(response: HttpResponse, payload: ByteArray?): Nothing {
225+
val errorResp = tryParseErrorResponse(response, payload)
226226
val messageDetails = errorResp?.run { "code=$code; message=$message" } ?: "HTTP ${response.status}"
227227

228228
throw CredentialsProviderException("Error retrieving credentials from container service: $messageDetails").apply {
@@ -233,17 +233,15 @@ private suspend fun throwCredentialsResponseException(response: HttpResponse): N
233233
}
234234
}
235235

236-
private suspend fun tryParseErrorResponse(response: HttpResponse): JsonCredentialsResponse.Error? {
237-
if (response.headers["Content-Type"] != "application/json") return null
238-
val payload = response.body.readAll() ?: return null
239-
236+
private fun tryParseErrorResponse(response: HttpResponse, payload: ByteArray?): JsonCredentialsResponse.Error? {
237+
if (response.headers["Content-Type"] != "application/json" || payload == null) return null
240238
return deserializeJsonCredentials(JsonDeserializer(payload)) as? JsonCredentialsResponse.Error
241239
}
242240

243241
private class EcsCredentialsSerializer(
244242
private val authToken: String? = null,
245-
) : HttpSerialize<Unit> {
246-
override suspend fun serialize(context: ExecutionContext, input: Unit): HttpRequestBuilder {
243+
) : HttpSerializer.NonStreaming<Unit> {
244+
override fun serialize(context: ExecutionContext, input: Unit): HttpRequestBuilder {
247245
val builder = HttpRequestBuilder()
248246
builder.url.path
249247
builder.header("Accept", "application/json")

aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/JsonCredentialsDeserializer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ internal sealed class JsonCredentialsResponse {
7474
* ```
7575
*/
7676
@Suppress("ktlint:standard:property-naming")
77-
internal suspend fun deserializeJsonCredentials(deserializer: Deserializer): JsonCredentialsResponse {
77+
internal fun deserializeJsonCredentials(deserializer: Deserializer): JsonCredentialsResponse {
7878
val CODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Code"))
7979
val ACCESS_KEY_ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AccessKeyId"))
8080
val SECRET_ACCESS_KEY_ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SecretAccessKey"))

0 commit comments

Comments
 (0)