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

commonMain.aws.sdk.kotlin.services.iotfleetwise.serde.UpdateDecoderManifestOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.iotfleetwise.serde

import aws.sdk.kotlin.services.iotfleetwise.model.ManifestStatus
import aws.sdk.kotlin.services.iotfleetwise.model.NetworkInterface
import aws.sdk.kotlin.services.iotfleetwise.model.SignalDecoder
import aws.sdk.kotlin.services.iotfleetwise.model.UpdateDecoderManifestRequest
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 UpdateDecoderManifestOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateDecoderManifestRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeUpdateDecoderManifestOperationBody(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 serializeUpdateDecoderManifestOperationBody(context: ExecutionContext, input: UpdateDecoderManifestRequest): ByteArray {
    val serializer = JsonSerializer()
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val NETWORKINTERFACESTOADD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("networkInterfacesToAdd"))
    val NETWORKINTERFACESTOREMOVE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("networkInterfacesToRemove"))
    val NETWORKINTERFACESTOUPDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("networkInterfacesToUpdate"))
    val SIGNALDECODERSTOADD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("signalDecodersToAdd"))
    val SIGNALDECODERSTOREMOVE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("signalDecodersToRemove"))
    val SIGNALDECODERSTOUPDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("signalDecodersToUpdate"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("status"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DESCRIPTION_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(NETWORKINTERFACESTOADD_DESCRIPTOR)
        field(NETWORKINTERFACESTOREMOVE_DESCRIPTOR)
        field(NETWORKINTERFACESTOUPDATE_DESCRIPTOR)
        field(SIGNALDECODERSTOADD_DESCRIPTOR)
        field(SIGNALDECODERSTOREMOVE_DESCRIPTOR)
        field(SIGNALDECODERSTOUPDATE_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        field(NAME_DESCRIPTOR, input.name)
        if (input.networkInterfacesToAdd != null) {
            listField(NETWORKINTERFACESTOADD_DESCRIPTOR) {
                for (el0 in input.networkInterfacesToAdd) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeNetworkInterfaceDocument))
                }
            }
        }
        if (input.networkInterfacesToRemove != null) {
            listField(NETWORKINTERFACESTOREMOVE_DESCRIPTOR) {
                for (el0 in input.networkInterfacesToRemove) {
                    serializeString(el0)
                }
            }
        }
        if (input.networkInterfacesToUpdate != null) {
            listField(NETWORKINTERFACESTOUPDATE_DESCRIPTOR) {
                for (el0 in input.networkInterfacesToUpdate) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeNetworkInterfaceDocument))
                }
            }
        }
        if (input.signalDecodersToAdd != null) {
            listField(SIGNALDECODERSTOADD_DESCRIPTOR) {
                for (el0 in input.signalDecodersToAdd) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeSignalDecoderDocument))
                }
            }
        }
        if (input.signalDecodersToRemove != null) {
            listField(SIGNALDECODERSTOREMOVE_DESCRIPTOR) {
                for (el0 in input.signalDecodersToRemove) {
                    serializeString(el0)
                }
            }
        }
        if (input.signalDecodersToUpdate != null) {
            listField(SIGNALDECODERSTOUPDATE_DESCRIPTOR) {
                for (el0 in input.signalDecodersToUpdate) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeSignalDecoderDocument))
                }
            }
        }
        input.status?.let { field(STATUS_DESCRIPTOR, it.value) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy