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

commonMain.aws.sdk.kotlin.services.iotwireless.serde.SidewalkDeviceDocumentDeserializer.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.iotwireless.serde

import aws.sdk.kotlin.services.iotwireless.model.CertificateList
import aws.sdk.kotlin.services.iotwireless.model.SidewalkDevice
import aws.sdk.kotlin.services.iotwireless.model.WirelessDeviceSidewalkStatus
import aws.smithy.kotlin.runtime.serde.Deserializer
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.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
import kotlin.collections.mutableListOf

internal fun deserializeSidewalkDeviceDocument(deserializer: Deserializer): SidewalkDevice {
    val builder = SidewalkDevice.Builder()
    val AMAZONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AmazonId"))
    val CERTIFICATEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CertificateId"))
    val DEVICECERTIFICATES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("DeviceCertificates"))
    val DEVICEPROFILEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DeviceProfileId"))
    val PRIVATEKEYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("PrivateKeys"))
    val SIDEWALKID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SidewalkId"))
    val SIDEWALKMANUFACTURINGSN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SidewalkManufacturingSn"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(AMAZONID_DESCRIPTOR)
        field(CERTIFICATEID_DESCRIPTOR)
        field(DEVICECERTIFICATES_DESCRIPTOR)
        field(DEVICEPROFILEID_DESCRIPTOR)
        field(PRIVATEKEYS_DESCRIPTOR)
        field(SIDEWALKID_DESCRIPTOR)
        field(SIDEWALKMANUFACTURINGSN_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                AMAZONID_DESCRIPTOR.index -> builder.amazonId = deserializeString()
                CERTIFICATEID_DESCRIPTOR.index -> builder.certificateId = deserializeString()
                DEVICECERTIFICATES_DESCRIPTOR.index -> builder.deviceCertificates =
                    deserializer.deserializeList(DEVICECERTIFICATES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeCertificateListDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                DEVICEPROFILEID_DESCRIPTOR.index -> builder.deviceProfileId = deserializeString()
                PRIVATEKEYS_DESCRIPTOR.index -> builder.privateKeys =
                    deserializer.deserializeList(PRIVATEKEYS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeCertificateListDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                SIDEWALKID_DESCRIPTOR.index -> builder.sidewalkId = deserializeString()
                SIDEWALKMANUFACTURINGSN_DESCRIPTOR.index -> builder.sidewalkManufacturingSn = deserializeString()
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { WirelessDeviceSidewalkStatus.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy