commonMain.aws.sdk.kotlin.services.applicationautoscaling.serde.ScalingPolicyDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of applicationautoscaling-jvm Show documentation
Show all versions of applicationautoscaling-jvm Show documentation
The AWS Kotlin client for Application Auto Scaling
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.applicationautoscaling.serde
import aws.sdk.kotlin.services.applicationautoscaling.model.Alarm
import aws.sdk.kotlin.services.applicationautoscaling.model.PolicyType
import aws.sdk.kotlin.services.applicationautoscaling.model.ScalableDimension
import aws.sdk.kotlin.services.applicationautoscaling.model.ScalingPolicy
import aws.sdk.kotlin.services.applicationautoscaling.model.ServiceNamespace
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 aws.smithy.kotlin.runtime.time.Instant
import kotlin.collections.mutableListOf
internal fun deserializeScalingPolicyDocument(deserializer: Deserializer): ScalingPolicy {
val builder = ScalingPolicy.Builder()
val ALARMS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Alarms"))
val CREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreationTime"))
val POLICYARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PolicyARN"))
val POLICYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PolicyName"))
val POLICYTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PolicyType"))
val RESOURCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceId"))
val SCALABLEDIMENSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ScalableDimension"))
val SERVICENAMESPACE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ServiceNamespace"))
val STEPSCALINGPOLICYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("StepScalingPolicyConfiguration"))
val TARGETTRACKINGSCALINGPOLICYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("TargetTrackingScalingPolicyConfiguration"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ALARMS_DESCRIPTOR)
field(CREATIONTIME_DESCRIPTOR)
field(POLICYARN_DESCRIPTOR)
field(POLICYNAME_DESCRIPTOR)
field(POLICYTYPE_DESCRIPTOR)
field(RESOURCEID_DESCRIPTOR)
field(SCALABLEDIMENSION_DESCRIPTOR)
field(SERVICENAMESPACE_DESCRIPTOR)
field(STEPSCALINGPOLICYCONFIGURATION_DESCRIPTOR)
field(TARGETTRACKINGSCALINGPOLICYCONFIGURATION_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
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
}
CREATIONTIME_DESCRIPTOR.index -> builder.creationTime = deserializeString().let { Instant.fromEpochSeconds(it) }
POLICYARN_DESCRIPTOR.index -> builder.policyArn = deserializeString()
POLICYNAME_DESCRIPTOR.index -> builder.policyName = deserializeString()
POLICYTYPE_DESCRIPTOR.index -> builder.policyType = deserializeString().let { PolicyType.fromValue(it) }
RESOURCEID_DESCRIPTOR.index -> builder.resourceId = deserializeString()
SCALABLEDIMENSION_DESCRIPTOR.index -> builder.scalableDimension = deserializeString().let { ScalableDimension.fromValue(it) }
SERVICENAMESPACE_DESCRIPTOR.index -> builder.serviceNamespace = deserializeString().let { ServiceNamespace.fromValue(it) }
STEPSCALINGPOLICYCONFIGURATION_DESCRIPTOR.index -> builder.stepScalingPolicyConfiguration = deserializeStepScalingPolicyConfigurationDocument(deserializer)
TARGETTRACKINGSCALINGPOLICYCONFIGURATION_DESCRIPTOR.index -> builder.targetTrackingScalingPolicyConfiguration = deserializeTargetTrackingScalingPolicyConfigurationDocument(deserializer)
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}