commonMain.aws.sdk.kotlin.services.cloudsearchdomain.serde.UploadDocumentsOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudsearchdomain-jvm Show documentation
Show all versions of cloudsearchdomain-jvm Show documentation
The AWS Kotlin client for CloudSearch Domain
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.cloudsearchdomain.serde
import aws.sdk.kotlin.services.cloudsearchdomain.model.ContentType
import aws.sdk.kotlin.services.cloudsearchdomain.model.UploadDocumentsRequest
import aws.smithy.kotlin.runtime.content.ByteStream
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerializer
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.http.toHttpBody
import aws.smithy.kotlin.runtime.operation.ExecutionContext
internal class UploadDocumentsOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: UploadDocumentsRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/2013-01-01/documents/batch"
parameters.decodedParameters {
add("format", "sdk")
}
}
builder.headers {
if (input.contentType != null) append("Content-Type", input.contentType.value)
}
if (input.documents != null) {
builder.body = input.documents.toHttpBody()
}
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/octet-stream")
}
if (input.documents == null) {
builder.headers.setMissing("Content-Type", "application/octet-stream")
}
return builder
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy