commonMain.aws.sdk.kotlin.services.backupgateway.endpoints.internal.EndpointResolverAdapter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of backupgateway-jvm Show documentation
Show all versions of backupgateway-jvm Show documentation
The AWS SDK for Kotlin client for Backup Gateway
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.backupgateway.endpoints.internal
import aws.sdk.kotlin.services.backupgateway.BackupGatewayClient
import aws.sdk.kotlin.services.backupgateway.endpoints.BackupGatewayEndpointParameters
import aws.smithy.kotlin.runtime.client.SdkClientOption
import aws.smithy.kotlin.runtime.client.endpoints.Endpoint
import aws.smithy.kotlin.runtime.collections.get
import aws.smithy.kotlin.runtime.http.operation.EndpointResolver
import aws.smithy.kotlin.runtime.http.operation.ResolveEndpointRequest
internal class EndpointResolverAdapter(
private val config: BackupGatewayClient.Config
): EndpointResolver {
override suspend fun resolve(request: ResolveEndpointRequest): Endpoint {
val params = resolveEndpointParams(config, request)
val endpoint = config.endpointProvider.resolveEndpoint(params)
return endpoint
}
}
internal fun resolveEndpointParams(config: BackupGatewayClient.Config, request: ResolveEndpointRequest): BackupGatewayEndpointParameters {
return BackupGatewayEndpointParameters {
region = config.region
bindAwsBuiltins(config, request)
endpoint = config.endpointUrl?.toString()
val opName = request.context[SdkClientOption.OperationName]
opContextBindings[opName]?.invoke(this, request)
}
}
private typealias BindOperationContextParamsFn = (BackupGatewayEndpointParameters.Builder, ResolveEndpointRequest) -> Unit
private val opContextBindings = mapOf (
)
private fun BackupGatewayEndpointParameters.Builder.bindAwsBuiltins(config: BackupGatewayClient.Config, request: ResolveEndpointRequest) {
useDualStack = config.useDualStack
useFips = config.useFips
}