commonMain.aws.sdk.kotlin.services.omics.serde.UploadReadSetPartOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of omics-jvm Show documentation
Show all versions of omics-jvm Show documentation
The AWS SDK for Kotlin client for Omics
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.omics.serde
import aws.sdk.kotlin.services.omics.model.ReadSetPartSource
import aws.sdk.kotlin.services.omics.model.UploadReadSetPartRequest
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.HttpSerialize
import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder
import aws.smithy.kotlin.runtime.http.request.url
import aws.smithy.kotlin.runtime.http.toHttpBody
import aws.smithy.kotlin.runtime.http.util.encodeLabel
import aws.smithy.kotlin.runtime.net.parameters
import aws.smithy.kotlin.runtime.operation.ExecutionContext
internal class UploadReadSetPartOperationSerializer: HttpSerialize {
override suspend fun serialize(context: ExecutionContext, input: UploadReadSetPartRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.PUT
builder.url {
requireNotNull(input.sequenceStoreId) { "sequenceStoreId is bound to the URI and must not be null" }
requireNotNull(input.uploadId) { "uploadId is bound to the URI and must not be null" }
val pathSegments = listOf(
"sequencestore",
"${input.sequenceStoreId}".encodeLabel(),
"upload",
"${input.uploadId}".encodeLabel(),
"part",
)
path = pathSegments.joinToString(separator = "/", prefix = "/")
parameters {
if (input.partNumber != null) append("partNumber", "${input.partNumber}")
if (input.partSource != null) append("partSource", input.partSource.value)
}
}
if (input.payload != null) {
builder.body = input.payload.toHttpBody()
}
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/octet-stream")
}
if (input.payload == null) {
builder.headers.setMissing("Content-Type", "application/octet-stream")
}
return builder
}
}