diff --git a/runtime/protocol/http-client/api/http-client.api b/runtime/protocol/http-client/api/http-client.api index eb371f86d..da7abe09f 100644 --- a/runtime/protocol/http-client/api/http-client.api +++ b/runtime/protocol/http-client/api/http-client.api @@ -332,14 +332,19 @@ public final class aws/smithy/kotlin/runtime/http/interceptors/DiscoveredEndpoin } public final class aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptor : aws/smithy/kotlin/runtime/http/interceptors/AbstractChecksumInterceptor { + public fun ()V + public fun (Lkotlin/jvm/functions/Function1;)V + public synthetic fun (Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun (ZLaws/smithy/kotlin/runtime/client/config/HttpChecksumConfigOption;Ljava/lang/String;)V public fun applyChecksum (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;Ljava/lang/String;)Laws/smithy/kotlin/runtime/http/request/HttpRequest; public fun calculateChecksum (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun modifyBeforeSigning (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun readAfterSerialization (Laws/smithy/kotlin/runtime/client/ProtocolRequestInterceptorContext;)V } public final class aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptor : aws/smithy/kotlin/runtime/client/Interceptor { public static final field Companion Laws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptor$Companion; + public fun (Lkotlin/jvm/functions/Function1;)V public fun (ZLaws/smithy/kotlin/runtime/client/config/HttpChecksumConfigOption;Z)V public fun modifyBeforeAttemptCompletion-gIAlu-s (Laws/smithy/kotlin/runtime/client/ResponseInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public fun modifyBeforeCompletion-gIAlu-s (Laws/smithy/kotlin/runtime/client/ResponseInterceptorContext;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; diff --git a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptor.kt b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptor.kt index d96eb03e2..285b81bb3 100644 --- a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptor.kt +++ b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptor.kt @@ -50,11 +50,30 @@ import kotlin.coroutines.coroutineContext * @param requestChecksumAlgorithm The checksum algorithm that the user selected for the request, may be null. */ @InternalApi -public class FlexibleChecksumsRequestInterceptor( +public class FlexibleChecksumsRequestInterceptor( requestChecksumRequired: Boolean, requestChecksumCalculation: HttpChecksumConfigOption?, requestChecksumAlgorithm: String?, ) : AbstractChecksumInterceptor() { + + // FIXME: Remove in next minor version bump + @Deprecated("Old constructor is no longer used but it's kept for backwards compatibility") + public constructor() : this( + false, + HttpChecksumConfigOption.WHEN_REQUIRED, + null, + ) + + // FIXME: Remove in next minor version bump + @Deprecated("Old constructor is no longer used but it's kept for backwards compatibility") + public constructor( + checksumAlgorithmNameInitializer: ((I) -> String?)? = null, + ) : this( + false, + HttpChecksumConfigOption.WHEN_REQUIRED, + null, + ) + private val checksumHeader = buildString { append("x-amz-checksum-") append(requestChecksumAlgorithm?.lowercase() ?: "crc32") @@ -71,8 +90,12 @@ public class FlexibleChecksumsRequestInterceptor( null } + // TODO: Remove in next minor version bump + @Deprecated("readAfterSerialization is no longer used but can't be removed due to backwards incompatibility") + override fun readAfterSerialization(context: ProtocolRequestInterceptorContext) { } + override suspend fun modifyBeforeSigning(context: ProtocolRequestInterceptorContext): HttpRequest { - val logger = coroutineContext.logger() + val logger = coroutineContext.logger>() context.protocolRequest.userProvidedChecksumHeader(logger)?.let { logger.debug { "Checksum was supplied via header, skipping checksum calculation" } diff --git a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptor.kt b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptor.kt index 512eee519..02ae9b7e4 100644 --- a/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptor.kt +++ b/runtime/protocol/http-client/common/src/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptor.kt @@ -44,11 +44,22 @@ internal val CHECKSUM_HEADER_VALIDATION_PRIORITY_LIST: List = listOf( * @param responseChecksumValidation Configuration option that determines when checksum validation should be done. */ @InternalApi -public class FlexibleChecksumsResponseInterceptor( +public class FlexibleChecksumsResponseInterceptor( private val responseValidationRequired: Boolean, private val responseChecksumValidation: HttpChecksumConfigOption?, private val serviceUsesCompositeChecksums: Boolean, ) : HttpInterceptor { + + // FIXME: Remove in next minor version bump + @Deprecated("Old constructor is no longer used but it's kept for backwards compatibility") + public constructor( + shouldValidateResponseChecksumInitializer: (input: I) -> Boolean, + ) : this( + false, + HttpChecksumConfigOption.WHEN_REQUIRED, + false, + ) + @InternalApi public companion object { // The name of the checksum header which was validated. If `null`, validation was not performed. @@ -56,7 +67,7 @@ public class FlexibleChecksumsResponseInterceptor( } override suspend fun modifyBeforeDeserialization(context: ProtocolResponseInterceptorContext): HttpResponse { - val logger = coroutineContext.logger() + val logger = coroutineContext.logger>() val forcedToVerifyChecksum = responseValidationRequired || responseChecksumValidation == HttpChecksumConfigOption.WHEN_SUPPORTED if (!forcedToVerifyChecksum) return context.protocolResponse diff --git a/runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptorTest.kt b/runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptorTest.kt index ec3b32a95..fedfe0dc5 100644 --- a/runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptorTest.kt +++ b/runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsRequestInterceptorTest.kt @@ -42,7 +42,7 @@ class FlexibleChecksumsRequestInterceptorTest { val op = newTestOperation(req, Unit) op.interceptors.add( - FlexibleChecksumsRequestInterceptor( + FlexibleChecksumsRequestInterceptor( requestChecksumAlgorithm = checksumAlgorithmName, requestChecksumRequired = true, requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED, @@ -69,7 +69,7 @@ class FlexibleChecksumsRequestInterceptorTest { val op = newTestOperation(req, Unit) op.interceptors.add( - FlexibleChecksumsRequestInterceptor( + FlexibleChecksumsRequestInterceptor( requestChecksumAlgorithm = checksumAlgorithmName, requestChecksumRequired = true, requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED, @@ -94,7 +94,7 @@ class FlexibleChecksumsRequestInterceptorTest { assertFailsWith { op.interceptors.add( - FlexibleChecksumsRequestInterceptor( + FlexibleChecksumsRequestInterceptor( requestChecksumAlgorithm = unsupportedChecksumAlgorithmName, requestChecksumRequired = true, requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED, @@ -120,7 +120,7 @@ class FlexibleChecksumsRequestInterceptorTest { val op = newTestOperation(req, Unit) op.interceptors.add( - FlexibleChecksumsRequestInterceptor( + FlexibleChecksumsRequestInterceptor( requestChecksumAlgorithm = checksumAlgorithmName, requestChecksumRequired = true, requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED, @@ -188,7 +188,7 @@ class FlexibleChecksumsRequestInterceptorTest { val op = newTestOperation(req, Unit) op.interceptors.add( - FlexibleChecksumsRequestInterceptor( + FlexibleChecksumsRequestInterceptor( requestChecksumAlgorithm = checksumAlgorithmName, requestChecksumRequired = true, requestChecksumCalculation = HttpChecksumConfigOption.WHEN_SUPPORTED, diff --git a/runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptorTest.kt b/runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptorTest.kt index bd72f5522..097dcb348 100644 --- a/runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptorTest.kt +++ b/runtime/protocol/http-client/common/test/aws/smithy/kotlin/runtime/http/interceptors/FlexibleChecksumsResponseInterceptorTest.kt @@ -74,7 +74,7 @@ class FlexibleChecksumsResponseInterceptorTest { val op = newTestOperation(req) op.interceptors.add( - FlexibleChecksumsResponseInterceptor( + FlexibleChecksumsResponseInterceptor( responseValidationRequired = true, responseChecksumValidation = HttpChecksumConfigOption.WHEN_SUPPORTED, serviceUsesCompositeChecksums = false, @@ -102,7 +102,7 @@ class FlexibleChecksumsResponseInterceptorTest { val op = newTestOperation(req) op.interceptors.add( - FlexibleChecksumsResponseInterceptor( + FlexibleChecksumsResponseInterceptor( responseValidationRequired = true, responseChecksumValidation = HttpChecksumConfigOption.WHEN_SUPPORTED, serviceUsesCompositeChecksums = false, @@ -131,7 +131,7 @@ class FlexibleChecksumsResponseInterceptorTest { val op = newTestOperation(req) op.interceptors.add( - FlexibleChecksumsResponseInterceptor( + FlexibleChecksumsResponseInterceptor( responseValidationRequired = true, responseChecksumValidation = HttpChecksumConfigOption.WHEN_SUPPORTED, serviceUsesCompositeChecksums = false, @@ -157,7 +157,7 @@ class FlexibleChecksumsResponseInterceptorTest { val op = newTestOperation(req) op.interceptors.add( - FlexibleChecksumsResponseInterceptor( + FlexibleChecksumsResponseInterceptor( responseValidationRequired = true, responseChecksumValidation = HttpChecksumConfigOption.WHEN_SUPPORTED, serviceUsesCompositeChecksums = false, @@ -179,11 +179,11 @@ class FlexibleChecksumsResponseInterceptorTest { val op = newTestOperation(req) op.interceptors.add( - FlexibleChecksumsResponseInterceptor ( + FlexibleChecksumsResponseInterceptor( responseValidationRequired = false, responseChecksumValidation = HttpChecksumConfigOption.WHEN_REQUIRED, serviceUsesCompositeChecksums = false, - ) + ), ) val responseChecksumHeaderName = "x-amz-checksum-crc32" diff --git a/runtime/runtime-core/api/runtime-core.api b/runtime/runtime-core/api/runtime-core.api index 10785da5a..0a4b7de75 100644 --- a/runtime/runtime-core/api/runtime-core.api +++ b/runtime/runtime-core/api/runtime-core.api @@ -111,6 +111,7 @@ public final class aws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetri public static final field WAITER Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric; public static fun getEntries ()Lkotlin/enums/EnumEntries; public fun getIdentifier ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; public static fun valueOf (Ljava/lang/String;)Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric; public static fun values ()[Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric; }