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

commonMain.aws.sdk.kotlin.services.autoscaling.serde.PredictiveScalingConfigurationDocumentDeserializer.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.PredictiveScalingConfiguration
import aws.sdk.kotlin.services.autoscaling.model.PredictiveScalingMaxCapacityBreachBehavior
import aws.sdk.kotlin.services.autoscaling.model.PredictiveScalingMetricSpecification
import aws.sdk.kotlin.services.autoscaling.model.PredictiveScalingMode
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 deserializePredictiveScalingConfigurationDocument(deserializer: Deserializer): PredictiveScalingConfiguration {
    val builder = PredictiveScalingConfiguration.Builder()
    val MAXCAPACITYBREACHBEHAVIOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, XmlSerialName("MaxCapacityBreachBehavior"))
    val MAXCAPACITYBUFFER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("MaxCapacityBuffer"))
    val METRICSPECIFICATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, XmlSerialName("MetricSpecifications"))
    val MODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, XmlSerialName("Mode"))
    val SCHEDULINGBUFFERTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, XmlSerialName("SchedulingBufferTime"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        trait(XmlSerialName("PredictiveScalingConfiguration"))
        trait(XmlNamespace("http://autoscaling.amazonaws.com/doc/2011-01-01/"))
        field(MAXCAPACITYBREACHBEHAVIOR_DESCRIPTOR)
        field(MAXCAPACITYBUFFER_DESCRIPTOR)
        field(METRICSPECIFICATIONS_DESCRIPTOR)
        field(MODE_DESCRIPTOR)
        field(SCHEDULINGBUFFERTIME_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                MAXCAPACITYBREACHBEHAVIOR_DESCRIPTOR.index -> builder.maxCapacityBreachBehavior = deserializeString().let { PredictiveScalingMaxCapacityBreachBehavior.fromValue(it) }
                MAXCAPACITYBUFFER_DESCRIPTOR.index -> builder.maxCapacityBuffer = deserializeInt()
                METRICSPECIFICATIONS_DESCRIPTOR.index -> builder.metricSpecifications =
                    deserializer.deserializeList(METRICSPECIFICATIONS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializePredictiveScalingMetricSpecificationDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                MODE_DESCRIPTOR.index -> builder.mode = deserializeString().let { PredictiveScalingMode.fromValue(it) }
                SCHEDULINGBUFFERTIME_DESCRIPTOR.index -> builder.schedulingBufferTime = deserializeInt()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy