All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.sagemakerruntime.serde.InvokeEndpointAsyncOperationSerializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.sagemakerruntime.serde

import aws.sdk.kotlin.services.sagemakerruntime.model.InvokeEndpointAsyncRequest
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerialize
import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder
import aws.smithy.kotlin.runtime.http.request.headers
import aws.smithy.kotlin.runtime.http.request.url
import aws.smithy.kotlin.runtime.operation.ExecutionContext
import aws.smithy.kotlin.runtime.text.encoding.PercentEncoding


internal class InvokeEndpointAsyncOperationSerializer: HttpSerialize {
    override suspend fun serialize(context: ExecutionContext, input: InvokeEndpointAsyncRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

        builder.url {
            requireNotNull(input.endpointName) { "endpointName is bound to the URI and must not be null" }
            path.encodedSegments {
                add(PercentEncoding.Path.encode("endpoints"))
                add(PercentEncoding.SmithyLabel.encode("${input.endpointName}"))
                add(PercentEncoding.Path.encode("async-invocations"))
            }
        }

        builder.headers {
            if (input.accept?.isNotEmpty() == true) append("X-Amzn-SageMaker-Accept", input.accept)
            if (input.contentType?.isNotEmpty() == true) append("X-Amzn-SageMaker-Content-Type", input.contentType)
            if (input.customAttributes?.isNotEmpty() == true) append("X-Amzn-SageMaker-Custom-Attributes", input.customAttributes)
            if (input.inferenceId?.isNotEmpty() == true) append("X-Amzn-SageMaker-Inference-Id", input.inferenceId)
            if (input.inputLocation?.isNotEmpty() == true) append("X-Amzn-SageMaker-InputLocation", input.inputLocation)
            if (input.invocationTimeoutSeconds != null) append("X-Amzn-SageMaker-InvocationTimeoutSeconds", "${input.invocationTimeoutSeconds}")
            if (input.requestTtlSeconds != null) append("X-Amzn-SageMaker-RequestTTLSeconds", "${input.requestTtlSeconds}")
        }

        return builder
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy