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

commonMain.aws.sdk.kotlin.services.proton.serde.UpdateServiceTemplateVersionOperationSerializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.99
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.proton.serde

import aws.sdk.kotlin.services.proton.model.CompatibleEnvironmentTemplateInput
import aws.sdk.kotlin.services.proton.model.ServiceTemplateSupportedComponentSourceType
import aws.sdk.kotlin.services.proton.model.TemplateVersionStatus
import aws.sdk.kotlin.services.proton.model.UpdateServiceTemplateVersionRequest
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.url
import aws.smithy.kotlin.runtime.operation.ExecutionContext
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.json.JsonSerializer
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct


internal class UpdateServiceTemplateVersionOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateServiceTemplateVersionRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

        builder.url {
            path.encoded = "/"
        }

        val payload = serializeUpdateServiceTemplateVersionOperationBody(context, input)
        builder.body = HttpBody.fromBytes(payload)
        if (builder.body !is HttpBody.Empty) {
            builder.headers.setMissing("Content-Type", "application/x-amz-json-1.0")
        }
        return builder
    }
}

private fun serializeUpdateServiceTemplateVersionOperationBody(context: ExecutionContext, input: UpdateServiceTemplateVersionRequest): ByteArray {
    val serializer = JsonSerializer()
    val COMPATIBLEENVIRONMENTTEMPLATES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("compatibleEnvironmentTemplates"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
    val MAJORVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("majorVersion"))
    val MINORVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("minorVersion"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("status"))
    val SUPPORTEDCOMPONENTSOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("supportedComponentSources"))
    val TEMPLATENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("templateName"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(COMPATIBLEENVIRONMENTTEMPLATES_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(MAJORVERSION_DESCRIPTOR)
        field(MINORVERSION_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(SUPPORTEDCOMPONENTSOURCES_DESCRIPTOR)
        field(TEMPLATENAME_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        if (input.compatibleEnvironmentTemplates != null) {
            listField(COMPATIBLEENVIRONMENTTEMPLATES_DESCRIPTOR) {
                for (el0 in input.compatibleEnvironmentTemplates) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeCompatibleEnvironmentTemplateInputDocument))
                }
            }
        }
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        field(MAJORVERSION_DESCRIPTOR, input.majorVersion)
        field(MINORVERSION_DESCRIPTOR, input.minorVersion)
        input.status?.let { field(STATUS_DESCRIPTOR, it.value) }
        if (input.supportedComponentSources != null) {
            listField(SUPPORTEDCOMPONENTSOURCES_DESCRIPTOR) {
                for (el0 in input.supportedComponentSources) {
                    serializeString(el0.value)
                }
            }
        }
        field(TEMPLATENAME_DESCRIPTOR, input.templateName)
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy