Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 0 additions & 8 deletions .changes/05ac561b-963f-4953-bb4f-1fc19fc1207c.json

This file was deleted.

9 changes: 0 additions & 9 deletions .changes/49af01b8-6fed-4add-ace0-9f027e83425a.json

This file was deleted.

9 changes: 0 additions & 9 deletions .changes/929f0e2a-3af9-4f73-9f1b-b4e97f91f0db.json

This file was deleted.

8 changes: 0 additions & 8 deletions .changes/e6515649-dab5-4be9-b4b4-b289369960d5.json

This file was deleted.

5 changes: 0 additions & 5 deletions .changes/f56de67b-6779-4296-a7d0-dcdefa0d4acd.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
uses: awslabs/aws-kotlin-repo-tools/.github/actions/merge-main@main
with:
ci-user-pat: ${{ secrets.CI_USER_PAT }}
exempt-branches: # Add any if required
exempt-branches: # Add any if required
2 changes: 1 addition & 1 deletion .github/workflows/sync-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
source_repo: "https://aws-sdk-kotlin-ci:${{ secrets.CI_USER_PAT }}@github.com/awslabs/aws-sdk-kotlin.git"
source_branch: "main"
destination_repo: "https://aws-sdk-kotlin-ci:${{ secrets.CI_USER_PAT }}@github.com/awslabs/private-aws-sdk-kotlin-staging.git"
destination_branch: "main"
destination_branch: "main"
49 changes: 19 additions & 30 deletions aws-runtime/aws-config/api/aws-config.api
Original file line number Diff line number Diff line change
Expand Up @@ -246,27 +246,6 @@ public abstract class aws/sdk/kotlin/runtime/config/AbstractAwsSdkClientFactory
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;
}

public abstract interface class aws/sdk/kotlin/runtime/config/AwsSdkClientConfig : aws/smithy/kotlin/runtime/client/SdkClientConfig {
public abstract fun getApplicationId ()Ljava/lang/String;
public abstract fun getRegion ()Ljava/lang/String;
public abstract fun getRegionProvider ()Laws/smithy/kotlin/runtime/client/region/RegionProvider;
public abstract fun getUseDualStack ()Z
public abstract fun getUseFips ()Z
}

public abstract interface class aws/sdk/kotlin/runtime/config/AwsSdkClientConfig$Builder {
public abstract fun getApplicationId ()Ljava/lang/String;
public abstract fun getRegion ()Ljava/lang/String;
public abstract fun getRegionProvider ()Laws/smithy/kotlin/runtime/client/region/RegionProvider;
public abstract fun getUseDualStack ()Ljava/lang/Boolean;
public abstract fun getUseFips ()Ljava/lang/Boolean;
public abstract fun setApplicationId (Ljava/lang/String;)V
public abstract fun setRegion (Ljava/lang/String;)V
public abstract fun setRegionProvider (Laws/smithy/kotlin/runtime/client/region/RegionProvider;)V
public abstract fun setUseDualStack (Ljava/lang/Boolean;)V
public abstract fun setUseFips (Ljava/lang/Boolean;)V
}

public final class aws/sdk/kotlin/runtime/config/AwsSdkSetting {
public static final field INSTANCE Laws/sdk/kotlin/runtime/config/AwsSdkSetting;
public final fun getAwsAccessKeyId ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
Expand All @@ -284,7 +263,6 @@ public final class aws/sdk/kotlin/runtime/config/AwsSdkSetting {
public final fun getAwsEc2MetadataDisabled ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
public final fun getAwsEc2MetadataServiceEndpoint ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
public final fun getAwsEc2MetadataServiceEndpointMode ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
public final fun getAwsEndpointDiscoveryEnabled ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
public final fun getAwsEndpointUrl ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
public final fun getAwsExecutionEnv ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
public final fun getAwsIgnoreEndpointUrls ()Laws/smithy/kotlin/runtime/config/EnvironmentSetting;
Expand Down Expand Up @@ -346,8 +324,6 @@ public final class aws/sdk/kotlin/runtime/config/endpoints/ResolversKt {
public static final fun resolveAccountId (Laws/sdk/kotlin/runtime/config/endpoints/AccountIdEndpointMode;Laws/smithy/kotlin/runtime/collections/Attributes;)Ljava/lang/String;
public static final fun resolveAccountIdEndpointMode (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
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;
public static final fun resolveEndpointDiscoveryEnabled (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
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;
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;
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;
public static final fun resolveUseDualStack (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand Down Expand Up @@ -537,7 +513,8 @@ public final class aws/sdk/kotlin/runtime/config/profile/AwsProfileKt {
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;
public static final fun getCredentialProcess (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/String;
public static final fun getDisableRequestCompression (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/Boolean;
public static final fun getEndpointDiscoveryEnabled (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/Boolean;
public static final fun getEc2InstanceProfileName (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/String;
public static final fun getEc2MetadataDisabled (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/Boolean;
public static final fun getEndpointUrl (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Laws/smithy/kotlin/runtime/net/url/Url;
public static final fun getIgnoreEndpointUrls (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;)Ljava/lang/Boolean;
public static final fun getIntOrNull (Laws/sdk/kotlin/runtime/config/profile/ConfigSection;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Integer;
Expand Down Expand Up @@ -593,43 +570,55 @@ public final class aws/sdk/kotlin/runtime/config/useragent/ResolveUserAgentKt {
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;
}

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 {
public final class aws/sdk/kotlin/runtime/region/DefaultRegionProviderChain : aws/sdk/kotlin/runtime/region/RegionProviderChain, aws/sdk/kotlin/runtime/region/RegionProvider, java/io/Closeable {
public fun <init> ()V
public fun <init> (Laws/smithy/kotlin/runtime/util/PlatformProvider;Lkotlin/Lazy;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;)V
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/PlatformProvider;Lkotlin/Lazy;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun close ()V
}

public final class aws/sdk/kotlin/runtime/region/EnvironmentRegionProvider : aws/smithy/kotlin/runtime/client/region/RegionProvider {
public final class aws/sdk/kotlin/runtime/region/EnvironmentRegionProvider : aws/sdk/kotlin/runtime/region/RegionProvider {
public fun <init> ()V
public fun <init> (Laws/smithy/kotlin/runtime/util/EnvironmentProvider;)V
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/EnvironmentProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

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

public final class aws/sdk/kotlin/runtime/region/JvmSystemPropRegionProvider : aws/smithy/kotlin/runtime/client/region/RegionProvider {
public final class aws/sdk/kotlin/runtime/region/JvmSystemPropRegionProvider : aws/sdk/kotlin/runtime/region/RegionProvider {
public fun <init> ()V
public fun <init> (Laws/smithy/kotlin/runtime/util/PropertyProvider;)V
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/PropertyProvider;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public final class aws/sdk/kotlin/runtime/region/ProfileRegionProvider : aws/smithy/kotlin/runtime/client/region/RegionProvider {
public final class aws/sdk/kotlin/runtime/region/ProfileRegionProvider : aws/sdk/kotlin/runtime/region/RegionProvider {
public fun <init> ()V
public fun <init> (Laws/smithy/kotlin/runtime/util/LazyAsyncValue;)V
public synthetic fun <init> (Laws/smithy/kotlin/runtime/util/LazyAsyncValue;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;)V
public fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public abstract interface class aws/sdk/kotlin/runtime/region/RegionProvider {
public abstract fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public class aws/sdk/kotlin/runtime/region/RegionProviderChain : aws/sdk/kotlin/runtime/region/RegionProvider {
public fun <init> (Ljava/util/List;)V
public fun <init> ([Laws/sdk/kotlin/runtime/region/RegionProvider;)V
protected final fun getProviders ()[Laws/sdk/kotlin/runtime/region/RegionProvider;
public fun getRegion (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun toString ()Ljava/lang/String;
}

public final class aws/sdk/kotlin/runtime/region/ResolveRegionKt {
public static final fun resolveRegion (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/util/LazyAsyncValue;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public class EcsCredentialsProvider(
}

val op = SdkHttpOperation.build<Unit, Credentials> {
serializeWith = EcsCredentialsSerializer(authToken)
deserializeWith = EcsCredentialsDeserializer()
serializer = EcsCredentialsSerializer(authToken)
deserializer = EcsCredentialsDeserializer()
operationName = "EcsCredentialsProvider"
serviceName = "EcsContainerMetadata"
execution.endpointResolver = EndpointResolver { Endpoint(url) }
Expand Down Expand Up @@ -196,14 +196,14 @@ public class EcsCredentialsProvider(
override fun toString(): String = this.simpleClassName
}

private class EcsCredentialsDeserializer : HttpDeserializer.NonStreaming<Credentials> {
override fun deserialize(context: ExecutionContext, call: HttpCall, payload: ByteArray?): Credentials {
private class EcsCredentialsDeserializer : HttpDeserialize<Credentials> {
override suspend fun deserialize(context: ExecutionContext, call: HttpCall): Credentials {
val response = call.response
if (!response.status.isSuccess()) {
throwCredentialsResponseException(response, payload)
throwCredentialsResponseException(response)
}

if (payload == null) throw CredentialsProviderException("HTTP credentials response did not contain a payload")
val payload = response.body.readAll() ?: throw CredentialsProviderException("HTTP credentials response did not contain a payload")
val deserializer = JsonDeserializer(payload)
val resp = deserializeJsonCredentials(deserializer)
if (resp !is JsonCredentialsResponse.SessionCredentials) {
Expand All @@ -221,8 +221,8 @@ private class EcsCredentialsDeserializer : HttpDeserializer.NonStreaming<Credent
}
}

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

throw CredentialsProviderException("Error retrieving credentials from container service: $messageDetails").apply {
Expand All @@ -233,15 +233,17 @@ private fun throwCredentialsResponseException(response: HttpResponse, payload: B
}
}

private fun tryParseErrorResponse(response: HttpResponse, payload: ByteArray?): JsonCredentialsResponse.Error? {
if (response.headers["Content-Type"] != "application/json" || payload == null) return null
private suspend fun tryParseErrorResponse(response: HttpResponse): JsonCredentialsResponse.Error? {
if (response.headers["Content-Type"] != "application/json") return null
val payload = response.body.readAll() ?: return null

return deserializeJsonCredentials(JsonDeserializer(payload)) as? JsonCredentialsResponse.Error
}

private class EcsCredentialsSerializer(
private val authToken: String? = null,
) : HttpSerializer.NonStreaming<Unit> {
override fun serialize(context: ExecutionContext, input: Unit): HttpRequestBuilder {
) : HttpSerialize<Unit> {
override suspend fun serialize(context: ExecutionContext, input: Unit): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.url.path
builder.header("Accept", "application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ internal sealed class JsonCredentialsResponse {
* ```
*/
@Suppress("ktlint:standard:property-naming")
internal fun deserializeJsonCredentials(deserializer: Deserializer): JsonCredentialsResponse {
internal suspend fun deserializeJsonCredentials(deserializer: Deserializer): JsonCredentialsResponse {
val CODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Code"))
val ACCESS_KEY_ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AccessKeyId"))
val SECRET_ACCESS_KEY_ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SecretAccessKey"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package aws.sdk.kotlin.runtime.config

import aws.sdk.kotlin.runtime.client.AwsSdkClientConfig
import aws.sdk.kotlin.runtime.config.auth.resolveAuthSchemePreference
import aws.sdk.kotlin.runtime.config.checksums.resolveRequestChecksumCalculation
import aws.sdk.kotlin.runtime.config.checksums.resolveResponseChecksumValidation
Expand All @@ -21,10 +22,7 @@ import aws.sdk.kotlin.runtime.region.resolveRegion
import aws.sdk.kotlin.runtime.region.resolveSigV4aSigningRegionSet
import aws.smithy.kotlin.runtime.ExperimentalApi
import aws.smithy.kotlin.runtime.auth.awscredentials.SigV4aClientConfig
import aws.smithy.kotlin.runtime.client.AbstractSdkClientFactory
import aws.smithy.kotlin.runtime.client.RetryStrategyClientConfig
import aws.smithy.kotlin.runtime.client.SdkClient
import aws.smithy.kotlin.runtime.client.SdkClientConfig
import aws.smithy.kotlin.runtime.client.*
import aws.smithy.kotlin.runtime.client.config.ClientSettings
import aws.smithy.kotlin.runtime.client.config.CompressionClientConfig
import aws.smithy.kotlin.runtime.client.config.HttpChecksumConfig
Expand Down Expand Up @@ -81,7 +79,7 @@ public abstract class AbstractAwsSdkClientFactory<
block?.let(config::apply)

config.logMode = config.logMode ?: ClientSettings.LogMode.resolve(platform = platform)
config.region = config.region ?: config.regionProvider?.getRegion() ?: resolveRegion(profile = profile)
config.region = config.region ?: resolveRegion(profile = profile)
config.useFips = config.useFips ?: resolveUseFips(profile = profile)
config.useDualStack = config.useDualStack ?: resolveUseDualStack(profile = profile)
config.applicationId = config.applicationId ?: resolveUserAgentAppId(platform, profile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,6 @@ public object AwsSdkSetting {
public val AwsSigV4aSigningRegionSet: EnvironmentSetting<String> =
strEnvSetting("aws.sigV4aSigningRegionSet", "AWS_SIGV4A_SIGNING_REGION_SET")

/**
* A flag indicating whether endpoint discovery is enabled for AWS services that support it. The implicit default
* value for this setting is:
* * `true` for services which _require_ EP discovery (e.g., Timestream)
* * `false` for services which _allow but do not require_ EP discovery (e.g., DynamoDB)
*/
public val AwsEndpointDiscoveryEnabled: EnvironmentSetting<Boolean> =
boolEnvSetting("aws.endpointDiscoveryEnabled", "AWS_ENABLE_ENDPOINT_DISCOVERY")

/**
* Configures request checksum calculation
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,3 @@ public fun resolveAccountId(endpointMode: AccountIdEndpointMode, attributes: Att
AccountIdEndpointMode.DISABLED -> null
AccountIdEndpointMode.REQUIRED -> attributes.getOrNull(AwsClientOption.AccountId) ?: throw ConfigurationException("AccountIdEndpointMode is set to required but no AWS account ID found")
}

/**
* Resolve the endpoint discovery mode
*/
@InternalSdkApi
public suspend fun resolveEndpointDiscoveryEnabled(
provider: PlatformProvider = PlatformProvider.System,
profile: LazyAsyncValue<AwsProfile> = asyncLazy { loadAwsSharedConfig(provider).activeProfile },
serviceRequiresEpDiscovery: Boolean,
): Boolean =
AwsSdkSetting.AwsEndpointDiscoveryEnabled.resolve(provider)
?: profile.get().endpointDiscoveryEnabled
?: serviceRequiresEpDiscovery
Loading
Loading