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

commonMain.aws.sdk.kotlin.services.ssm.serde.AssociationVersionInfoDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.ssm.serde

import aws.sdk.kotlin.services.ssm.model.AssociationComplianceSeverity
import aws.sdk.kotlin.services.ssm.model.AssociationSyncCompliance
import aws.sdk.kotlin.services.ssm.model.AssociationVersionInfo
import aws.sdk.kotlin.services.ssm.model.Target
import aws.sdk.kotlin.services.ssm.model.TargetLocation
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.mutableListOf
import kotlin.collections.mutableMapOf

internal fun deserializeAssociationVersionInfoDocument(deserializer: Deserializer): AssociationVersionInfo {
    val builder = AssociationVersionInfo.Builder()
    val APPLYONLYATCRONINTERVAL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("ApplyOnlyAtCronInterval"))
    val ASSOCIATIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AssociationId"))
    val ASSOCIATIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AssociationName"))
    val ASSOCIATIONVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AssociationVersion"))
    val CALENDARNAMES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("CalendarNames"))
    val COMPLIANCESEVERITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ComplianceSeverity"))
    val CREATEDDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreatedDate"))
    val DOCUMENTVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DocumentVersion"))
    val DURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Duration"))
    val MAXCONCURRENCY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MaxConcurrency"))
    val MAXERRORS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MaxErrors"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val OUTPUTLOCATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("OutputLocation"))
    val PARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Parameters"))
    val PARAMETERS_C0_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List)
    val SCHEDULEEXPRESSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ScheduleExpression"))
    val SCHEDULEOFFSET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("ScheduleOffset"))
    val SYNCCOMPLIANCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("SyncCompliance"))
    val TARGETLOCATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("TargetLocations"))
    val TARGETMAPS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("TargetMaps"))
    val TARGETMAPS_C0_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map)
    val TARGETMAPS_C1_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List)
    val TARGETS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Targets"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(APPLYONLYATCRONINTERVAL_DESCRIPTOR)
        field(ASSOCIATIONID_DESCRIPTOR)
        field(ASSOCIATIONNAME_DESCRIPTOR)
        field(ASSOCIATIONVERSION_DESCRIPTOR)
        field(CALENDARNAMES_DESCRIPTOR)
        field(COMPLIANCESEVERITY_DESCRIPTOR)
        field(CREATEDDATE_DESCRIPTOR)
        field(DOCUMENTVERSION_DESCRIPTOR)
        field(DURATION_DESCRIPTOR)
        field(MAXCONCURRENCY_DESCRIPTOR)
        field(MAXERRORS_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(OUTPUTLOCATION_DESCRIPTOR)
        field(PARAMETERS_DESCRIPTOR)
        field(SCHEDULEEXPRESSION_DESCRIPTOR)
        field(SCHEDULEOFFSET_DESCRIPTOR)
        field(SYNCCOMPLIANCE_DESCRIPTOR)
        field(TARGETLOCATIONS_DESCRIPTOR)
        field(TARGETMAPS_DESCRIPTOR)
        field(TARGETS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                APPLYONLYATCRONINTERVAL_DESCRIPTOR.index -> builder.applyOnlyAtCronInterval = deserializeBoolean()
                ASSOCIATIONID_DESCRIPTOR.index -> builder.associationId = deserializeString()
                ASSOCIATIONNAME_DESCRIPTOR.index -> builder.associationName = deserializeString()
                ASSOCIATIONVERSION_DESCRIPTOR.index -> builder.associationVersion = deserializeString()
                CALENDARNAMES_DESCRIPTOR.index -> builder.calendarNames =
                    deserializer.deserializeList(CALENDARNAMES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                COMPLIANCESEVERITY_DESCRIPTOR.index -> builder.complianceSeverity = deserializeString().let { AssociationComplianceSeverity.fromValue(it) }
                CREATEDDATE_DESCRIPTOR.index -> builder.createdDate = deserializeString().let { Instant.fromEpochSeconds(it) }
                DOCUMENTVERSION_DESCRIPTOR.index -> builder.documentVersion = deserializeString()
                DURATION_DESCRIPTOR.index -> builder.duration = deserializeInt()
                MAXCONCURRENCY_DESCRIPTOR.index -> builder.maxConcurrency = deserializeString()
                MAXERRORS_DESCRIPTOR.index -> builder.maxErrors = deserializeString()
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                OUTPUTLOCATION_DESCRIPTOR.index -> builder.outputLocation = deserializeInstanceAssociationOutputLocationDocument(deserializer)
                PARAMETERS_DESCRIPTOR.index -> builder.parameters =
                    deserializer.deserializeMap(PARAMETERS_DESCRIPTOR) {
                        val map0 = mutableMapOf>()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 =
                                if (nextHasValue()) {
                                    deserializer.deserializeList(PARAMETERS_C0_DESCRIPTOR) {
                                        val col1 = mutableListOf()
                                        while (hasNextElement()) {
                                            val el1 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                                            col1.add(el1)
                                        }
                                        col1
                                    }
                                } else { deserializeNull(); continue }

                            map0[k0] = v0
                        }
                        map0
                    }
                SCHEDULEEXPRESSION_DESCRIPTOR.index -> builder.scheduleExpression = deserializeString()
                SCHEDULEOFFSET_DESCRIPTOR.index -> builder.scheduleOffset = deserializeInt()
                SYNCCOMPLIANCE_DESCRIPTOR.index -> builder.syncCompliance = deserializeString().let { AssociationSyncCompliance.fromValue(it) }
                TARGETLOCATIONS_DESCRIPTOR.index -> builder.targetLocations =
                    deserializer.deserializeList(TARGETLOCATIONS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeTargetLocationDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                TARGETMAPS_DESCRIPTOR.index -> builder.targetMaps =
                    deserializer.deserializeList(TARGETMAPS_DESCRIPTOR) {
                        val col0 = mutableListOf>>()
                        while (hasNextElement()) {
                            val el0 = deserializer.deserializeMap(TARGETMAPS_C0_DESCRIPTOR) {
                                val map1 = mutableMapOf>()
                                while (hasNextEntry()) {
                                    val k1 = key()
                                    val v1 =
                                        if (nextHasValue()) {
                                            deserializer.deserializeList(TARGETMAPS_C1_DESCRIPTOR) {
                                                val col2 = mutableListOf()
                                                while (hasNextElement()) {
                                                    val el2 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                                                    col2.add(el2)
                                                }
                                                col2
                                            }
                                        } else { deserializeNull(); continue }

                                    map1[k1] = v1
                                }
                                map1
                            }
                            col0.add(el0)
                        }
                        col0
                    }
                TARGETS_DESCRIPTOR.index -> builder.targets =
                    deserializer.deserializeList(TARGETS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeTargetDocument(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