Skip to content

Commit 54dae6a

Browse files
authored
chore: remove @deprecated APIs in preparation for v1.5 (#1310)
1 parent 91db7e9 commit 54dae6a

File tree

23 files changed

+141
-707
lines changed

23 files changed

+141
-707
lines changed

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/aws/protocols/AwsQuery.kt

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@ import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AbstractQueryFor
1111
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AwsHttpBindingProtocolGenerator
1212
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.QueryHttpBindingProtocolGenerator
1313
import software.amazon.smithy.kotlin.codegen.aws.protocols.formurl.QuerySerdeFormUrlDescriptorGenerator
14-
import software.amazon.smithy.kotlin.codegen.core.*
14+
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
15+
import software.amazon.smithy.kotlin.codegen.core.RenderingContext
16+
import software.amazon.smithy.kotlin.codegen.core.RuntimeTypes
17+
import software.amazon.smithy.kotlin.codegen.core.withBlock
1518
import software.amazon.smithy.kotlin.codegen.lang.KotlinTypes
16-
import software.amazon.smithy.kotlin.codegen.model.*
17-
import software.amazon.smithy.kotlin.codegen.rendering.protocol.*
18-
import software.amazon.smithy.kotlin.codegen.rendering.serde.*
19+
import software.amazon.smithy.kotlin.codegen.model.buildSymbol
20+
import software.amazon.smithy.kotlin.codegen.model.getTrait
21+
import software.amazon.smithy.kotlin.codegen.model.hasTrait
22+
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator
23+
import software.amazon.smithy.kotlin.codegen.rendering.protocol.toRenderingContext
24+
import software.amazon.smithy.kotlin.codegen.rendering.serde.FormUrlSerdeDescriptorGenerator
25+
import software.amazon.smithy.kotlin.codegen.rendering.serde.StructuredDataParserGenerator
26+
import software.amazon.smithy.kotlin.codegen.rendering.serde.StructuredDataSerializerGenerator
27+
import software.amazon.smithy.kotlin.codegen.rendering.serde.XmlParserGenerator
1928
import software.amazon.smithy.model.shapes.*
20-
import software.amazon.smithy.model.traits.*
29+
import software.amazon.smithy.model.traits.XmlFlattenedTrait
30+
import software.amazon.smithy.model.traits.XmlNameTrait
2131

2232
/**
2333
* Handles generating the aws.protocols#awsQuery protocol for services.
@@ -45,7 +55,7 @@ class AwsQuery : QueryHttpBindingProtocolGenerator() {
4555
writer: KotlinWriter,
4656
) {
4757
writer.write("""checkNotNull(payload){ "unable to parse error from empty response" }""")
48-
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseRestXmlErrorResponseNoSuspend)
58+
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseRestXmlErrorResponse)
4959
}
5060
}
5161

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/aws/protocols/Ec2Query.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import software.amazon.smithy.codegen.core.Symbol
1010
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.AbstractQueryFormUrlSerializerGenerator
1111
import software.amazon.smithy.kotlin.codegen.aws.protocols.core.QueryHttpBindingProtocolGenerator
1212
import software.amazon.smithy.kotlin.codegen.aws.protocols.formurl.QuerySerdeFormUrlDescriptorGenerator
13-
import software.amazon.smithy.kotlin.codegen.core.*
13+
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
14+
import software.amazon.smithy.kotlin.codegen.core.RenderingContext
15+
import software.amazon.smithy.kotlin.codegen.core.RuntimeTypes
16+
import software.amazon.smithy.kotlin.codegen.core.withBlock
1417
import software.amazon.smithy.kotlin.codegen.model.buildSymbol
1518
import software.amazon.smithy.kotlin.codegen.model.getTrait
1619
import software.amazon.smithy.kotlin.codegen.model.isNullable
@@ -39,7 +42,7 @@ class Ec2Query : QueryHttpBindingProtocolGenerator() {
3942
writer: KotlinWriter,
4043
) {
4144
writer.write("""checkNotNull(payload){ "unable to parse error from empty response" }""")
42-
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseEc2QueryErrorResponseNoSuspend)
45+
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseEc2QueryErrorResponse)
4346
}
4447
}
4548

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/aws/protocols/RestXml.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ open class RestXml : AwsHttpBindingProtocolGenerator() {
6363
writer: KotlinWriter,
6464
) {
6565
writer.write("""checkNotNull(payload){ "unable to parse error from empty response" }""")
66-
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseRestXmlErrorResponseNoSuspend)
66+
writer.write("#T(payload)", RuntimeTypes.AwsXmlProtocols.parseRestXmlErrorResponse)
6767
}
6868
}
6969

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/core/RuntimeTypes.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ object RuntimeTypes {
456456
val RestJsonErrorDeserializer = symbol("RestJsonErrorDeserializer")
457457
}
458458
object AwsXmlProtocols : RuntimeTypePackage(KotlinDependency.AWS_XML_PROTOCOLS) {
459-
val parseRestXmlErrorResponseNoSuspend = symbol("parseRestXmlErrorResponseNoSuspend")
460-
val parseEc2QueryErrorResponseNoSuspend = symbol("parseEc2QueryErrorResponseNoSuspend")
459+
val parseRestXmlErrorResponse = symbol("parseRestXmlErrorResponse")
460+
val parseEc2QueryErrorResponse = symbol("parseEc2QueryErrorResponse")
461461
}
462462

463463
object SmithyRpcV2Protocols : RuntimeTypePackage(KotlinDependency.SMITHY_RPCV2_PROTOCOLS) {

runtime/auth/aws-signing-common/api/aws-signing-common.api

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,6 @@ public final class aws/smithy/kotlin/runtime/auth/awssigning/PresignerKt {
199199
public static final fun presignRequest (Laws/smithy/kotlin/runtime/http/request/HttpRequestBuilder;Laws/smithy/kotlin/runtime/operation/ExecutionContext;Laws/smithy/kotlin/runtime/auth/awscredentials/CredentialsProvider;Laws/smithy/kotlin/runtime/http/operation/EndpointResolver;Laws/smithy/kotlin/runtime/auth/awssigning/AwsSigner;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
200200
}
201201

202-
public final class aws/smithy/kotlin/runtime/auth/awssigning/UnsupportedSigningAlgorithmException : aws/smithy/kotlin/runtime/ClientException {
203-
public fun <init> (Ljava/lang/String;Laws/smithy/kotlin/runtime/auth/awssigning/AwsSigningAlgorithm;)V
204-
public fun <init> (Ljava/lang/String;Laws/smithy/kotlin/runtime/auth/awssigning/AwsSigningAlgorithm;Ljava/lang/Throwable;)V
205-
public synthetic fun <init> (Ljava/lang/String;Laws/smithy/kotlin/runtime/auth/awssigning/AwsSigningAlgorithm;Ljava/lang/Throwable;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
206-
public final fun getSigningAlgorithm ()Laws/smithy/kotlin/runtime/auth/awssigning/AwsSigningAlgorithm;
207-
}
208-
209202
public final class aws/smithy/kotlin/runtime/auth/awssigning/internal/AwsChunkedUtilKt {
210203
public static final field AWS_CHUNKED_THRESHOLD I
211204
public static final field CHUNK_SIZE_BYTES I

runtime/auth/aws-signing-common/common/src/aws/smithy/kotlin/runtime/auth/awssigning/AwsSigningExceptions.kt

Lines changed: 0 additions & 37 deletions
This file was deleted.

runtime/auth/aws-signing-tests/jvm/src/aws/smithy/kotlin/runtime/auth/awssigning/tests/SigningSuiteTestBaseJVM.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import aws.smithy.kotlin.runtime.auth.awssigning.*
1111
import aws.smithy.kotlin.runtime.collections.Attributes
1212
import aws.smithy.kotlin.runtime.collections.ValuesMap
1313
import aws.smithy.kotlin.runtime.collections.get
14-
import aws.smithy.kotlin.runtime.http.*
14+
import aws.smithy.kotlin.runtime.http.HttpBody
15+
import aws.smithy.kotlin.runtime.http.HttpMethod
16+
import aws.smithy.kotlin.runtime.http.SdkHttpClient
1517
import aws.smithy.kotlin.runtime.http.auth.AwsHttpSigner
1618
import aws.smithy.kotlin.runtime.http.auth.SigV4AuthScheme
1719
import aws.smithy.kotlin.runtime.http.operation.*
@@ -24,9 +26,7 @@ import aws.smithy.kotlin.runtime.net.url.Url
2426
import aws.smithy.kotlin.runtime.operation.ExecutionContext
2527
import aws.smithy.kotlin.runtime.time.Instant
2628
import io.ktor.http.cio.*
27-
import io.ktor.util.*
2829
import io.ktor.utils.io.*
29-
import io.ktor.utils.io.core.*
3030
import kotlinx.coroutines.runBlocking
3131
import kotlinx.io.readByteArray
3232
import kotlinx.serialization.json.*
@@ -420,8 +420,7 @@ private fun buildOperation(
420420
serializeWith = object : HttpSerializer.NonStreaming<Unit> {
421421
override fun serialize(context: ExecutionContext, input: Unit): HttpRequestBuilder = serialized
422422
}
423-
@Suppress("DEPRECATION")
424-
deserializer = IdentityDeserializer
423+
deserializeWith = HttpDeserializer.Identity
425424

426425
context {
427426
operationName = "testSigningOperation"

runtime/auth/http-auth-aws/common/test/aws/smithy/kotlin/runtime/http/auth/AwsHttpSignerTestBase.kt

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,43 +37,23 @@ class DefaultAwsHttpSignerTest : AwsHttpSignerTestBase(DefaultAwsSigner)
3737
* Basic sanity tests. Signing (including `AwsHttpSigner`) is covered by the more exhaustive
3838
* test suite in the `aws-signing-tests` module.
3939
*/
40-
@Suppress("HttpUrlsUsage")
4140
public abstract class AwsHttpSignerTestBase(
4241
private val signer: AwsSigner,
4342
) {
4443
private val testCredentials = Credentials("AKID", "SECRET", "SESSION")
4544

46-
@Suppress("DEPRECATION")
4745
private fun buildOperation(
4846
requestBody: String = "{\"TableName\": \"foo\"}",
4947
streaming: Boolean = false,
5048
replayable: Boolean = true,
5149
unsigned: Boolean = false,
5250
): SdkHttpOperation<Unit, HttpResponse> {
5351
val operation: SdkHttpOperation<Unit, HttpResponse> = SdkHttpOperation.build {
54-
serializer = object : HttpSerialize<Unit> {
55-
override suspend fun serialize(context: ExecutionContext, input: Unit): HttpRequestBuilder =
56-
HttpRequestBuilder().apply {
57-
method = HttpMethod.POST
58-
url.scheme = Scheme.HTTP
59-
url.host = Host.Domain("demo.us-east-1.amazonaws.com")
60-
url.path.encoded = "/"
61-
headers.append("Host", "demo.us-east-1.amazonaws.com")
62-
headers.appendAll("x-amz-archive-description", listOf("test", "test"))
63-
body = when (streaming) {
64-
true -> {
65-
object : HttpBody.ChannelContent() {
66-
override val contentLength: Long = requestBody.length.toLong()
67-
override fun readFrom(): SdkByteReadChannel = SdkByteReadChannel(requestBody.encodeToByteArray())
68-
override val isOneShot: Boolean = !replayable
69-
}
70-
}
71-
false -> HttpBody.fromBytes(requestBody.encodeToByteArray())
72-
}
73-
headers.append("Content-Length", body.contentLength?.toString() ?: "0")
74-
}
52+
serializeWith = when (streaming) {
53+
true -> StreamingSerializer(requestBody, replayable)
54+
false -> NonStreamingSerializer(requestBody)
7555
}
76-
deserializer = IdentityDeserializer
56+
deserializeWith = HttpDeserializer.Identity
7757
operationName = "testSigningOperation"
7858
serviceName = "testService"
7959
context {
@@ -186,3 +166,36 @@ public abstract class AwsHttpSignerTestBase(
186166
assertEquals(expectedSig, signed.headers["Authorization"])
187167
}
188168
}
169+
170+
private class NonStreamingSerializer(private val requestBody: String) : HttpSerializer.NonStreaming<Unit> {
171+
override fun serialize(context: ExecutionContext, input: Unit) = HttpRequestBuilder().apply {
172+
method = HttpMethod.POST
173+
url.scheme = Scheme.HTTP
174+
url.host = Host.Domain("demo.us-east-1.amazonaws.com")
175+
url.path.encoded = "/"
176+
body = HttpBody.fromBytes(requestBody.encodeToByteArray())
177+
headers.append("Host", "demo.us-east-1.amazonaws.com")
178+
headers.appendAll("x-amz-archive-description", listOf("test", "test"))
179+
headers.append("Content-Length", body.contentLength?.toString() ?: "0")
180+
}
181+
}
182+
183+
private class StreamingSerializer(
184+
private val requestBody: String,
185+
private val replayable: Boolean,
186+
) : HttpSerializer.Streaming<Unit> {
187+
override suspend fun serialize(context: ExecutionContext, input: Unit) = HttpRequestBuilder().apply {
188+
method = HttpMethod.POST
189+
url.scheme = Scheme.HTTP
190+
url.host = Host.Domain("demo.us-east-1.amazonaws.com")
191+
url.path.encoded = "/"
192+
body = object : HttpBody.ChannelContent() {
193+
override val contentLength: Long = requestBody.length.toLong()
194+
override fun readFrom(): SdkByteReadChannel = SdkByteReadChannel(requestBody.encodeToByteArray())
195+
override val isOneShot: Boolean = !replayable
196+
}
197+
headers.append("Host", "demo.us-east-1.amazonaws.com")
198+
headers.appendAll("x-amz-archive-description", listOf("test", "test"))
199+
headers.append("Content-Length", body.contentLength?.toString() ?: "0")
200+
}
201+
}

runtime/protocol/aws-json-protocols/common/test/aws/smithy/kotlin/runtime/awsprotocol/json/AwsJsonProtocolTest.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
package aws.smithy.kotlin.runtime.awsprotocol.json
77

88
import aws.smithy.kotlin.runtime.collections.get
9-
import aws.smithy.kotlin.runtime.http.*
9+
import aws.smithy.kotlin.runtime.http.HttpBody
10+
import aws.smithy.kotlin.runtime.http.SdkHttpClient
1011
import aws.smithy.kotlin.runtime.http.operation.*
12+
import aws.smithy.kotlin.runtime.http.readAll
1113
import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder
1214
import aws.smithy.kotlin.runtime.http.response.HttpResponse
1315
import aws.smithy.kotlin.runtime.httptest.TestEngine
@@ -20,10 +22,9 @@ class AwsJsonProtocolTest {
2022

2123
@Test
2224
fun testSetJsonProtocolHeaders() = runTest {
23-
@Suppress("DEPRECATION")
2425
val op = SdkHttpOperation.build<Unit, HttpResponse> {
25-
serializer = UnitSerializer
26-
deserializer = IdentityDeserializer
26+
serializeWith = HttpSerializer.Unit
27+
deserializeWith = HttpDeserializer.Identity
2728
operationName = "Bar"
2829
serviceName = "Foo"
2930
}
@@ -42,10 +43,9 @@ class AwsJsonProtocolTest {
4243

4344
@Test
4445
fun testEmptyBody() = runTest {
45-
@Suppress("DEPRECATION")
4646
val op = SdkHttpOperation.build<Unit, HttpResponse> {
47-
serializer = UnitSerializer
48-
deserializer = IdentityDeserializer
47+
serializeWith = HttpSerializer.Unit
48+
deserializeWith = HttpDeserializer.Identity
4949
operationName = "Bar"
5050
serviceName = "Foo"
5151
}
@@ -63,14 +63,14 @@ class AwsJsonProtocolTest {
6363
fun testDoesNotOverride() = runTest {
6464
@Suppress("DEPRECATION")
6565
val op = SdkHttpOperation.build<Unit, HttpResponse> {
66-
serializer = object : HttpSerialize<Unit> {
67-
override suspend fun serialize(context: ExecutionContext, input: Unit): HttpRequestBuilder =
66+
serializeWith = object : HttpSerializer.NonStreaming<Unit> {
67+
override fun serialize(context: ExecutionContext, input: Unit): HttpRequestBuilder =
6868
HttpRequestBuilder().apply {
6969
headers["Content-Type"] = "application/xml"
7070
body = HttpBody.fromBytes("foo".encodeToByteArray())
7171
}
7272
}
73-
deserializer = IdentityDeserializer
73+
deserializeWith = HttpDeserializer.Identity
7474
operationName = "Bar"
7575
serviceName = "Foo"
7676
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
public final class aws/smithy/kotlin/runtime/awsprotocol/xml/Ec2QueryErrorDeserializerKt {
2-
public static final fun parseEc2QueryErrorResponse ([BLkotlin/coroutines/Continuation;)Ljava/lang/Object;
3-
public static final fun parseEc2QueryErrorResponseNoSuspend ([B)Laws/smithy/kotlin/runtime/awsprotocol/ErrorDetails;
2+
public static final fun parseEc2QueryErrorResponse ([B)Laws/smithy/kotlin/runtime/awsprotocol/ErrorDetails;
43
}
54

65
public final class aws/smithy/kotlin/runtime/awsprotocol/xml/RestXmlErrorDeserializerKt {
7-
public static final fun parseRestXmlErrorResponse ([BLkotlin/coroutines/Continuation;)Ljava/lang/Object;
8-
public static final fun parseRestXmlErrorResponseNoSuspend ([B)Laws/smithy/kotlin/runtime/awsprotocol/ErrorDetails;
6+
public static final fun parseRestXmlErrorResponse ([B)Laws/smithy/kotlin/runtime/awsprotocol/ErrorDetails;
97
}
108

0 commit comments

Comments
 (0)