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

commonMain.aws.sdk.kotlin.services.iotfleetwise.serde.NodeDocumentSerializer.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.Node
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.SerializationException
import aws.smithy.kotlin.runtime.serde.Serializer
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.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct

internal fun serializeNodeDocument(serializer: Serializer, input: Node) {
    val ACTUATOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("actuator"))
    val ATTRIBUTE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("attribute"))
    val BRANCH_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("branch"))
    val PROPERTY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("property"))
    val SENSOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("sensor"))
    val STRUCT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("struct"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACTUATOR_DESCRIPTOR)
        field(ATTRIBUTE_DESCRIPTOR)
        field(BRANCH_DESCRIPTOR)
        field(PROPERTY_DESCRIPTOR)
        field(SENSOR_DESCRIPTOR)
        field(STRUCT_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        when (input) {
            is Node.Branch -> field(BRANCH_DESCRIPTOR, input.value, ::serializeBranchDocument)
            is Node.Sensor -> field(SENSOR_DESCRIPTOR, input.value, ::serializeSensorDocument)
            is Node.Actuator -> field(ACTUATOR_DESCRIPTOR, input.value, ::serializeActuatorDocument)
            is Node.Attribute -> field(ATTRIBUTE_DESCRIPTOR, input.value, ::serializeAttributeDocument)
            is Node.Struct -> field(STRUCT_DESCRIPTOR, input.value, ::serializeCustomStructDocument)
            is Node.Property -> field(PROPERTY_DESCRIPTOR, input.value, ::serializeCustomPropertyDocument)
            is Node.SdkUnknown -> throw SerializationException("Cannot serialize SdkUnknown")
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy