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

commonMain.aws.sdk.kotlin.services.nimble.serde.LaunchProfileInitializationDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.nimble.serde

import aws.sdk.kotlin.services.nimble.model.LaunchProfileInitialization
import aws.sdk.kotlin.services.nimble.model.LaunchProfileInitializationScript
import aws.sdk.kotlin.services.nimble.model.LaunchProfilePlatform
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

internal fun deserializeLaunchProfileInitializationDocument(deserializer: Deserializer): LaunchProfileInitialization {
    val builder = LaunchProfileInitialization.Builder()
    val ACTIVEDIRECTORY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("activeDirectory"))
    val EC2SECURITYGROUPIDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ec2SecurityGroupIds"))
    val LAUNCHPROFILEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("launchProfileId"))
    val LAUNCHPROFILEPROTOCOLVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("launchProfileProtocolVersion"))
    val LAUNCHPURPOSE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("launchPurpose"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val PLATFORM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("platform"))
    val SYSTEMINITIALIZATIONSCRIPTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("systemInitializationScripts"))
    val USERINITIALIZATIONSCRIPTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("userInitializationScripts"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACTIVEDIRECTORY_DESCRIPTOR)
        field(EC2SECURITYGROUPIDS_DESCRIPTOR)
        field(LAUNCHPROFILEID_DESCRIPTOR)
        field(LAUNCHPROFILEPROTOCOLVERSION_DESCRIPTOR)
        field(LAUNCHPURPOSE_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(PLATFORM_DESCRIPTOR)
        field(SYSTEMINITIALIZATIONSCRIPTS_DESCRIPTOR)
        field(USERINITIALIZATIONSCRIPTS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACTIVEDIRECTORY_DESCRIPTOR.index -> builder.activeDirectory = deserializeLaunchProfileInitializationActiveDirectoryDocument(deserializer)
                EC2SECURITYGROUPIDS_DESCRIPTOR.index -> builder.ec2SecurityGroupIds =
                    deserializer.deserializeList(EC2SECURITYGROUPIDS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                LAUNCHPROFILEID_DESCRIPTOR.index -> builder.launchProfileId = deserializeString()
                LAUNCHPROFILEPROTOCOLVERSION_DESCRIPTOR.index -> builder.launchProfileProtocolVersion = deserializeString()
                LAUNCHPURPOSE_DESCRIPTOR.index -> builder.launchPurpose = deserializeString()
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                PLATFORM_DESCRIPTOR.index -> builder.platform = deserializeString().let { LaunchProfilePlatform.fromValue(it) }
                SYSTEMINITIALIZATIONSCRIPTS_DESCRIPTOR.index -> builder.systemInitializationScripts =
                    deserializer.deserializeList(SYSTEMINITIALIZATIONSCRIPTS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLaunchProfileInitializationScriptDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                USERINITIALIZATIONSCRIPTS_DESCRIPTOR.index -> builder.userInitializationScripts =
                    deserializer.deserializeList(USERINITIALIZATIONSCRIPTS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLaunchProfileInitializationScriptDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy