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

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

There is a newer version: 1.3.99
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.Alarm
import aws.sdk.kotlin.services.autoscaling.model.ScalingPolicy
import aws.sdk.kotlin.services.autoscaling.model.StepAdjustment
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 deserializeScalingPolicyDocument(deserializer: Deserializer): ScalingPolicy {
    val builder = ScalingPolicy.Builder()
    val ADJUSTMENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("AdjustmentType"))
    val ALARMS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, XmlSerialName("Alarms"))
    val AUTOSCALINGGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("AutoScalingGroupName"))
    val COOLDOWN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("Cooldown"))
    val ENABLED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, XmlSerialName("Enabled"))
    val ESTIMATEDINSTANCEWARMUP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("EstimatedInstanceWarmup"))
    val METRICAGGREGATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("MetricAggregationType"))
    val MINADJUSTMENTMAGNITUDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("MinAdjustmentMagnitude"))
    val MINADJUSTMENTSTEP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("MinAdjustmentStep"))
    val POLICYARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("PolicyARN"))
    val POLICYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("PolicyName"))
    val POLICYTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("PolicyType"))
    val PREDICTIVESCALINGCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, XmlSerialName("PredictiveScalingConfiguration"))
    val SCALINGADJUSTMENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("ScalingAdjustment"))
    val STEPADJUSTMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, XmlSerialName("StepAdjustments"))
    val TARGETTRACKINGCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, XmlSerialName("TargetTrackingConfiguration"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        trait(XmlSerialName("ScalingPolicy"))
        trait(XmlNamespace("http://autoscaling.amazonaws.com/doc/2011-01-01/"))
        field(ADJUSTMENTTYPE_DESCRIPTOR)
        field(ALARMS_DESCRIPTOR)
        field(AUTOSCALINGGROUPNAME_DESCRIPTOR)
        field(COOLDOWN_DESCRIPTOR)
        field(ENABLED_DESCRIPTOR)
        field(ESTIMATEDINSTANCEWARMUP_DESCRIPTOR)
        field(METRICAGGREGATIONTYPE_DESCRIPTOR)
        field(MINADJUSTMENTMAGNITUDE_DESCRIPTOR)
        field(MINADJUSTMENTSTEP_DESCRIPTOR)
        field(POLICYARN_DESCRIPTOR)
        field(POLICYNAME_DESCRIPTOR)
        field(POLICYTYPE_DESCRIPTOR)
        field(PREDICTIVESCALINGCONFIGURATION_DESCRIPTOR)
        field(SCALINGADJUSTMENT_DESCRIPTOR)
        field(STEPADJUSTMENTS_DESCRIPTOR)
        field(TARGETTRACKINGCONFIGURATION_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ADJUSTMENTTYPE_DESCRIPTOR.index -> builder.adjustmentType = deserializeString()
                ALARMS_DESCRIPTOR.index -> builder.alarms =
                    deserializer.deserializeList(ALARMS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeAlarmDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                AUTOSCALINGGROUPNAME_DESCRIPTOR.index -> builder.autoScalingGroupName = deserializeString()
                COOLDOWN_DESCRIPTOR.index -> builder.cooldown = deserializeInt()
                ENABLED_DESCRIPTOR.index -> builder.enabled = deserializeBoolean()
                ESTIMATEDINSTANCEWARMUP_DESCRIPTOR.index -> builder.estimatedInstanceWarmup = deserializeInt()
                METRICAGGREGATIONTYPE_DESCRIPTOR.index -> builder.metricAggregationType = deserializeString()
                MINADJUSTMENTMAGNITUDE_DESCRIPTOR.index -> builder.minAdjustmentMagnitude = deserializeInt()
                MINADJUSTMENTSTEP_DESCRIPTOR.index -> builder.minAdjustmentStep = deserializeInt()
                POLICYARN_DESCRIPTOR.index -> builder.policyArn = deserializeString()
                POLICYNAME_DESCRIPTOR.index -> builder.policyName = deserializeString()
                POLICYTYPE_DESCRIPTOR.index -> builder.policyType = deserializeString()
                PREDICTIVESCALINGCONFIGURATION_DESCRIPTOR.index -> builder.predictiveScalingConfiguration = deserializePredictiveScalingConfigurationDocument(deserializer)
                SCALINGADJUSTMENT_DESCRIPTOR.index -> builder.scalingAdjustment = deserializeInt()
                STEPADJUSTMENTS_DESCRIPTOR.index -> builder.stepAdjustments =
                    deserializer.deserializeList(STEPADJUSTMENTS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeStepAdjustmentDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                TARGETTRACKINGCONFIGURATION_DESCRIPTOR.index -> builder.targetTrackingConfiguration = deserializeTargetTrackingConfigurationDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy