commonMain.aws.sdk.kotlin.services.applicationautoscaling.serde.ScalableTargetDocumentDeserializer.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.ScalableDimension
import aws.sdk.kotlin.services.applicationautoscaling.model.ScalableTarget
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
internal fun deserializeScalableTargetDocument(deserializer: Deserializer): ScalableTarget {
val builder = ScalableTarget.Builder()
val CREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreationTime"))
val MAXCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MaxCapacity"))
val MINCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MinCapacity"))
val RESOURCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceId"))
val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RoleARN"))
val SCALABLEDIMENSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ScalableDimension"))
val SCALABLETARGETARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ScalableTargetARN"))
val SERVICENAMESPACE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ServiceNamespace"))
val SUSPENDEDSTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("SuspendedState"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CREATIONTIME_DESCRIPTOR)
field(MAXCAPACITY_DESCRIPTOR)
field(MINCAPACITY_DESCRIPTOR)
field(RESOURCEID_DESCRIPTOR)
field(ROLEARN_DESCRIPTOR)
field(SCALABLEDIMENSION_DESCRIPTOR)
field(SCALABLETARGETARN_DESCRIPTOR)
field(SERVICENAMESPACE_DESCRIPTOR)
field(SUSPENDEDSTATE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CREATIONTIME_DESCRIPTOR.index -> builder.creationTime = deserializeString().let { Instant.fromEpochSeconds(it) }
MAXCAPACITY_DESCRIPTOR.index -> builder.maxCapacity = deserializeInt()
MINCAPACITY_DESCRIPTOR.index -> builder.minCapacity = deserializeInt()
RESOURCEID_DESCRIPTOR.index -> builder.resourceId = deserializeString()
ROLEARN_DESCRIPTOR.index -> builder.roleArn = deserializeString()
SCALABLEDIMENSION_DESCRIPTOR.index -> builder.scalableDimension = deserializeString().let { ScalableDimension.fromValue(it) }
SCALABLETARGETARN_DESCRIPTOR.index -> builder.scalableTargetArn = deserializeString()
SERVICENAMESPACE_DESCRIPTOR.index -> builder.serviceNamespace = deserializeString().let { ServiceNamespace.fromValue(it) }
SUSPENDEDSTATE_DESCRIPTOR.index -> builder.suspendedState = deserializeSuspendedStateDocument(deserializer)
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}