Skip to content

Commit 40bb298

Browse files
committed
PR feedback and fix breaking changes
1 parent fb3a52a commit 40bb298

File tree

6 files changed

+55
-15
lines changed

6 files changed

+55
-15
lines changed

runtime/protocol/http-client/api/http-client.api

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,19 @@ public final class aws/smithy/kotlin/runtime/http/interceptors/DiscoveredEndpoin
332332
}
333333

334334
public final class aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptor : aws/smithy/kotlin/runtime/http/interceptors/AbstractChecksumInterceptor {
335+
public fun <init> ()V
336+
public fun <init> (Lkotlin/jvm/functions/Function1;)V
337+
public synthetic fun <init> (Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
335338
public fun <init> (ZLaws/smithy/kotlin/runtime/client/config/HttpChecksumConfigOption;Ljava/lang/String;)V
336339
public fun applyChecksum (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;Ljava/lang/String;)Laws/smithy/kotlin/runtime/http/request/HttpRequest;
337340
public fun calculateChecksum (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
338341
public fun modifyBeforeSigning (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
342+
public fun readAfterSerialization (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;)V
339343
}
340344

341345
public final class aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptor : aws/smithy/kotlin/runtime/client/Interceptor {
342346
public static final field Companion Laws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptor$Companion;
347+
public fun <init> (Lkotlin/jvm/functions/Function1;)V
343348
public fun <init> (ZLaws/smithy/kotlin/runtime/client/config/HttpChecksumConfigOption;Z)V
344349
public fun modifyBeforeAttemptCompletion-gIAlu-s (Laws/smithy/kotlin/runtime/client/ResponseInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
345350
public fun modifyBeforeCompletion-gIAlu-s (Laws/smithy/kotlin/runtime/client/ResponseInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;

runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptor.kt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,30 @@ import kotlin.coroutines.coroutineContext
5050
* @param requestChecksumAlgorithm The checksum algorithm that the user selected for the request, may be null.
5151
*/
5252
@InternalApi
53-
public class FlexibleChecksumsRequestInterceptor(
53+
public class FlexibleChecksumsRequestInterceptor<I>(
5454
requestChecksumRequired: Boolean,
5555
requestChecksumCalculation: HttpChecksumConfigOption?,
5656
requestChecksumAlgorithm: String?,
5757
) : AbstractChecksumInterceptor() {
58+
59+
// FIXME: Remove in next minor version bump
60+
@Deprecated("Old constructor is no longer used but it's kept for backwards compatibility")
61+
public constructor() : this(
62+
false,
63+
HttpChecksumConfigOption.WHEN_REQUIRED,
64+
null,
65+
)
66+
67+
// FIXME: Remove in next minor version bump
68+
@Deprecated("Old constructor is no longer used but it's kept for backwards compatibility")
69+
public constructor(
70+
checksumAlgorithmNameInitializer: ((I) -> String?)? = null,
71+
) : this(
72+
false,
73+
HttpChecksumConfigOption.WHEN_REQUIRED,
74+
null,
75+
)
76+
5877
private val checksumHeader = buildString {
5978
append("x-amz-checksum-")
6079
append(requestChecksumAlgorithm?.lowercase() ?: "crc32")
@@ -71,8 +90,12 @@ public class FlexibleChecksumsRequestInterceptor(
7190
null
7291
}
7392

93+
// TODO: Remove in next minor version bump
94+
@Deprecated("readAfterSerialization is no longer used but can't be removed due to backwards incompatibility")
95+
override fun readAfterSerialization(context: ProtocolRequestInterceptorContext<Any, HttpRequest>) { }
96+
7497
override suspend fun modifyBeforeSigning(context: ProtocolRequestInterceptorContext<Any, HttpRequest>): HttpRequest {
75-
val logger = coroutineContext.logger<FlexibleChecksumsRequestInterceptor>()
98+
val logger = coroutineContext.logger<FlexibleChecksumsRequestInterceptor<I>>()
7699

77100
context.protocolRequest.userProvidedChecksumHeader(logger)?.let {
78101
logger.debug { "Checksum was supplied via header, skipping checksum calculation" }

runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptor.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,30 @@ internal val CHECKSUM_HEADER_VALIDATION_PRIORITY_LIST: List<String> = listOf(
4444
* @param responseChecksumValidation Configuration option that determines when checksum validation should be done.
4545
*/
4646
@InternalApi
47-
public class FlexibleChecksumsResponseInterceptor(
47+
public class FlexibleChecksumsResponseInterceptor<I>(
4848
private val responseValidationRequired: Boolean,
4949
private val responseChecksumValidation: HttpChecksumConfigOption?,
5050
private val serviceUsesCompositeChecksums: Boolean,
5151
) : HttpInterceptor {
52+
53+
// FIXME: Remove in next minor version bump
54+
@Deprecated("Old constructor is no longer used but it's kept for backwards compatibility")
55+
public constructor(
56+
shouldValidateResponseChecksumInitializer: (input: I) -> Boolean,
57+
) : this(
58+
false,
59+
HttpChecksumConfigOption.WHEN_REQUIRED,
60+
false,
61+
)
62+
5263
@InternalApi
5364
public companion object {
5465
// The name of the checksum header which was validated. If `null`, validation was not performed.
5566
public val ChecksumHeaderValidated: AttributeKey<String> = AttributeKey("ChecksumHeaderValidated")
5667
}
5768

5869
override suspend fun modifyBeforeDeserialization(context: ProtocolResponseInterceptorContext<Any, HttpRequest, HttpResponse>): HttpResponse {
59-
val logger = coroutineContext.logger<FlexibleChecksumsResponseInterceptor>()
70+
val logger = coroutineContext.logger<FlexibleChecksumsResponseInterceptor<I>>()
6071

6172
val forcedToVerifyChecksum = responseValidationRequired || responseChecksumValidation == HttpChecksumConfigOption.WHEN_SUPPORTED
6273
if (!forcedToVerifyChecksum) return context.protocolResponse

runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptorTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class FlexibleChecksumsRequestInterceptorTest {
4242
val op = newTestOperation<Unit, Unit>(req, Unit)
4343

4444
op.interceptors.add(
45-
FlexibleChecksumsRequestInterceptor(
45+
FlexibleChecksumsRequestInterceptor<Unit>(
4646
requestChecksumAlgorithm = checksumAlgorithmName,
4747
requestChecksumRequired = true,
4848
requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED,
@@ -69,7 +69,7 @@ class FlexibleChecksumsRequestInterceptorTest {
6969
val op = newTestOperation<Unit, Unit>(req, Unit)
7070

7171
op.interceptors.add(
72-
FlexibleChecksumsRequestInterceptor(
72+
FlexibleChecksumsRequestInterceptor<Unit>(
7373
requestChecksumAlgorithm = checksumAlgorithmName,
7474
requestChecksumRequired = true,
7575
requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED,
@@ -94,7 +94,7 @@ class FlexibleChecksumsRequestInterceptorTest {
9494

9595
assertFailsWith<ClientException> {
9696
op.interceptors.add(
97-
FlexibleChecksumsRequestInterceptor(
97+
FlexibleChecksumsRequestInterceptor<Unit>(
9898
requestChecksumAlgorithm = unsupportedChecksumAlgorithmName,
9999
requestChecksumRequired = true,
100100
requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED,
@@ -120,7 +120,7 @@ class FlexibleChecksumsRequestInterceptorTest {
120120
val op = newTestOperation<Unit, Unit>(req, Unit)
121121

122122
op.interceptors.add(
123-
FlexibleChecksumsRequestInterceptor(
123+
FlexibleChecksumsRequestInterceptor<Unit>(
124124
requestChecksumAlgorithm = checksumAlgorithmName,
125125
requestChecksumRequired = true,
126126
requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED,
@@ -188,7 +188,7 @@ class FlexibleChecksumsRequestInterceptorTest {
188188
val op = newTestOperation<Unit, Unit>(req, Unit)
189189

190190
op.interceptors.add(
191-
FlexibleChecksumsRequestInterceptor(
191+
FlexibleChecksumsRequestInterceptor<Unit>(
192192
requestChecksumAlgorithm = checksumAlgorithmName,
193193
requestChecksumRequired = true,
194194
requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED,

runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptorTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class FlexibleChecksumsResponseInterceptorTest {
7474
val op = newTestOperation<TestInput>(req)
7575

7676
op.interceptors.add(
77-
FlexibleChecksumsResponseInterceptor(
77+
FlexibleChecksumsResponseInterceptor<TestInput>(
7878
responseValidationRequired = true,
7979
responseChecksumValidation = HttpChecksumConfigOption.WHEN_SUPPORTED,
8080
serviceUsesCompositeChecksums = false,
@@ -102,7 +102,7 @@ class FlexibleChecksumsResponseInterceptorTest {
102102
val op = newTestOperation<TestInput>(req)
103103

104104
op.interceptors.add(
105-
FlexibleChecksumsResponseInterceptor(
105+
FlexibleChecksumsResponseInterceptor<TestInput>(
106106
responseValidationRequired = true,
107107
responseChecksumValidation = HttpChecksumConfigOption.WHEN_SUPPORTED,
108108
serviceUsesCompositeChecksums = false,
@@ -131,7 +131,7 @@ class FlexibleChecksumsResponseInterceptorTest {
131131
val op = newTestOperation<TestInput>(req)
132132

133133
op.interceptors.add(
134-
FlexibleChecksumsResponseInterceptor(
134+
FlexibleChecksumsResponseInterceptor<TestInput>(
135135
responseValidationRequired = true,
136136
responseChecksumValidation = HttpChecksumConfigOption.WHEN_SUPPORTED,
137137
serviceUsesCompositeChecksums = false,
@@ -157,7 +157,7 @@ class FlexibleChecksumsResponseInterceptorTest {
157157
val op = newTestOperation<TestInput>(req)
158158

159159
op.interceptors.add(
160-
FlexibleChecksumsResponseInterceptor(
160+
FlexibleChecksumsResponseInterceptor<TestInput>(
161161
responseValidationRequired = true,
162162
responseChecksumValidation = HttpChecksumConfigOption.WHEN_SUPPORTED,
163163
serviceUsesCompositeChecksums = false,
@@ -179,11 +179,11 @@ class FlexibleChecksumsResponseInterceptorTest {
179179
val op = newTestOperation<TestInput>(req)
180180

181181
op.interceptors.add(
182-
FlexibleChecksumsResponseInterceptor (
182+
FlexibleChecksumsResponseInterceptor<TestInput>(
183183
responseValidationRequired = false,
184184
responseChecksumValidation = HttpChecksumConfigOption.WHEN_REQUIRED,
185185
serviceUsesCompositeChecksums = false,
186-
)
186+
),
187187
)
188188

189189
val responseChecksumHeaderName = "x-amz-checksum-crc32"

runtime/runtime-core/api/runtime-core.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public final class aws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetri
111111
public static final field WAITER Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
112112
public static fun getEntries ()Lkotlin/enums/EnumEntries;
113113
public fun getIdentifier ()Ljava/lang/String;
114+
public fun toString ()Ljava/lang/String;
114115
public static fun valueOf (Ljava/lang/String;)Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
115116
public static fun values ()[Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
116117
}

0 commit comments

Comments
 (0)