commonMain.aws.sdk.kotlin.services.autoscalingplans.serde.ScalingInstructionDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autoscalingplans-jvm Show documentation
Show all versions of autoscalingplans-jvm Show documentation
The AWS SDK for Kotlin client for Auto Scaling Plans
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.autoscalingplans.serde
import aws.sdk.kotlin.services.autoscalingplans.model.PredictiveScalingMaxCapacityBehavior
import aws.sdk.kotlin.services.autoscalingplans.model.PredictiveScalingMode
import aws.sdk.kotlin.services.autoscalingplans.model.ScalableDimension
import aws.sdk.kotlin.services.autoscalingplans.model.ScalingInstruction
import aws.sdk.kotlin.services.autoscalingplans.model.ScalingPolicyUpdateBehavior
import aws.sdk.kotlin.services.autoscalingplans.model.ServiceNamespace
import aws.sdk.kotlin.services.autoscalingplans.model.TargetTrackingConfiguration
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 deserializeScalingInstructionDocument(deserializer: Deserializer): ScalingInstruction {
val builder = ScalingInstruction.Builder()
val CUSTOMIZEDLOADMETRICSPECIFICATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("CustomizedLoadMetricSpecification"))
val DISABLEDYNAMICSCALING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("DisableDynamicScaling"))
val MAXCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MaxCapacity"))
val MINCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MinCapacity"))
val PREDEFINEDLOADMETRICSPECIFICATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("PredefinedLoadMetricSpecification"))
val PREDICTIVESCALINGMAXCAPACITYBEHAVIOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PredictiveScalingMaxCapacityBehavior"))
val PREDICTIVESCALINGMAXCAPACITYBUFFER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("PredictiveScalingMaxCapacityBuffer"))
val PREDICTIVESCALINGMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PredictiveScalingMode"))
val RESOURCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceId"))
val SCALABLEDIMENSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ScalableDimension"))
val SCALINGPOLICYUPDATEBEHAVIOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ScalingPolicyUpdateBehavior"))
val SCHEDULEDACTIONBUFFERTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("ScheduledActionBufferTime"))
val SERVICENAMESPACE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ServiceNamespace"))
val TARGETTRACKINGCONFIGURATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("TargetTrackingConfigurations"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CUSTOMIZEDLOADMETRICSPECIFICATION_DESCRIPTOR)
field(DISABLEDYNAMICSCALING_DESCRIPTOR)
field(MAXCAPACITY_DESCRIPTOR)
field(MINCAPACITY_DESCRIPTOR)
field(PREDEFINEDLOADMETRICSPECIFICATION_DESCRIPTOR)
field(PREDICTIVESCALINGMAXCAPACITYBEHAVIOR_DESCRIPTOR)
field(PREDICTIVESCALINGMAXCAPACITYBUFFER_DESCRIPTOR)
field(PREDICTIVESCALINGMODE_DESCRIPTOR)
field(RESOURCEID_DESCRIPTOR)
field(SCALABLEDIMENSION_DESCRIPTOR)
field(SCALINGPOLICYUPDATEBEHAVIOR_DESCRIPTOR)
field(SCHEDULEDACTIONBUFFERTIME_DESCRIPTOR)
field(SERVICENAMESPACE_DESCRIPTOR)
field(TARGETTRACKINGCONFIGURATIONS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CUSTOMIZEDLOADMETRICSPECIFICATION_DESCRIPTOR.index -> builder.customizedLoadMetricSpecification = deserializeCustomizedLoadMetricSpecificationDocument(deserializer)
DISABLEDYNAMICSCALING_DESCRIPTOR.index -> builder.disableDynamicScaling = deserializeBoolean()
MAXCAPACITY_DESCRIPTOR.index -> builder.maxCapacity = deserializeInt()
MINCAPACITY_DESCRIPTOR.index -> builder.minCapacity = deserializeInt()
PREDEFINEDLOADMETRICSPECIFICATION_DESCRIPTOR.index -> builder.predefinedLoadMetricSpecification = deserializePredefinedLoadMetricSpecificationDocument(deserializer)
PREDICTIVESCALINGMAXCAPACITYBEHAVIOR_DESCRIPTOR.index -> builder.predictiveScalingMaxCapacityBehavior = deserializeString().let { PredictiveScalingMaxCapacityBehavior.fromValue(it) }
PREDICTIVESCALINGMAXCAPACITYBUFFER_DESCRIPTOR.index -> builder.predictiveScalingMaxCapacityBuffer = deserializeInt()
PREDICTIVESCALINGMODE_DESCRIPTOR.index -> builder.predictiveScalingMode = deserializeString().let { PredictiveScalingMode.fromValue(it) }
RESOURCEID_DESCRIPTOR.index -> builder.resourceId = deserializeString()
SCALABLEDIMENSION_DESCRIPTOR.index -> builder.scalableDimension = deserializeString().let { ScalableDimension.fromValue(it) }
SCALINGPOLICYUPDATEBEHAVIOR_DESCRIPTOR.index -> builder.scalingPolicyUpdateBehavior = deserializeString().let { ScalingPolicyUpdateBehavior.fromValue(it) }
SCHEDULEDACTIONBUFFERTIME_DESCRIPTOR.index -> builder.scheduledActionBufferTime = deserializeInt()
SERVICENAMESPACE_DESCRIPTOR.index -> builder.serviceNamespace = deserializeString().let { ServiceNamespace.fromValue(it) }
TARGETTRACKINGCONFIGURATIONS_DESCRIPTOR.index -> builder.targetTrackingConfigurations =
deserializer.deserializeList(TARGETTRACKINGCONFIGURATIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeTargetTrackingConfigurationDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}