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

commonMain.aws.sdk.kotlin.services.configservice.serde.BaseConfigurationItemDocumentDeserializer.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.configservice.serde

import aws.sdk.kotlin.services.configservice.model.BaseConfigurationItem
import aws.sdk.kotlin.services.configservice.model.ConfigurationItemStatus
import aws.sdk.kotlin.services.configservice.model.ResourceType
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 aws.smithy.kotlin.runtime.time.Instant
import kotlin.collections.mutableMapOf

internal fun deserializeBaseConfigurationItemDocument(deserializer: Deserializer): BaseConfigurationItem {
    val builder = BaseConfigurationItem.Builder()
    val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("accountId"))
    val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("arn"))
    val AVAILABILITYZONE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("availabilityZone"))
    val AWSREGION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("awsRegion"))
    val CONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("configuration"))
    val CONFIGURATIONITEMCAPTURETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("configurationItemCaptureTime"))
    val CONFIGURATIONITEMSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("configurationItemStatus"))
    val CONFIGURATIONSTATEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("configurationStateId"))
    val RESOURCECREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("resourceCreationTime"))
    val RESOURCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("resourceId"))
    val RESOURCENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("resourceName"))
    val RESOURCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("resourceType"))
    val SUPPLEMENTARYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("supplementaryConfiguration"))
    val VERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("version"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACCOUNTID_DESCRIPTOR)
        field(ARN_DESCRIPTOR)
        field(AVAILABILITYZONE_DESCRIPTOR)
        field(AWSREGION_DESCRIPTOR)
        field(CONFIGURATION_DESCRIPTOR)
        field(CONFIGURATIONITEMCAPTURETIME_DESCRIPTOR)
        field(CONFIGURATIONITEMSTATUS_DESCRIPTOR)
        field(CONFIGURATIONSTATEID_DESCRIPTOR)
        field(RESOURCECREATIONTIME_DESCRIPTOR)
        field(RESOURCEID_DESCRIPTOR)
        field(RESOURCENAME_DESCRIPTOR)
        field(RESOURCETYPE_DESCRIPTOR)
        field(SUPPLEMENTARYCONFIGURATION_DESCRIPTOR)
        field(VERSION_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACCOUNTID_DESCRIPTOR.index -> builder.accountId = deserializeString()
                ARN_DESCRIPTOR.index -> builder.arn = deserializeString()
                AVAILABILITYZONE_DESCRIPTOR.index -> builder.availabilityZone = deserializeString()
                AWSREGION_DESCRIPTOR.index -> builder.awsRegion = deserializeString()
                CONFIGURATION_DESCRIPTOR.index -> builder.configuration = deserializeString()
                CONFIGURATIONITEMCAPTURETIME_DESCRIPTOR.index -> builder.configurationItemCaptureTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                CONFIGURATIONITEMSTATUS_DESCRIPTOR.index -> builder.configurationItemStatus = deserializeString().let { ConfigurationItemStatus.fromValue(it) }
                CONFIGURATIONSTATEID_DESCRIPTOR.index -> builder.configurationStateId = deserializeString()
                RESOURCECREATIONTIME_DESCRIPTOR.index -> builder.resourceCreationTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                RESOURCEID_DESCRIPTOR.index -> builder.resourceId = deserializeString()
                RESOURCENAME_DESCRIPTOR.index -> builder.resourceName = deserializeString()
                RESOURCETYPE_DESCRIPTOR.index -> builder.resourceType = deserializeString().let { ResourceType.fromValue(it) }
                SUPPLEMENTARYCONFIGURATION_DESCRIPTOR.index -> builder.supplementaryConfiguration =
                    deserializer.deserializeMap(SUPPLEMENTARYCONFIGURATION_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                VERSION_DESCRIPTOR.index -> builder.version = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy