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

commonMain.aws.sdk.kotlin.services.applicationsignals.serde.ServiceSummaryDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.applicationsignals.serde

import aws.sdk.kotlin.services.applicationsignals.model.MetricReference
import aws.sdk.kotlin.services.applicationsignals.model.ServiceSummary
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
import kotlin.collections.mutableMapOf

internal fun deserializeServiceSummaryDocument(deserializer: Deserializer): ServiceSummary {
    val builder = ServiceSummary.Builder()
    val ATTRIBUTEMAPS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AttributeMaps"))
    val ATTRIBUTEMAPS_C0_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map)
    val KEYATTRIBUTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("KeyAttributes"))
    val METRICREFERENCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("MetricReferences"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ATTRIBUTEMAPS_DESCRIPTOR)
        field(KEYATTRIBUTES_DESCRIPTOR)
        field(METRICREFERENCES_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ATTRIBUTEMAPS_DESCRIPTOR.index -> builder.attributeMaps =
                    deserializer.deserializeList(ATTRIBUTEMAPS_DESCRIPTOR) {
                        val col0 = mutableListOf>()
                        while (hasNextElement()) {
                            val el0 = deserializer.deserializeMap(ATTRIBUTEMAPS_C0_DESCRIPTOR) {
                                val map1 = mutableMapOf()
                                while (hasNextEntry()) {
                                    val k1 = key()
                                    val v1 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                                    map1[k1] = v1
                                }
                                map1
                            }
                            col0.add(el0)
                        }
                        col0
                    }
                KEYATTRIBUTES_DESCRIPTOR.index -> builder.keyAttributes =
                    deserializer.deserializeMap(KEYATTRIBUTES_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                METRICREFERENCES_DESCRIPTOR.index -> builder.metricReferences =
                    deserializer.deserializeList(METRICREFERENCES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeMetricReferenceDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy