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

commonMain.aws.sdk.kotlin.services.applicationautoscaling.serde.StepScalingPolicyConfigurationDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.applicationautoscaling.serde

import aws.sdk.kotlin.services.applicationautoscaling.model.AdjustmentType
import aws.sdk.kotlin.services.applicationautoscaling.model.MetricAggregationType
import aws.sdk.kotlin.services.applicationautoscaling.model.StepAdjustment
import aws.sdk.kotlin.services.applicationautoscaling.model.StepScalingPolicyConfiguration
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
import kotlin.collections.mutableListOf

internal fun deserializeStepScalingPolicyConfigurationDocument(deserializer: Deserializer): StepScalingPolicyConfiguration {
    val builder = StepScalingPolicyConfiguration.Builder()
    val ADJUSTMENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("AdjustmentType"))
    val COOLDOWN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Cooldown"))
    val METRICAGGREGATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("MetricAggregationType"))
    val MINADJUSTMENTMAGNITUDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MinAdjustmentMagnitude"))
    val STEPADJUSTMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("StepAdjustments"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ADJUSTMENTTYPE_DESCRIPTOR)
        field(COOLDOWN_DESCRIPTOR)
        field(METRICAGGREGATIONTYPE_DESCRIPTOR)
        field(MINADJUSTMENTMAGNITUDE_DESCRIPTOR)
        field(STEPADJUSTMENTS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ADJUSTMENTTYPE_DESCRIPTOR.index -> builder.adjustmentType = deserializeString().let { AdjustmentType.fromValue(it) }
                COOLDOWN_DESCRIPTOR.index -> builder.cooldown = deserializeInt()
                METRICAGGREGATIONTYPE_DESCRIPTOR.index -> builder.metricAggregationType = deserializeString().let { MetricAggregationType.fromValue(it) }
                MINADJUSTMENTMAGNITUDE_DESCRIPTOR.index -> builder.minAdjustmentMagnitude = 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
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy