diff --git a/.changes/df876af1-d23b-4c57-8330-0a13be27ea16.json b/.changes/df876af1-d23b-4c57-8330-0a13be27ea16.json new file mode 100644 index 00000000000..43d37a36811 --- /dev/null +++ b/.changes/df876af1-d23b-4c57-8330-0a13be27ea16.json @@ -0,0 +1,8 @@ +{ + "id": "df876af1-d23b-4c57-8330-0a13be27ea16", + "type": "feature", + "description": "BREAKING: Overhaul URL APIs to clarify content encoding, when data is in which state, and to reduce the number of times data is encoded/decoded", + "issues": [ + "https://github.com/awslabs/smithy-kotlin/issues/659" + ] +} \ No newline at end of file diff --git a/aws-runtime/aws-config/api/aws-config.api b/aws-runtime/aws-config/api/aws-config.api index 216ec7017b4..b88e78951cc 100644 --- a/aws-runtime/aws-config/api/aws-config.api +++ b/aws-runtime/aws-config/api/aws-config.api @@ -39,7 +39,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/DefaultChainBearerTok public final fun getHttpClient ()Laws/smithy/kotlin/runtime/http/engine/HttpClientEngine; public final fun getPlatformProvider ()Laws/smithy/kotlin/runtime/util/PlatformProvider; public final fun getProfileName ()Ljava/lang/String; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/DefaultChainCredentialsProvider : aws/smithy/kotlin/runtime/auth/awscredentials/CloseableCredentialsProvider { @@ -50,7 +50,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/DefaultChainCredentia public final fun getPlatformProvider ()Laws/smithy/kotlin/runtime/util/PlatformProvider; public final fun getProfileName ()Ljava/lang/String; public final fun getRegion ()Ljava/lang/String; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider : aws/smithy/kotlin/runtime/auth/awscredentials/CloseableCredentialsProvider { @@ -59,7 +59,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvide public synthetic fun (Laws/smithy/kotlin/runtime/util/PlatformProvider;Laws/smithy/kotlin/runtime/http/engine/HttpClientEngine;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun close ()V public final fun getPlatformProvider ()Laws/smithy/kotlin/runtime/util/PlatformProvider; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredentialsProvider : aws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider { @@ -67,7 +67,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredential public fun (Lkotlin/jvm/functions/Function1;)V public synthetic fun (Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getGetEnv ()Lkotlin/jvm/functions/Function1; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProvider : aws/smithy/kotlin/runtime/auth/awscredentials/CloseableCredentialsProvider { @@ -78,7 +78,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProvid public final fun getClient ()Lkotlin/Lazy; public final fun getPlatformProvider ()Laws/smithy/kotlin/runtime/util/PlatformEnvironProvider; public final fun getProfileOverride ()Ljava/lang/String; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/InvalidJsonCredentialsException : aws/sdk/kotlin/runtime/ClientException { @@ -94,7 +94,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/InvalidSsoTokenExcept public final class aws/sdk/kotlin/runtime/auth/credentials/ProcessCredentialsProvider : aws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider { public fun (Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;JJ)V public synthetic fun (Ljava/lang/String;Laws/smithy/kotlin/runtime/util/PlatformProvider;JJILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProvider : aws/smithy/kotlin/runtime/auth/awscredentials/CloseableCredentialsProvider { @@ -106,7 +106,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsPro public final fun getPlatformProvider ()Laws/smithy/kotlin/runtime/util/PlatformProvider; public final fun getProfileName ()Ljava/lang/String; public final fun getRegion ()Ljava/lang/String; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/ProviderConfigurationException : aws/sdk/kotlin/runtime/ConfigurationException { @@ -124,7 +124,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/SsoCredentialsProvide public final fun getSsoRegion ()Ljava/lang/String; public final fun getSsoSessionName ()Ljava/lang/String; public final fun getStartUrl ()Ljava/lang/String; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/SsoTokenProvider : aws/smithy/kotlin/runtime/http/auth/BearerTokenProvider { @@ -136,7 +136,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/SsoTokenProvider : aw public final fun getSsoRegion ()Ljava/lang/String; public final fun getSsoSessionName ()Ljava/lang/String; public final fun getStartUrl ()Ljava/lang/String; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/StaticCredentialsProvider : aws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider { @@ -144,7 +144,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/StaticCredentialsProv public synthetic fun (Laws/sdk/kotlin/runtime/auth/credentials/StaticCredentialsProvider$Builder;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public fun (Laws/smithy/kotlin/runtime/auth/awscredentials/Credentials;)V public final fun getCredentials ()Laws/smithy/kotlin/runtime/auth/awscredentials/Credentials; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/StaticCredentialsProvider$Builder { @@ -173,7 +173,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/StsAssumeRoleCredenti public final fun getBootstrapCredentialsProvider ()Laws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider; public final fun getHttpClient ()Laws/smithy/kotlin/runtime/http/engine/HttpClientEngine; public final fun getRegion ()Ljava/lang/String; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/StsWebIdentityCredentialsProvider : aws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider { @@ -186,7 +186,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/StsWebIdentityCredent public final fun getPlatformProvider ()Laws/smithy/kotlin/runtime/util/PlatformProvider; public final fun getRegion ()Ljava/lang/String; public final fun getWebIdentityParameters ()Laws/sdk/kotlin/runtime/auth/credentials/AssumeRoleWithWebIdentityParameters; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/StsWebIdentityCredentialsProvider$Companion { @@ -199,7 +199,7 @@ public final class aws/sdk/kotlin/runtime/auth/credentials/SystemPropertyCredent public fun (Lkotlin/jvm/functions/Function1;)V public synthetic fun (Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun getGetProperty ()Lkotlin/jvm/functions/Function1; - public fun resolve (Laws/smithy/kotlin/runtime/util/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun resolve (Laws/smithy/kotlin/runtime/collections/Attributes;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class aws/sdk/kotlin/runtime/auth/credentials/internal/ManagedBearerTokenProviderKt { @@ -318,7 +318,7 @@ public final class aws/sdk/kotlin/runtime/config/profile/AwsProfileKt { } public final class aws/sdk/kotlin/runtime/config/profile/AwsSharedConfigKt { - public static final fun resolveEndpointUrl (Laws/sdk/kotlin/runtime/config/profile/AwsSharedConfig;Ljava/lang/String;)Laws/smithy/kotlin/runtime/net/Url; + public static final fun resolveEndpointUrl (Laws/sdk/kotlin/runtime/config/profile/AwsSharedConfig;Ljava/lang/String;)Laws/smithy/kotlin/runtime/net/url/Url; } public final class aws/sdk/kotlin/runtime/config/retries/ResolveRetryStrategyKt { diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/DefaultChainBearerTokenProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/DefaultChainBearerTokenProvider.kt index d813ef90d0f..604b3984233 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/DefaultChainBearerTokenProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/DefaultChainBearerTokenProvider.kt @@ -6,12 +6,12 @@ package aws.sdk.kotlin.runtime.auth.credentials import aws.sdk.kotlin.runtime.config.AwsSdkSetting +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.http.auth.BearerToken import aws.smithy.kotlin.runtime.http.auth.BearerTokenProviderChain import aws.smithy.kotlin.runtime.http.auth.CloseableBearerTokenProvider import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine import aws.smithy.kotlin.runtime.io.Closeable -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformProvider /** diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/DefaultChainCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/DefaultChainCredentialsProvider.kt index 6196415ee79..ab5a6a63dd6 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/DefaultChainCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/DefaultChainCredentialsProvider.kt @@ -11,11 +11,11 @@ import aws.smithy.kotlin.runtime.auth.awscredentials.CachedCredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.CloseableCredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderChain +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.http.engine.DefaultHttpEngine import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine import aws.smithy.kotlin.runtime.io.Closeable import aws.smithy.kotlin.runtime.io.closeIfCloseable -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformProvider /** diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt index a170bd61332..25fedfb4544 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProvider.kt @@ -7,13 +7,13 @@ package aws.sdk.kotlin.runtime.auth.credentials import aws.sdk.kotlin.runtime.auth.credentials.internal.credentials import aws.sdk.kotlin.runtime.config.AwsSdkSetting -import aws.sdk.kotlin.runtime.config.AwsSdkSetting.AwsContainerCredentialsRelativeUri import aws.smithy.kotlin.runtime.ErrorMetadata import aws.smithy.kotlin.runtime.auth.awscredentials.CloseableCredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderException import aws.smithy.kotlin.runtime.client.endpoints.Endpoint +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.config.resolve import aws.smithy.kotlin.runtime.http.* import aws.smithy.kotlin.runtime.http.HttpCall @@ -24,7 +24,11 @@ import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder import aws.smithy.kotlin.runtime.http.request.header import aws.smithy.kotlin.runtime.http.response.HttpResponse import aws.smithy.kotlin.runtime.io.closeIfCloseable -import aws.smithy.kotlin.runtime.net.* +import aws.smithy.kotlin.runtime.net.Host +import aws.smithy.kotlin.runtime.net.IpV4Addr +import aws.smithy.kotlin.runtime.net.IpV6Addr +import aws.smithy.kotlin.runtime.net.Scheme +import aws.smithy.kotlin.runtime.net.url.Url import aws.smithy.kotlin.runtime.operation.ExecutionContext import aws.smithy.kotlin.runtime.retries.policy.RetryDirective import aws.smithy.kotlin.runtime.retries.policy.RetryErrorType @@ -32,7 +36,6 @@ import aws.smithy.kotlin.runtime.retries.policy.RetryPolicy import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer import aws.smithy.kotlin.runtime.telemetry.logging.logger import aws.smithy.kotlin.runtime.time.TimestampFormat -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformProvider import kotlin.coroutines.coroutineContext diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredentialsProvider.kt index 104c398fb50..c914e319e70 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredentialsProvider.kt @@ -9,8 +9,8 @@ import aws.sdk.kotlin.runtime.auth.credentials.internal.credentials import aws.sdk.kotlin.runtime.config.AwsSdkSetting import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.telemetry.logging.trace -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformProvider import kotlin.coroutines.coroutineContext diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProvider.kt index bb74892ebd8..96a52ac3e52 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProvider.kt @@ -14,6 +14,7 @@ import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderException import aws.smithy.kotlin.runtime.auth.awscredentials.DEFAULT_CREDENTIALS_REFRESH_SECONDS +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.config.resolve import aws.smithy.kotlin.runtime.http.HttpStatusCode import aws.smithy.kotlin.runtime.io.IOException @@ -22,7 +23,6 @@ import aws.smithy.kotlin.runtime.telemetry.logging.info import aws.smithy.kotlin.runtime.telemetry.logging.warn import aws.smithy.kotlin.runtime.time.Clock import aws.smithy.kotlin.runtime.time.Instant -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformEnvironProvider import aws.smithy.kotlin.runtime.util.PlatformProvider import kotlinx.coroutines.sync.Mutex diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProcessCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProcessCredentialsProvider.kt index 99d6500e701..631dc3c237e 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProcessCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProcessCredentialsProvider.kt @@ -8,11 +8,11 @@ import aws.sdk.kotlin.runtime.auth.credentials.internal.credentials import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderException +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer import aws.smithy.kotlin.runtime.telemetry.logging.logger import aws.smithy.kotlin.runtime.time.Clock import aws.smithy.kotlin.runtime.time.Instant -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformProvider import kotlin.coroutines.coroutineContext diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProfileBearerTokenProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProfileBearerTokenProvider.kt index 9329a3b48e8..3ed3753d277 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProfileBearerTokenProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProfileBearerTokenProvider.kt @@ -11,12 +11,12 @@ import aws.sdk.kotlin.runtime.auth.credentials.profile.SSO_START_URL import aws.sdk.kotlin.runtime.config.AwsSdkSetting import aws.sdk.kotlin.runtime.config.profile.AwsSharedConfig import aws.sdk.kotlin.runtime.config.profile.loadAwsSharedConfig +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.http.auth.BearerToken import aws.smithy.kotlin.runtime.http.auth.BearerTokenProvider import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine import aws.smithy.kotlin.runtime.telemetry.logging.logger import aws.smithy.kotlin.runtime.time.Clock -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformProvider import aws.smithy.kotlin.runtime.util.asyncLazy import kotlin.coroutines.coroutineContext diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProvider.kt index 8ab2c9c2aa5..c2f9a29d758 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProvider.kt @@ -16,11 +16,14 @@ import aws.sdk.kotlin.runtime.region.resolveRegion import aws.smithy.kotlin.runtime.auth.awscredentials.CloseableCredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine import aws.smithy.kotlin.runtime.io.closeIfCloseable import aws.smithy.kotlin.runtime.telemetry.logging.logger import aws.smithy.kotlin.runtime.time.TimestampFormat -import aws.smithy.kotlin.runtime.util.* +import aws.smithy.kotlin.runtime.util.LazyAsyncValue +import aws.smithy.kotlin.runtime.util.PlatformProvider +import aws.smithy.kotlin.runtime.util.asyncLazy import kotlin.coroutines.coroutineContext /** diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SsoCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SsoCredentialsProvider.kt index c7cf97fa952..60b8dab945c 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SsoCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SsoCredentialsProvider.kt @@ -11,6 +11,7 @@ import aws.sdk.kotlin.runtime.auth.credentials.internal.sso.getRoleCredentials import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderException +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine import aws.smithy.kotlin.runtime.serde.json.* import aws.smithy.kotlin.runtime.telemetry.logging.logger @@ -18,7 +19,7 @@ import aws.smithy.kotlin.runtime.telemetry.telemetryProvider import aws.smithy.kotlin.runtime.time.Clock import aws.smithy.kotlin.runtime.time.Instant import aws.smithy.kotlin.runtime.time.fromEpochMilliseconds -import aws.smithy.kotlin.runtime.util.* +import aws.smithy.kotlin.runtime.util.PlatformProvider import kotlin.coroutines.coroutineContext private const val PROVIDER_NAME = "SSO" diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SsoTokenProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SsoTokenProvider.kt index 0dcbb31a513..e972c930eec 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SsoTokenProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SsoTokenProvider.kt @@ -10,6 +10,8 @@ import aws.sdk.kotlin.runtime.auth.credentials.internal.ssooidc.SsoOidcClient import aws.sdk.kotlin.runtime.auth.credentials.internal.ssooidc.createToken import aws.sdk.kotlin.runtime.auth.credentials.internal.ssooidc.model.CreateTokenResponse import aws.sdk.kotlin.runtime.config.profile.normalizePath +import aws.smithy.kotlin.runtime.collections.Attributes +import aws.smithy.kotlin.runtime.collections.emptyAttributes import aws.smithy.kotlin.runtime.hashing.sha1 import aws.smithy.kotlin.runtime.http.auth.BearerToken import aws.smithy.kotlin.runtime.http.auth.BearerTokenProvider @@ -19,10 +21,12 @@ import aws.smithy.kotlin.runtime.serde.json.* import aws.smithy.kotlin.runtime.telemetry.logging.debug import aws.smithy.kotlin.runtime.telemetry.logging.error import aws.smithy.kotlin.runtime.telemetry.telemetryProvider +import aws.smithy.kotlin.runtime.text.encoding.encodeToHex import aws.smithy.kotlin.runtime.time.Clock import aws.smithy.kotlin.runtime.time.Instant import aws.smithy.kotlin.runtime.time.TimestampFormat -import aws.smithy.kotlin.runtime.util.* +import aws.smithy.kotlin.runtime.util.PlatformProvider +import aws.smithy.kotlin.runtime.util.SingleFlightGroup import kotlin.coroutines.coroutineContext import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StaticCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StaticCredentialsProvider.kt index 7ca99261cec..69d45dfd5ac 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StaticCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StaticCredentialsProvider.kt @@ -8,7 +8,7 @@ package aws.sdk.kotlin.runtime.auth.credentials import aws.sdk.kotlin.runtime.auth.credentials.internal.credentials import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider -import aws.smithy.kotlin.runtime.util.Attributes +import aws.smithy.kotlin.runtime.collections.Attributes private const val PROVIDER_NAME = "Static" diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StsAssumeRoleCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StsAssumeRoleCredentialsProvider.kt index 4374edc83ed..28ec6b9c83d 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StsAssumeRoleCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StsAssumeRoleCredentialsProvider.kt @@ -17,6 +17,7 @@ import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderException import aws.smithy.kotlin.runtime.auth.awscredentials.DEFAULT_CREDENTIALS_REFRESH_SECONDS +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.config.resolve import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine import aws.smithy.kotlin.runtime.telemetry.logging.logger @@ -24,7 +25,6 @@ import aws.smithy.kotlin.runtime.telemetry.telemetryProvider import aws.smithy.kotlin.runtime.time.Instant import aws.smithy.kotlin.runtime.time.TimestampFormat import aws.smithy.kotlin.runtime.time.epochMilliseconds -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformEnvironProvider import aws.smithy.kotlin.runtime.util.PlatformProvider import kotlin.coroutines.coroutineContext diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StsWebIdentityCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StsWebIdentityCredentialsProvider.kt index 692e7471947..c76b1f530d8 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StsWebIdentityCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/StsWebIdentityCredentialsProvider.kt @@ -15,13 +15,13 @@ import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProviderException import aws.smithy.kotlin.runtime.auth.awscredentials.DEFAULT_CREDENTIALS_REFRESH_SECONDS +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.config.EnvironmentSetting import aws.smithy.kotlin.runtime.config.resolve import aws.smithy.kotlin.runtime.http.engine.HttpClientEngine import aws.smithy.kotlin.runtime.telemetry.logging.logger import aws.smithy.kotlin.runtime.telemetry.telemetryProvider import aws.smithy.kotlin.runtime.time.TimestampFormat -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformProvider import kotlin.coroutines.coroutineContext import kotlin.time.Duration diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SystemPropertyCredentialsProvider.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SystemPropertyCredentialsProvider.kt index e2f1b971e59..2ad694db34b 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SystemPropertyCredentialsProvider.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/SystemPropertyCredentialsProvider.kt @@ -9,8 +9,8 @@ import aws.sdk.kotlin.runtime.auth.credentials.internal.credentials import aws.sdk.kotlin.runtime.config.AwsSdkSetting import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.telemetry.logging.trace -import aws.smithy.kotlin.runtime.util.Attributes import aws.smithy.kotlin.runtime.util.PlatformProvider import kotlin.coroutines.coroutineContext diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/internal/CredentialsExt.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/internal/CredentialsExt.kt index 5c8b0947635..3f40a0e584d 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/internal/CredentialsExt.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/auth/credentials/internal/CredentialsExt.kt @@ -6,11 +6,11 @@ package aws.sdk.kotlin.runtime.auth.credentials.internal import aws.sdk.kotlin.runtime.client.AwsClientOption import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials +import aws.smithy.kotlin.runtime.collections.emptyAttributes +import aws.smithy.kotlin.runtime.collections.mutableAttributes +import aws.smithy.kotlin.runtime.collections.setIfValueNotNull import aws.smithy.kotlin.runtime.identity.IdentityAttributes import aws.smithy.kotlin.runtime.time.Instant -import aws.smithy.kotlin.runtime.util.emptyAttributes -import aws.smithy.kotlin.runtime.util.mutableAttributes -import aws.smithy.kotlin.runtime.util.setIfValueNotNull internal fun credentials( accessKeyId: String, diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/AwsSdkSetting.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/AwsSdkSetting.kt index bf76994eef0..8f37ce3f32d 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/AwsSdkSetting.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/AwsSdkSetting.kt @@ -11,7 +11,7 @@ import aws.sdk.kotlin.runtime.http.AWS_APP_ID_ENV import aws.sdk.kotlin.runtime.http.AWS_APP_ID_PROP import aws.smithy.kotlin.runtime.client.config.RetryMode import aws.smithy.kotlin.runtime.config.* -import aws.smithy.kotlin.runtime.net.Url +import aws.smithy.kotlin.runtime.net.url.Url import aws.smithy.kotlin.runtime.util.PlatformProvider // NOTE: The JVM property names MUST match the ones defined in the Java SDK for any setting added. diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/endpoints/Resolvers.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/endpoints/Resolvers.kt index 7c10ee79bf4..20bc6e974eb 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/endpoints/Resolvers.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/endpoints/Resolvers.kt @@ -10,9 +10,9 @@ import aws.sdk.kotlin.runtime.client.AwsClientOption import aws.sdk.kotlin.runtime.config.AwsSdkSetting import aws.sdk.kotlin.runtime.config.profile.* import aws.sdk.kotlin.runtime.config.resolveEndpointUrl +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.config.resolve -import aws.smithy.kotlin.runtime.net.Url -import aws.smithy.kotlin.runtime.util.Attributes +import aws.smithy.kotlin.runtime.net.url.Url import aws.smithy.kotlin.runtime.util.LazyAsyncValue import aws.smithy.kotlin.runtime.util.PlatformProvider import aws.smithy.kotlin.runtime.util.asyncLazy diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/ImdsClient.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/ImdsClient.kt index 994959cf513..ab5a2ba085c 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/ImdsClient.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/ImdsClient.kt @@ -132,7 +132,7 @@ public class ImdsClient private constructor(builder: Builder) : InstanceMetadata op.install(userAgentMiddleware) op.install(tokenMiddleware) op.execution.mutate.intercept(Phase.Order.Before) { req, next -> - req.subject.url.path = path + req.subject.url.path.encoded = path next.call(req) } diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/TokenMiddleware.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/TokenMiddleware.kt index 9753392c262..68a862b0661 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/TokenMiddleware.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/imds/TokenMiddleware.kt @@ -12,7 +12,6 @@ import aws.smithy.kotlin.runtime.http.operation.SdkHttpOperation import aws.smithy.kotlin.runtime.http.operation.SdkHttpRequest import aws.smithy.kotlin.runtime.http.operation.setResolvedEndpoint import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder -import aws.smithy.kotlin.runtime.http.request.url import aws.smithy.kotlin.runtime.telemetry.logging.trace import aws.smithy.kotlin.runtime.time.Clock import aws.smithy.kotlin.runtime.util.CachedValue @@ -56,9 +55,7 @@ internal class TokenMiddleware( method = HttpMethod.PUT headers.append(X_AWS_EC2_METADATA_TOKEN_TTL_SECONDS, ttl.inWholeSeconds.toString()) req.subject.headers["User-Agent"]?.let { headers.append("User-Agent", it) } - url { - path = "/latest/api/token" - } + url.path.encoded = "/latest/api/token" } // endpoint resolution for the request happens right before signing, need to resolve the endpoint ourselves diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsProfile.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsProfile.kt index 2631cee0691..a5e50133d0d 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsProfile.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsProfile.kt @@ -9,7 +9,7 @@ import aws.sdk.kotlin.runtime.ConfigurationException import aws.sdk.kotlin.runtime.InternalSdkApi import aws.sdk.kotlin.runtime.config.endpoints.AccountIdEndpointMode import aws.smithy.kotlin.runtime.client.config.RetryMode -import aws.smithy.kotlin.runtime.net.Url +import aws.smithy.kotlin.runtime.net.url.Url /** * Represents an AWS config profile. diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsSharedConfig.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsSharedConfig.kt index 6d4a6545193..a647f6c55a1 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsSharedConfig.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsSharedConfig.kt @@ -7,7 +7,7 @@ package aws.sdk.kotlin.runtime.config.profile import aws.sdk.kotlin.runtime.ConfigurationException import aws.sdk.kotlin.runtime.InternalSdkApi -import aws.smithy.kotlin.runtime.net.Url +import aws.smithy.kotlin.runtime.net.url.Url /** * Represents shared configuration (profiles, SSO sessions, credentials, etc) diff --git a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProviderTest.kt b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProviderTest.kt index 8e3d7ff3e2c..0ca4d8147e9 100644 --- a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProviderTest.kt +++ b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/EcsCredentialsProviderTest.kt @@ -20,7 +20,7 @@ import aws.smithy.kotlin.runtime.http.request.url import aws.smithy.kotlin.runtime.http.response.HttpResponse import aws.smithy.kotlin.runtime.httptest.TestConnection import aws.smithy.kotlin.runtime.httptest.buildTestConnection -import aws.smithy.kotlin.runtime.net.Url +import aws.smithy.kotlin.runtime.net.url.Url import aws.smithy.kotlin.runtime.retries.StandardRetryStrategy import aws.smithy.kotlin.runtime.time.Instant import aws.smithy.kotlin.runtime.time.TimestampFormat diff --git a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredentialsProviderTest.kt b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredentialsProviderTest.kt index 7c8c139ad00..09ac8d1392c 100644 --- a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredentialsProviderTest.kt +++ b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/EnvironmentCredentialsProviderTest.kt @@ -8,7 +8,7 @@ package aws.sdk.kotlin.runtime.auth.credentials import aws.sdk.kotlin.runtime.client.AwsClientOption import aws.sdk.kotlin.runtime.config.AwsSdkSetting import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials -import aws.smithy.kotlin.runtime.util.attributesOf +import aws.smithy.kotlin.runtime.collections.attributesOf import io.kotest.matchers.string.shouldContain import kotlinx.coroutines.test.runTest import kotlin.test.Test diff --git a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProviderTest.kt b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProviderTest.kt index 2af476bfdac..762735662e8 100644 --- a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProviderTest.kt +++ b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ImdsCredentialsProviderTest.kt @@ -19,7 +19,7 @@ import aws.smithy.kotlin.runtime.httptest.buildTestConnection import aws.smithy.kotlin.runtime.io.IOException import aws.smithy.kotlin.runtime.net.Host import aws.smithy.kotlin.runtime.net.Scheme -import aws.smithy.kotlin.runtime.net.Url +import aws.smithy.kotlin.runtime.net.url.Url import aws.smithy.kotlin.runtime.operation.ExecutionContext import aws.smithy.kotlin.runtime.time.Instant import aws.smithy.kotlin.runtime.time.ManualClock @@ -450,7 +450,11 @@ class ImdsCredentialsProviderTest { return HttpCall( HttpRequest( HttpMethod.GET, - Url(Scheme.HTTP, Host.parse("test"), Scheme.HTTP.defaultPort, "/path/foo/bar"), + Url { + scheme = Scheme.HTTP + host = Host.parse("test") + path.encoded = "/path/foo/bar" + }, Headers.Empty, HttpBody.Empty, ), @@ -534,7 +538,11 @@ class ImdsCredentialsProviderTest { HttpCall( HttpRequest( HttpMethod.GET, - Url(Scheme.HTTP, Host.parse("test"), Scheme.HTTP.defaultPort, "/path/foo/bar"), + Url { + scheme = Scheme.HTTP + host = Host.parse("test") + path.encoded = "/path/foo/bar" + }, Headers.Empty, HttpBody.Empty, ), diff --git a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProviderTest.kt b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProviderTest.kt index b3b517bba03..dd26b335337 100644 --- a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProviderTest.kt +++ b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/ProfileCredentialsProviderTest.kt @@ -8,11 +8,11 @@ package aws.sdk.kotlin.runtime.auth.credentials import aws.sdk.kotlin.runtime.auth.credentials.internal.credentials import aws.sdk.kotlin.runtime.client.AwsClientOption import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials +import aws.smithy.kotlin.runtime.collections.attributesOf import aws.smithy.kotlin.runtime.httptest.TestConnection import aws.smithy.kotlin.runtime.httptest.buildTestConnection import aws.smithy.kotlin.runtime.net.Host import aws.smithy.kotlin.runtime.util.TestPlatformProvider -import aws.smithy.kotlin.runtime.util.attributesOf import kotlinx.coroutines.test.runTest import kotlin.test.Test import kotlin.test.assertEquals diff --git a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/StsTestUtils.kt b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/StsTestUtils.kt index e08868cfeec..2f93df1e498 100644 --- a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/StsTestUtils.kt +++ b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/auth/credentials/StsTestUtils.kt @@ -13,10 +13,10 @@ import aws.smithy.kotlin.runtime.http.HttpStatusCode import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder import aws.smithy.kotlin.runtime.http.request.url import aws.smithy.kotlin.runtime.http.response.HttpResponse -import aws.smithy.kotlin.runtime.net.Url +import aws.smithy.kotlin.runtime.net.url.Url +import aws.smithy.kotlin.runtime.text.encoding.PercentEncoding import aws.smithy.kotlin.runtime.time.Instant import aws.smithy.kotlin.runtime.time.TimestampFormat -import aws.smithy.kotlin.runtime.util.text.urlEncodeComponent import kotlin.time.Duration.Companion.minutes object StsTestUtils { @@ -40,7 +40,11 @@ object StsTestUtils { fun stsRequest(bodyParameters: Map) = HttpRequestBuilder().apply { val bodyBytes = bodyParameters .entries - .joinToString("&") { (key, value) -> "${key.urlEncodeComponent()}=${value.urlEncodeComponent()}" } + .joinToString("&") { (key, value) -> + val kEnc = PercentEncoding.FormUrl.encode(key) + val vEnc = PercentEncoding.FormUrl.encode(value) + "$kEnc=$vEnc" + } .encodeToByteArray() method = HttpMethod.GET diff --git a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/endpoints/ResolveEndpointUrlTest.kt b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/endpoints/ResolveEndpointUrlTest.kt index 33259fec06b..4eb03bc9a42 100644 --- a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/endpoints/ResolveEndpointUrlTest.kt +++ b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/endpoints/ResolveEndpointUrlTest.kt @@ -8,7 +8,7 @@ import aws.sdk.kotlin.runtime.config.profile.AwsConfigurationSource import aws.sdk.kotlin.runtime.config.profile.FileType import aws.sdk.kotlin.runtime.config.profile.parse import aws.sdk.kotlin.runtime.config.profile.toSharedConfig -import aws.smithy.kotlin.runtime.net.Url +import aws.smithy.kotlin.runtime.net.url.Url import aws.smithy.kotlin.runtime.telemetry.logging.Logger import aws.smithy.kotlin.runtime.util.TestPlatformProvider import aws.smithy.kotlin.runtime.util.asyncLazy diff --git a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/imds/ImdsTestSuite.kt b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/imds/ImdsTestSuite.kt index 1ed4cd6427b..2b9dfbee219 100644 --- a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/imds/ImdsTestSuite.kt +++ b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/imds/ImdsTestSuite.kt @@ -153,7 +153,7 @@ internal const val imdsTestSuite = """ }, "fs": {}, "result": { - "Err": "is not a valid inet host" + "Err": "Cannot parse \"not a uri\" as a URL" } }, { diff --git a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/imds/ImdsTestUtils.kt b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/imds/ImdsTestUtils.kt index af7263fc960..fb6dc7a325a 100644 --- a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/imds/ImdsTestUtils.kt +++ b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/imds/ImdsTestUtils.kt @@ -12,13 +12,12 @@ import aws.smithy.kotlin.runtime.http.HttpStatusCode import aws.smithy.kotlin.runtime.http.request.HttpRequest import aws.smithy.kotlin.runtime.http.request.url import aws.smithy.kotlin.runtime.http.response.HttpResponse -import aws.smithy.kotlin.runtime.net.Url +import aws.smithy.kotlin.runtime.net.url.Url fun tokenRequest(host: String, ttl: Int): HttpRequest = HttpRequest { - val parsed = Url.parse(host) - url(parsed) + url(Url.parse(host)) method = HttpMethod.PUT - url.path = "/latest/api/token" + url.path.encoded = "/latest/api/token" headers.append(X_AWS_EC2_METADATA_TOKEN_TTL_SECONDS, ttl.toString()) } diff --git a/aws-runtime/aws-core/api/aws-core.api b/aws-runtime/aws-core/api/aws-core.api index 9bf831d3c1e..39d9c553070 100644 --- a/aws-runtime/aws-core/api/aws-core.api +++ b/aws-runtime/aws-core/api/aws-core.api @@ -34,8 +34,8 @@ public abstract interface annotation class aws/sdk/kotlin/runtime/InternalSdkApi public final class aws/sdk/kotlin/runtime/client/AwsClientOption { public static final field INSTANCE Laws/sdk/kotlin/runtime/client/AwsClientOption; - public final fun getAccountId ()Laws/smithy/kotlin/runtime/util/AttributeKey; - public final fun getRegion ()Laws/smithy/kotlin/runtime/util/AttributeKey; + public final fun getAccountId ()Laws/smithy/kotlin/runtime/collections/AttributeKey; + public final fun getRegion ()Laws/smithy/kotlin/runtime/collections/AttributeKey; } public abstract interface class aws/sdk/kotlin/runtime/client/AwsSdkClientConfig : aws/smithy/kotlin/runtime/client/SdkClientConfig { diff --git a/aws-runtime/aws-core/common/src/aws/sdk/kotlin/runtime/client/AwsClientOption.kt b/aws-runtime/aws-core/common/src/aws/sdk/kotlin/runtime/client/AwsClientOption.kt index 085c08f09bb..891e03e639d 100644 --- a/aws-runtime/aws-core/common/src/aws/sdk/kotlin/runtime/client/AwsClientOption.kt +++ b/aws-runtime/aws-core/common/src/aws/sdk/kotlin/runtime/client/AwsClientOption.kt @@ -4,7 +4,8 @@ */ package aws.sdk.kotlin.runtime.client -import aws.smithy.kotlin.runtime.util.AttributeKey + +import aws.smithy.kotlin.runtime.collections.AttributeKey /** * A collection of AWS service client options. NOTE: most options are configured by default through the service diff --git a/aws-runtime/aws-http/common/src/aws/sdk/kotlin/runtime/http/middleware/RecursionDetection.kt b/aws-runtime/aws-http/common/src/aws/sdk/kotlin/runtime/http/middleware/RecursionDetection.kt index f6d31174f3e..035ff27e538 100644 --- a/aws-runtime/aws-http/common/src/aws/sdk/kotlin/runtime/http/middleware/RecursionDetection.kt +++ b/aws-runtime/aws-http/common/src/aws/sdk/kotlin/runtime/http/middleware/RecursionDetection.kt @@ -8,9 +8,9 @@ package aws.sdk.kotlin.runtime.http.middleware import aws.sdk.kotlin.runtime.InternalSdkApi import aws.smithy.kotlin.runtime.http.operation.ModifyRequestMiddleware import aws.smithy.kotlin.runtime.http.operation.SdkHttpRequest +import aws.smithy.kotlin.runtime.text.encoding.PercentEncoding import aws.smithy.kotlin.runtime.util.EnvironmentProvider import aws.smithy.kotlin.runtime.util.PlatformProvider -import aws.smithy.kotlin.runtime.util.text.percentEncodeTo internal const val ENV_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME" internal const val ENV_TRACE_ID = "_X_AMZN_TRACE_ID" @@ -29,7 +29,7 @@ public class RecursionDetection( val traceId = env.getenv(ENV_TRACE_ID) if (env.getenv(ENV_FUNCTION_NAME) == null || traceId == null) return req - req.subject.headers[HEADER_TRACE_ID] = traceId.percentEncode() + req.subject.headers[HEADER_TRACE_ID] = encoding.encode(traceId) return req } } @@ -38,19 +38,7 @@ public class RecursionDetection( * Percent-encode ISO control characters for the purposes of this specific header. * * The existing `Char::isISOControl` check cannot be used here, because that matches against characters in - * `[0x00, 0x1f] U [0x7f, 0x9f]`. The SEP for recursion detection dictates we should only encode across + * `[0x00, 0x1f] ∪ [0x7f, 0x9f]`. The SEP for recursion detection dictates we should only encode across * `[0x00, 0x1f]`. */ -private fun String.percentEncode(): String { - val sb = StringBuilder(this.length) - val data = this.encodeToByteArray() - for (cbyte in data) { - val chr = cbyte.toInt().toChar() - if (chr.code in 0x00..0x1f) { - cbyte.percentEncodeTo(sb) - } else { - sb.append(chr) - } - } - return sb.toString() -} +private val encoding = PercentEncoding("trace header", (Char(0x20)..Char(0x7f)).toSet()) // non-control ASCII chars diff --git a/aws-runtime/aws-http/common/src/aws/sdk/kotlin/runtime/http/operation/CustomUserAgentMetadata.kt b/aws-runtime/aws-http/common/src/aws/sdk/kotlin/runtime/http/operation/CustomUserAgentMetadata.kt index 830c576b897..8734fea2e25 100644 --- a/aws-runtime/aws-http/common/src/aws/sdk/kotlin/runtime/http/operation/CustomUserAgentMetadata.kt +++ b/aws-runtime/aws-http/common/src/aws/sdk/kotlin/runtime/http/operation/CustomUserAgentMetadata.kt @@ -7,8 +7,8 @@ package aws.sdk.kotlin.runtime.http.operation import aws.sdk.kotlin.runtime.InternalSdkApi import aws.sdk.kotlin.runtime.http.uaPair +import aws.smithy.kotlin.runtime.collections.AttributeKey import aws.smithy.kotlin.runtime.operation.ExecutionContext -import aws.smithy.kotlin.runtime.util.AttributeKey import aws.smithy.kotlin.runtime.util.PlatformEnvironProvider private const val CUSTOM_METADATA_ENV_PREFIX = "AWS_CUSTOM_METADATA_" diff --git a/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/interceptors/AddUserAgentMetadataInterceptorTest.kt b/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/interceptors/AddUserAgentMetadataInterceptorTest.kt index 86233e2fbaa..609975f66e6 100644 --- a/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/interceptors/AddUserAgentMetadataInterceptorTest.kt +++ b/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/interceptors/AddUserAgentMetadataInterceptorTest.kt @@ -6,8 +6,8 @@ package aws.sdk.kotlin.runtime.http.interceptors import aws.sdk.kotlin.runtime.http.operation.CustomUserAgentMetadata import aws.smithy.kotlin.runtime.client.RequestInterceptorContext +import aws.smithy.kotlin.runtime.collections.get import aws.smithy.kotlin.runtime.operation.ExecutionContext -import aws.smithy.kotlin.runtime.util.get import kotlin.test.Test import kotlin.test.assertEquals diff --git a/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/AwsRetryHeaderMiddlewareTest.kt b/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/AwsRetryHeaderMiddlewareTest.kt index 946c143b355..d07108a70cf 100644 --- a/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/AwsRetryHeaderMiddlewareTest.kt +++ b/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/AwsRetryHeaderMiddlewareTest.kt @@ -4,11 +4,11 @@ */ package aws.sdk.kotlin.runtime.http.middleware +import aws.smithy.kotlin.runtime.collections.get import aws.smithy.kotlin.runtime.http.SdkHttpClient import aws.smithy.kotlin.runtime.http.operation.* import aws.smithy.kotlin.runtime.httptest.TestEngine import aws.smithy.kotlin.runtime.retries.StandardRetryStrategy -import aws.smithy.kotlin.runtime.util.get import kotlinx.coroutines.test.runTest import kotlin.test.Test import kotlin.test.assertEquals diff --git a/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/RecursionDetectionTest.kt b/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/RecursionDetectionTest.kt index 56a3b07ef81..bc957564efa 100644 --- a/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/RecursionDetectionTest.kt +++ b/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/RecursionDetectionTest.kt @@ -5,6 +5,7 @@ package aws.sdk.kotlin.runtime.http.middleware +import aws.smithy.kotlin.runtime.collections.get import aws.smithy.kotlin.runtime.http.SdkHttpClient import aws.smithy.kotlin.runtime.http.operation.* import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder @@ -12,7 +13,6 @@ import aws.smithy.kotlin.runtime.http.response.HttpResponse import aws.smithy.kotlin.runtime.httptest.TestEngine import aws.smithy.kotlin.runtime.operation.ExecutionContext import aws.smithy.kotlin.runtime.util.TestPlatformProvider -import aws.smithy.kotlin.runtime.util.get import kotlinx.coroutines.test.runTest import kotlin.test.Test import kotlin.test.assertEquals diff --git a/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/UserAgentTest.kt b/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/UserAgentTest.kt index 587fba18df9..05c5ae170b9 100644 --- a/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/UserAgentTest.kt +++ b/aws-runtime/aws-http/common/test/aws/sdk/kotlin/runtime/http/middleware/UserAgentTest.kt @@ -8,13 +8,13 @@ package aws.sdk.kotlin.runtime.http.middleware import aws.sdk.kotlin.runtime.http.ApiMetadata import aws.sdk.kotlin.runtime.http.loadAwsUserAgentMetadataFromEnvironment import aws.sdk.kotlin.runtime.http.operation.customUserAgentMetadata +import aws.smithy.kotlin.runtime.collections.get import aws.smithy.kotlin.runtime.http.SdkHttpClient import aws.smithy.kotlin.runtime.http.operation.* import aws.smithy.kotlin.runtime.http.response.HttpResponse import aws.smithy.kotlin.runtime.httptest.TestEngine import aws.smithy.kotlin.runtime.util.PlatformProvider import aws.smithy.kotlin.runtime.util.TestPlatformProvider -import aws.smithy.kotlin.runtime.util.get import io.kotest.matchers.string.shouldContain import io.kotest.matchers.string.shouldNotContain import kotlinx.coroutines.test.runTest diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/AwsServiceConfigIntegration.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/AwsServiceConfigIntegration.kt index 750f1f65342..385e74fc8dd 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/AwsServiceConfigIntegration.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/AwsServiceConfigIntegration.kt @@ -104,7 +104,7 @@ class AwsServiceConfigIntegration : KotlinIntegration { val EndpointUrlProp = ConfigProperty { name = "endpointUrl" - symbol = RuntimeTypes.Core.Net.Url.asNullable() + symbol = RuntimeTypes.Core.Net.Url.Url.asNullable() documentation = """ A custom endpoint to route requests to. The endpoint set here is passed to the configured [endpointProvider], which may inspect and modify it as needed. diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/PresignerGenerator.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/PresignerGenerator.kt index 616c13c8083..b6f8d1a70bf 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/PresignerGenerator.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/PresignerGenerator.kt @@ -228,13 +228,13 @@ class PresignerGenerator : KotlinIntegration { if (presignableOp.liftBodyToQueryString) { write("unsignedRequest.method = #T.GET", RuntimeTypes.Http.HttpMethod) withBlock( - "unsignedRequest.body.#T()?.#T()?.#T()?.let { bodyParams ->", + "unsignedRequest.body.#T()?.#T()?.let {", "}", RuntimeTypes.Http.toByteStream, RuntimeTypes.Core.Content.decodeToString, - RuntimeTypes.Core.Net.splitAsQueryParameters, ) { - write("unsignedRequest.url.parameters.appendAll(bodyParams)") + write("val bodyParams = #T.parseEncoded(it)", RuntimeTypes.Core.Net.Url.QueryParameters) + write("unsignedRequest.url.parameters.addAll(bodyParams)") } write("") } diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/polly/PollyPresigner.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/polly/PollyPresigner.kt index 678a87e88f6..fb239a71dfd 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/polly/PollyPresigner.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/polly/PollyPresigner.kt @@ -13,6 +13,7 @@ import software.amazon.smithy.kotlin.codegen.integration.SectionWriterBinding import software.amazon.smithy.kotlin.codegen.model.expectShape import software.amazon.smithy.kotlin.codegen.rendering.protocol.HttpStringValuesMapSerializer import software.amazon.smithy.model.Model +import software.amazon.smithy.model.knowledge.HttpBinding import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.ServiceShape @@ -41,8 +42,11 @@ class PollyPresigner : KotlinIntegration { val defaultTimestampFormat = writer.getContextValue(PresignerGenerator.UnsignedRequestCustomizationSection.DefaultTimestampFormat) writer.write("unsignedRequest.method = #T.GET", RuntimeTypes.Http.HttpMethod) - writer.withBlock("unsignedRequest.url.#T {", "}", RuntimeTypes.Core.Net.parameters) { - val bindings = resolver.requestBindings(operation) + writer.withBlock("unsignedRequest.url.parameters.decodedParameters(#T.SmithyLabel) {", "}", RuntimeTypes.Core.Text.Encoding.PercentEncoding) { + val bindings = resolver + .requestBindings(operation) + .map { it.copy(location = HttpBinding.Location.QUERY_PARAMS) } + HttpStringValuesMapSerializer(ctx.model, ctx.symbolProvider, ctx.settings, bindings, resolver, defaultTimestampFormat).render(writer) } diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3ErrorMetadataIntegration.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3ErrorMetadataIntegration.kt index a905e6517a5..685828a94e7 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3ErrorMetadataIntegration.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/s3/S3ErrorMetadataIntegration.kt @@ -29,7 +29,7 @@ class S3ErrorMetadataIntegration : KotlinIntegration { override fun writeAdditionalFiles(ctx: CodegenContext, delegator: KotlinDelegator) { delegator.useFileWriter("S3ErrorMetadata.kt", "${ctx.settings.pkg.name}.model") { writer -> writer.addImport(AwsRuntimeTypes.Core.AwsErrorMetadata) - writer.addImport(RuntimeTypes.Core.Utils.AttributeKey) + writer.addImport(RuntimeTypes.Core.Collections.AttributeKey) writer.withBlock("public class S3ErrorMetadata : AwsErrorMetadata() {", "}") { writer.withBlock("public companion object {", "}") { diff --git a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/core/AwsHttpProtocolClientGenerator.kt b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/core/AwsHttpProtocolClientGenerator.kt index d3a5c8d9d1e..dcc45d7f0b0 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/core/AwsHttpProtocolClientGenerator.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/core/AwsHttpProtocolClientGenerator.kt @@ -48,7 +48,7 @@ open class AwsHttpProtocolClientGenerator( // set AWS specific span attributes for an operation // https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/instrumentation/aws-sdk/ val addAwsSpanAttrWriter = SectionWriter { w, _ -> - w.withBlock("attributes = #T {", "}", RuntimeTypes.Core.Utils.attributesOf) { + w.withBlock("attributes = #T {", "}", RuntimeTypes.Core.Collections.attributesOf) { write("#S to #S", "rpc.system", "aws-api") } } @@ -126,7 +126,7 @@ internal fun KotlinWriter.putIfAbsent( literalValue: String? = null, nullable: Boolean = false, ) { - val putSymbol = if (nullable) RuntimeTypes.Core.Utils.putIfAbsentNotNull else RuntimeTypes.Core.Utils.putIfAbsent + val putSymbol = if (nullable) RuntimeTypes.Core.Collections.putIfAbsentNotNull else RuntimeTypes.Core.Collections.putIfAbsent val actualValue = literalValue ?: "config.${name.replaceFirstChar(Char::lowercaseChar)}" write("ctx.#T(#T.#L, #L)", putSymbol, attributesSymbol, name, actualValue) } diff --git a/codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/PresignerGeneratorTest.kt b/codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/PresignerGeneratorTest.kt index 1126d1b88aa..38d9ef92160 100644 --- a/codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/PresignerGeneratorTest.kt +++ b/codegen/smithy-aws-kotlin-codegen/src/test/kotlin/aws/sdk/kotlin/codegen/PresignerGeneratorTest.kt @@ -267,8 +267,9 @@ class PresignerGeneratorTest { } val unsignedRequest = GetFooOperationSerializer().serialize(ctx, input) unsignedRequest.method = HttpMethod.GET - unsignedRequest.body.toByteStream()?.decodeToString()?.splitAsQueryParameters()?.let { bodyParams -> - unsignedRequest.url.parameters.appendAll(bodyParams) + unsignedRequest.body.toByteStream()?.decodeToString()?.let { + val bodyParams = QueryParameters.parseEncoded(it) + unsignedRequest.url.parameters.addAll(bodyParams) } val endpointResolver = EndpointResolverAdapter(config) diff --git a/gradle.properties b/gradle.properties index 8852ca33117..c8d628a7d3d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ kotlin.native.ignoreDisabledTargets=true org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=2G # sdk -sdkVersion=0.36.2-SNAPSHOT +sdkVersion=0.37.0-SNAPSHOT # kotlin kotlinVersion=1.9.20 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6a1cc45d1b1..360f57a7f93 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,8 +7,8 @@ coroutines-version = "1.7.3" atomicfu-version = "0.22.0" # smithy-kotlin codegen and runtime are versioned separately -smithy-kotlin-runtime-version = "0.29.0" -smithy-kotlin-codegen-version = "0.29.0" +smithy-kotlin-runtime-version = "0.30.0" +smithy-kotlin-codegen-version = "0.30.0" # codegen smithy-version = "1.41.1" diff --git a/services/glacier/common/src/aws/sdk/kotlin/services/glacier/internal/GlacierBodyChecksum.kt b/services/glacier/common/src/aws/sdk/kotlin/services/glacier/internal/GlacierBodyChecksum.kt index a0d70ce475c..64503ea517a 100644 --- a/services/glacier/common/src/aws/sdk/kotlin/services/glacier/internal/GlacierBodyChecksum.kt +++ b/services/glacier/common/src/aws/sdk/kotlin/services/glacier/internal/GlacierBodyChecksum.kt @@ -12,7 +12,7 @@ import aws.smithy.kotlin.runtime.http.operation.ModifyRequestMiddleware import aws.smithy.kotlin.runtime.http.operation.SdkHttpOperation import aws.smithy.kotlin.runtime.http.operation.SdkHttpRequest import aws.smithy.kotlin.runtime.http.request.headers -import aws.smithy.kotlin.runtime.util.encodeToHex +import aws.smithy.kotlin.runtime.text.encoding.encodeToHex private const val defaultChunkSizeBytes = 1024 * 1024 // 1MB diff --git a/services/glacier/common/test/aws/sdk/kotlin/services/glacier/internal/TreeHasherTest.kt b/services/glacier/common/test/aws/sdk/kotlin/services/glacier/internal/TreeHasherTest.kt index d7e86372afe..5b5d50988a4 100644 --- a/services/glacier/common/test/aws/sdk/kotlin/services/glacier/internal/TreeHasherTest.kt +++ b/services/glacier/common/test/aws/sdk/kotlin/services/glacier/internal/TreeHasherTest.kt @@ -14,7 +14,7 @@ import aws.smithy.kotlin.runtime.io.SdkBuffer import aws.smithy.kotlin.runtime.io.SdkByteChannel import aws.smithy.kotlin.runtime.io.SdkByteReadChannel import aws.smithy.kotlin.runtime.io.SdkSource -import aws.smithy.kotlin.runtime.util.encodeToHex +import aws.smithy.kotlin.runtime.text.encoding.encodeToHex import kotlinx.coroutines.async import kotlinx.coroutines.test.runTest import kotlinx.coroutines.withTimeout diff --git a/services/polly/common/test/aws/sdk/kotlin/services/polly/PollyTest.kt b/services/polly/common/test/aws/sdk/kotlin/services/polly/PollyTest.kt index d0b7b35dcfb..678cce2b341 100644 --- a/services/polly/common/test/aws/sdk/kotlin/services/polly/PollyTest.kt +++ b/services/polly/common/test/aws/sdk/kotlin/services/polly/PollyTest.kt @@ -45,9 +45,9 @@ class PollyPresignerTest { assertEquals(HttpMethod.GET, presignedRequest.method) assertTrue("Host".equals(presignedRequest.headers.entries().single().key, ignoreCase = true)) assertEquals("polly.us-east-2.amazonaws.com", presignedRequest.headers["Host"]) - assertEquals("/v1/speech", presignedRequest.url.path) + assertEquals("/v1/speech", presignedRequest.url.path.toString()) val expectedQueryParameters = setOf("OutputFormat", "Text", "VoiceId", "X-Amz-Algorithm", "X-Amz-Credential", "X-Amz-Date", "X-Amz-SignedHeaders", "X-Amz-Expires", "X-Amz-Signature") - assertEquals(expectedQueryParameters, presignedRequest.url.parameters.entries().map { it.key }.toSet()) + assertEquals(expectedQueryParameters, presignedRequest.url.parameters.encodedParameters.keys) } finally { pollyClient.close() } diff --git a/services/s3/common/src/aws/sdk/kotlin/services/s3/internal/S3ErrorMetadata.kt b/services/s3/common/src/aws/sdk/kotlin/services/s3/internal/S3ErrorMetadata.kt index 1445c3a0ac5..68ad4342281 100644 --- a/services/s3/common/src/aws/sdk/kotlin/services/s3/internal/S3ErrorMetadata.kt +++ b/services/s3/common/src/aws/sdk/kotlin/services/s3/internal/S3ErrorMetadata.kt @@ -11,11 +11,11 @@ import aws.sdk.kotlin.services.s3.model.S3Exception import aws.smithy.kotlin.runtime.ServiceErrorMetadata import aws.smithy.kotlin.runtime.awsprotocol.AwsErrorDetails import aws.smithy.kotlin.runtime.awsprotocol.setAseErrorMetadata +import aws.smithy.kotlin.runtime.collections.setIfValueNotNull import aws.smithy.kotlin.runtime.http.response.HttpResponse import aws.smithy.kotlin.runtime.serde.* import aws.smithy.kotlin.runtime.serde.xml.XmlDeserializer import aws.smithy.kotlin.runtime.serde.xml.XmlSerialName -import aws.smithy.kotlin.runtime.util.setIfValueNotNull /** * Default header name identifying secondary request ID diff --git a/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/Handle200ErrorsInterceptorTest.kt b/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/Handle200ErrorsInterceptorTest.kt index 1f730818aee..2fb82260a37 100644 --- a/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/Handle200ErrorsInterceptorTest.kt +++ b/services/s3/common/test/aws/sdk/kotlin/services/s3/internal/Handle200ErrorsInterceptorTest.kt @@ -10,11 +10,11 @@ import aws.sdk.kotlin.services.s3.deleteObjects import aws.sdk.kotlin.services.s3.model.S3Exception import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider +import aws.smithy.kotlin.runtime.collections.Attributes import aws.smithy.kotlin.runtime.http.HttpBody import aws.smithy.kotlin.runtime.http.HttpStatusCode import aws.smithy.kotlin.runtime.http.response.HttpResponse import aws.smithy.kotlin.runtime.httptest.buildTestConnection -import aws.smithy.kotlin.runtime.util.Attributes import kotlinx.coroutines.test.runTest import kotlin.test.Test import kotlin.test.assertEquals diff --git a/services/s3/common/test/aws/sdk/kotlin/services/s3/presigners/PresignersTest.kt b/services/s3/common/test/aws/sdk/kotlin/services/s3/presigners/PresignersTest.kt index ea649c95813..d6ff21a5105 100644 --- a/services/s3/common/test/aws/sdk/kotlin/services/s3/presigners/PresignersTest.kt +++ b/services/s3/common/test/aws/sdk/kotlin/services/s3/presigners/PresignersTest.kt @@ -15,7 +15,6 @@ import aws.smithy.kotlin.runtime.http.engine.HttpClientEngineConfig import aws.smithy.kotlin.runtime.http.request.HttpRequest import aws.smithy.kotlin.runtime.io.use import aws.smithy.kotlin.runtime.operation.ExecutionContext -import aws.smithy.kotlin.runtime.util.text.urlDecodeComponent import kotlinx.coroutines.test.runTest import kotlin.test.Test import kotlin.test.assertEquals @@ -48,10 +47,10 @@ class PresignersTest { assertNotNull(aclHeader, "Expected x-amz-acl header to be included in presigned request") assertEquals("bucket-owner-full-control", aclHeader) - val signedHeadersString = presigned.url.parameters["X-Amz-SignedHeaders"] + val signedHeadersString = presigned.url.parameters.decodedParameters["X-Amz-SignedHeaders"]?.single() assertNotNull(signedHeadersString, "Expected X-Amz-SignedHeaders query parameter in URL") - val signedHeaders = signedHeadersString.urlDecodeComponent().split(';') + val signedHeaders = signedHeadersString.split(';') assertTrue(signedHeaders.contains("x-amz-acl"), "Expected x-amz-acl to be signed but only found $signedHeaders") } } diff --git a/services/s3/e2eTest/src/S3IntegrationTest.kt b/services/s3/e2eTest/src/S3IntegrationTest.kt index 6b15ddceb8f..b0c6b3071b2 100644 --- a/services/s3/e2eTest/src/S3IntegrationTest.kt +++ b/services/s3/e2eTest/src/S3IntegrationTest.kt @@ -19,7 +19,7 @@ import aws.smithy.kotlin.runtime.http.HttpException import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor import aws.smithy.kotlin.runtime.http.request.HttpRequest import aws.smithy.kotlin.runtime.testing.RandomTempFile -import aws.smithy.kotlin.runtime.util.encodeToHex +import aws.smithy.kotlin.runtime.text.encoding.encodeToHex import kotlinx.coroutines.* import kotlinx.coroutines.flow.toList import org.junit.jupiter.api.AfterAll diff --git a/tests/codegen/event-stream/src/test/kotlin/HttpEventStreamTests.kt b/tests/codegen/event-stream/src/test/kotlin/HttpEventStreamTests.kt index d513db35762..8402dd270fa 100644 --- a/tests/codegen/event-stream/src/test/kotlin/HttpEventStreamTests.kt +++ b/tests/codegen/event-stream/src/test/kotlin/HttpEventStreamTests.kt @@ -13,6 +13,7 @@ import aws.smithy.kotlin.runtime.auth.awssigning.AwsSigningAttributes import aws.smithy.kotlin.runtime.auth.awssigning.DefaultAwsSigner import aws.smithy.kotlin.runtime.auth.awssigning.HashSpecification import aws.smithy.kotlin.runtime.awsprotocol.eventstream.* +import aws.smithy.kotlin.runtime.collections.get import aws.smithy.kotlin.runtime.http.Headers import aws.smithy.kotlin.runtime.http.HttpBody import aws.smithy.kotlin.runtime.http.HttpCall @@ -23,7 +24,6 @@ import aws.smithy.kotlin.runtime.io.SdkBuffer import aws.smithy.kotlin.runtime.operation.ExecutionContext import aws.smithy.kotlin.runtime.smithy.test.assertJsonStringsEqual import aws.smithy.kotlin.runtime.time.Instant -import aws.smithy.kotlin.runtime.util.get import kotlinx.coroutines.delay import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.single diff --git a/tests/codegen/event-stream/src/test/kotlin/RpcEventStreamTests.kt b/tests/codegen/event-stream/src/test/kotlin/RpcEventStreamTests.kt index 604d10927c2..0b7e4b94651 100644 --- a/tests/codegen/event-stream/src/test/kotlin/RpcEventStreamTests.kt +++ b/tests/codegen/event-stream/src/test/kotlin/RpcEventStreamTests.kt @@ -15,6 +15,7 @@ import aws.smithy.kotlin.runtime.auth.awssigning.AwsSigningAttributes import aws.smithy.kotlin.runtime.auth.awssigning.DefaultAwsSigner import aws.smithy.kotlin.runtime.auth.awssigning.HashSpecification import aws.smithy.kotlin.runtime.awsprotocol.eventstream.* +import aws.smithy.kotlin.runtime.collections.get import aws.smithy.kotlin.runtime.http.Headers import aws.smithy.kotlin.runtime.http.HttpBody import aws.smithy.kotlin.runtime.http.HttpCall @@ -23,7 +24,6 @@ import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder import aws.smithy.kotlin.runtime.http.response.HttpResponse import aws.smithy.kotlin.runtime.io.SdkBuffer import aws.smithy.kotlin.runtime.operation.ExecutionContext -import aws.smithy.kotlin.runtime.util.get import kotlinx.coroutines.delay import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.single