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

commonMain.aws.sdk.kotlin.services.ssm.serde.RunbookDocumentDeserializer.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.Runbook
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 kotlin.collections.mutableListOf
import kotlin.collections.mutableMapOf

internal fun deserializeRunbookDocument(deserializer: Deserializer): Runbook {
    val builder = Runbook.Builder()
    val DOCUMENTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DocumentName"))
    val DOCUMENTVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DocumentVersion"))
    val MAXCONCURRENCY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MaxConcurrency"))
    val MAXERRORS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MaxErrors"))
    val PARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Parameters"))
    val PARAMETERS_C0_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List)
    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 TARGETPARAMETERNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("TargetParameterName"))
    val TARGETS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Targets"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DOCUMENTNAME_DESCRIPTOR)
        field(DOCUMENTVERSION_DESCRIPTOR)
        field(MAXCONCURRENCY_DESCRIPTOR)
        field(MAXERRORS_DESCRIPTOR)
        field(PARAMETERS_DESCRIPTOR)
        field(TARGETLOCATIONS_DESCRIPTOR)
        field(TARGETMAPS_DESCRIPTOR)
        field(TARGETPARAMETERNAME_DESCRIPTOR)
        field(TARGETS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                DOCUMENTNAME_DESCRIPTOR.index -> builder.documentName = deserializeString()
                DOCUMENTVERSION_DESCRIPTOR.index -> builder.documentVersion = deserializeString()
                MAXCONCURRENCY_DESCRIPTOR.index -> builder.maxConcurrency = deserializeString()
                MAXERRORS_DESCRIPTOR.index -> builder.maxErrors = deserializeString()
                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
                    }
                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
                    }
                TARGETPARAMETERNAME_DESCRIPTOR.index -> builder.targetParameterName = deserializeString()
                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