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

commonMain.aws.sdk.kotlin.services.mgn.transform.LaunchedInstanceDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.mgn.transform

import aws.sdk.kotlin.services.mgn.model.FirstBoot
import aws.sdk.kotlin.services.mgn.model.LaunchedInstance
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

internal fun deserializeLaunchedInstanceDocument(deserializer: Deserializer): LaunchedInstance {
    val builder = LaunchedInstance.Builder()
    val EC2INSTANCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ec2InstanceID"))
    val FIRSTBOOT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("firstBoot"))
    val JOBID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("jobID"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(EC2INSTANCEID_DESCRIPTOR)
        field(FIRSTBOOT_DESCRIPTOR)
        field(JOBID_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                EC2INSTANCEID_DESCRIPTOR.index -> builder.ec2InstanceId = deserializeString()
                FIRSTBOOT_DESCRIPTOR.index -> builder.firstBoot = deserializeString().let { FirstBoot.fromValue(it) }
                JOBID_DESCRIPTOR.index -> builder.jobId = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy