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

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

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

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

import aws.sdk.kotlin.services.autoscaling.model.RefreshPreferences
import aws.sdk.kotlin.services.autoscaling.model.ScaleInProtectedInstances
import aws.sdk.kotlin.services.autoscaling.model.StandbyInstances
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.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
import aws.smithy.kotlin.runtime.serde.xml.XmlDeserializer
import aws.smithy.kotlin.runtime.serde.xml.XmlNamespace
import aws.smithy.kotlin.runtime.serde.xml.XmlSerialName
import kotlin.collections.mutableListOf

internal fun deserializeRefreshPreferencesDocument(deserializer: Deserializer): RefreshPreferences {
    val builder = RefreshPreferences.Builder()
    val ALARMSPECIFICATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, XmlSerialName("AlarmSpecification"))
    val AUTOROLLBACK_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, XmlSerialName("AutoRollback"))
    val CHECKPOINTDELAY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("CheckpointDelay"))
    val CHECKPOINTPERCENTAGES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, XmlSerialName("CheckpointPercentages"))
    val INSTANCEWARMUP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("InstanceWarmup"))
    val MAXHEALTHYPERCENTAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("MaxHealthyPercentage"))
    val MINHEALTHYPERCENTAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("MinHealthyPercentage"))
    val SCALEINPROTECTEDINSTANCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, XmlSerialName("ScaleInProtectedInstances"))
    val SKIPMATCHING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, XmlSerialName("SkipMatching"))
    val STANDBYINSTANCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, XmlSerialName("StandbyInstances"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        trait(XmlSerialName("RefreshPreferences"))
        trait(XmlNamespace("http://autoscaling.amazonaws.com/doc/2011-01-01/"))
        field(ALARMSPECIFICATION_DESCRIPTOR)
        field(AUTOROLLBACK_DESCRIPTOR)
        field(CHECKPOINTDELAY_DESCRIPTOR)
        field(CHECKPOINTPERCENTAGES_DESCRIPTOR)
        field(INSTANCEWARMUP_DESCRIPTOR)
        field(MAXHEALTHYPERCENTAGE_DESCRIPTOR)
        field(MINHEALTHYPERCENTAGE_DESCRIPTOR)
        field(SCALEINPROTECTEDINSTANCES_DESCRIPTOR)
        field(SKIPMATCHING_DESCRIPTOR)
        field(STANDBYINSTANCES_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ALARMSPECIFICATION_DESCRIPTOR.index -> builder.alarmSpecification = deserializeAlarmSpecificationDocument(deserializer)
                AUTOROLLBACK_DESCRIPTOR.index -> builder.autoRollback = deserializeBoolean()
                CHECKPOINTDELAY_DESCRIPTOR.index -> builder.checkpointDelay = deserializeInt()
                CHECKPOINTPERCENTAGES_DESCRIPTOR.index -> builder.checkpointPercentages =
                    deserializer.deserializeList(CHECKPOINTPERCENTAGES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeInt() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                INSTANCEWARMUP_DESCRIPTOR.index -> builder.instanceWarmup = deserializeInt()
                MAXHEALTHYPERCENTAGE_DESCRIPTOR.index -> builder.maxHealthyPercentage = deserializeInt()
                MINHEALTHYPERCENTAGE_DESCRIPTOR.index -> builder.minHealthyPercentage = deserializeInt()
                SCALEINPROTECTEDINSTANCES_DESCRIPTOR.index -> builder.scaleInProtectedInstances = deserializeString().let { ScaleInProtectedInstances.fromValue(it) }
                SKIPMATCHING_DESCRIPTOR.index -> builder.skipMatching = deserializeBoolean()
                STANDBYINSTANCES_DESCRIPTOR.index -> builder.standbyInstances = deserializeString().let { StandbyInstances.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy