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

commonMain.aws.sdk.kotlin.services.iot.transform.MetricValueDocumentDeserializer.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.iot.transform

import aws.sdk.kotlin.services.iot.model.MetricValue
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 deserializeMetricValueDocument(deserializer: Deserializer): MetricValue {
    val builder = MetricValue.Builder()
    val CIDRS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("cidrs"))
    val COUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("count"))
    val NUMBER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("number"))
    val NUMBERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("numbers"))
    val PORTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ports"))
    val STRINGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("strings"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CIDRS_DESCRIPTOR)
        field(COUNT_DESCRIPTOR)
        field(NUMBER_DESCRIPTOR)
        field(NUMBERS_DESCRIPTOR)
        field(PORTS_DESCRIPTOR)
        field(STRINGS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CIDRS_DESCRIPTOR.index -> builder.cidrs =
                    deserializer.deserializeList(CIDRS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                COUNT_DESCRIPTOR.index -> builder.count = deserializeLong()
                NUMBER_DESCRIPTOR.index -> builder.number = deserializeDouble()
                NUMBERS_DESCRIPTOR.index -> builder.numbers =
                    deserializer.deserializeList(NUMBERS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeDouble() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                PORTS_DESCRIPTOR.index -> builder.ports =
                    deserializer.deserializeList(PORTS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeInt() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                STRINGS_DESCRIPTOR.index -> builder.strings =
                    deserializer.deserializeList(STRINGS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy