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

commonMain.aws.sdk.kotlin.services.applicationinsights.serde.ApplicationComponentDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.78
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.applicationinsights.serde

import aws.sdk.kotlin.services.applicationinsights.model.ApplicationComponent
import aws.sdk.kotlin.services.applicationinsights.model.OsType
import aws.sdk.kotlin.services.applicationinsights.model.Tier
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.mutableMapOf

internal fun deserializeApplicationComponentDocument(deserializer: Deserializer): ApplicationComponent {
    val builder = ApplicationComponent.Builder()
    val COMPONENTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ComponentName"))
    val COMPONENTREMARKS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ComponentRemarks"))
    val DETECTEDWORKLOAD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("DetectedWorkload"))
    val DETECTEDWORKLOAD_C0_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map)
    val MONITOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("Monitor"))
    val OSTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("OsType"))
    val RESOURCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceType"))
    val TIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Tier"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(COMPONENTNAME_DESCRIPTOR)
        field(COMPONENTREMARKS_DESCRIPTOR)
        field(DETECTEDWORKLOAD_DESCRIPTOR)
        field(MONITOR_DESCRIPTOR)
        field(OSTYPE_DESCRIPTOR)
        field(RESOURCETYPE_DESCRIPTOR)
        field(TIER_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                COMPONENTNAME_DESCRIPTOR.index -> builder.componentName = deserializeString()
                COMPONENTREMARKS_DESCRIPTOR.index -> builder.componentRemarks = deserializeString()
                DETECTEDWORKLOAD_DESCRIPTOR.index -> builder.detectedWorkload =
                    deserializer.deserializeMap(DETECTEDWORKLOAD_DESCRIPTOR) {
                        val map0 = mutableMapOf>()
                        while (hasNextEntry()) {
                            val k0 = Tier.fromValue(key())
                            val v0 =
                                if (nextHasValue()) {
                                    deserializer.deserializeMap(DETECTEDWORKLOAD_C0_DESCRIPTOR) {
                                        val map1 = mutableMapOf()
                                        while (hasNextEntry()) {
                                            val k1 = key()
                                            val v1 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                                            map1[k1] = v1
                                        }
                                        map1
                                    }
                                } else { deserializeNull(); continue }

                            map0[k0] = v0
                        }
                        map0
                    }
                MONITOR_DESCRIPTOR.index -> builder.monitor = deserializeBoolean()
                OSTYPE_DESCRIPTOR.index -> builder.osType = deserializeString().let { OsType.fromValue(it) }
                RESOURCETYPE_DESCRIPTOR.index -> builder.resourceType = deserializeString()
                TIER_DESCRIPTOR.index -> builder.tier = deserializeString().let { Tier.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy