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

commonMain.aws.sdk.kotlin.services.autoscaling.serde.InstanceDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.autoscaling.serde

import aws.sdk.kotlin.services.autoscaling.model.Instance
import aws.sdk.kotlin.services.autoscaling.model.LifecycleState
import aws.smithy.kotlin.runtime.serde.getOrDeserializeErr
import aws.smithy.kotlin.runtime.serde.parse
import aws.smithy.kotlin.runtime.serde.parseBoolean
import aws.smithy.kotlin.runtime.serde.xml.XmlTagReader
import aws.smithy.kotlin.runtime.serde.xml.tryData

internal fun deserializeInstanceDocument(reader: XmlTagReader): Instance {
    val builder = Instance.Builder()

    loop@while (true) {
        val curr = reader.nextTag() ?: break@loop
        when (curr.tagName) {
            // InstanceId com.amazonaws.autoscaling#Instance$InstanceId
            "InstanceId" -> builder.instanceId = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.autoscaling#XmlStringMaxLen19`)" }
            // InstanceType com.amazonaws.autoscaling#Instance$InstanceType
            "InstanceType" -> builder.instanceType = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.autoscaling#XmlStringMaxLen255`)" }
            // AvailabilityZone com.amazonaws.autoscaling#Instance$AvailabilityZone
            "AvailabilityZone" -> builder.availabilityZone = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.autoscaling#XmlStringMaxLen255`)" }
            // LifecycleState com.amazonaws.autoscaling#Instance$LifecycleState
            "LifecycleState" -> builder.lifecycleState = curr.tryData()
                .parse { LifecycleState.fromValue(it) }
                .getOrDeserializeErr { "expected (enum: `com.amazonaws.autoscaling#LifecycleState`)" }
            // HealthStatus com.amazonaws.autoscaling#Instance$HealthStatus
            "HealthStatus" -> builder.healthStatus = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.autoscaling#XmlStringMaxLen32`)" }
            // LaunchConfigurationName com.amazonaws.autoscaling#Instance$LaunchConfigurationName
            "LaunchConfigurationName" -> builder.launchConfigurationName = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.autoscaling#XmlStringMaxLen255`)" }
            // LaunchTemplate com.amazonaws.autoscaling#Instance$LaunchTemplate
            "LaunchTemplate" -> builder.launchTemplate = deserializeLaunchTemplateSpecificationDocument(curr)
            // ProtectedFromScaleIn com.amazonaws.autoscaling#Instance$ProtectedFromScaleIn
            "ProtectedFromScaleIn" -> builder.protectedFromScaleIn = curr.tryData()
                .parseBoolean()
                .getOrDeserializeErr { "expected (boolean: `com.amazonaws.autoscaling#InstanceProtected`)" }
            // WeightedCapacity com.amazonaws.autoscaling#Instance$WeightedCapacity
            "WeightedCapacity" -> builder.weightedCapacity = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.autoscaling#XmlStringMaxLen32`)" }
            else -> {}
        }
        curr.drop()
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy