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

commonMain.aws.sdk.kotlin.services.omics.serde.UploadReadSetPartOperationSerializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.37
Show newest version
// 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
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy