commonMain.aws.sdk.kotlin.services.finspace.endpoints.internal.ResolveEndpoint.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finspace-jvm Show documentation
Show all versions of finspace-jvm Show documentation
The AWS SDK for Kotlin client for finspace
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.finspace.endpoints.internal
import aws.sdk.kotlin.runtime.endpoint.applyToRequest
import aws.sdk.kotlin.runtime.endpoint.authScheme
import aws.sdk.kotlin.services.finspace.FinspaceClient
import aws.sdk.kotlin.services.finspace.endpoints.EndpointParameters
import aws.sdk.kotlin.services.finspace.endpoints.EndpointProvider
import aws.smithy.kotlin.runtime.client.ProtocolRequestInterceptorContext
import aws.smithy.kotlin.runtime.client.RequestInterceptorContext
import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor
import aws.smithy.kotlin.runtime.http.middleware.setResolvedEndpoint
import aws.smithy.kotlin.runtime.http.operation.SdkHttpRequest
import aws.smithy.kotlin.runtime.http.request.HttpRequest
import aws.smithy.kotlin.runtime.http.request.toBuilder
import aws.smithy.kotlin.runtime.tracing.debug
import kotlin.coroutines.coroutineContext
internal class ResolveEndpoint(
private val endpointProvider: EndpointProvider,
private val buildParams: EndpointParameters.Builder.(input: I) -> Unit,
): HttpInterceptor {
private lateinit var params: EndpointParameters
override fun readBeforeSerialization(context: RequestInterceptorContext) {
@Suppress("UNCHECKED_CAST")
val input = context.request as I
params = EndpointParameters { buildParams(input) }
}
override suspend fun modifyBeforeRetryLoop(context: ProtocolRequestInterceptorContext): HttpRequest {
val endpoint = endpointProvider.resolveEndpoint(params)
coroutineContext.debug>{ "resolved endpoint: $endpoint" }
val reqBuilder = context.protocolRequest.toBuilder()
val req = SdkHttpRequest(context.executionContext, reqBuilder)
setResolvedEndpoint(req, endpoint)
endpoint.authScheme?.applyToRequest(req)
return req.subject.build()
}
}
internal fun EndpointParameters.Builder.bindAwsBuiltins(config: FinspaceClient.Config) {
region = config.region
useDualStack = config.useDualStack
useFips = config.useFips
endpoint = config.endpointUrl?.toString()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy