commonMain.aws.sdk.kotlin.services.autoscalingplans.serde.ScalingPlanDocumentDeserializer.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.ScalingInstruction
import aws.sdk.kotlin.services.autoscalingplans.model.ScalingPlan
import aws.sdk.kotlin.services.autoscalingplans.model.ScalingPlanStatusCode
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 aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf
internal fun deserializeScalingPlanDocument(deserializer: Deserializer): ScalingPlan {
val builder = ScalingPlan.Builder()
val APPLICATIONSOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ApplicationSource"))
val CREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreationTime"))
val SCALINGINSTRUCTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ScalingInstructions"))
val SCALINGPLANNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ScalingPlanName"))
val SCALINGPLANVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("ScalingPlanVersion"))
val STATUSCODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("StatusCode"))
val STATUSMESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StatusMessage"))
val STATUSSTARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StatusStartTime"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(APPLICATIONSOURCE_DESCRIPTOR)
field(CREATIONTIME_DESCRIPTOR)
field(SCALINGINSTRUCTIONS_DESCRIPTOR)
field(SCALINGPLANNAME_DESCRIPTOR)
field(SCALINGPLANVERSION_DESCRIPTOR)
field(STATUSCODE_DESCRIPTOR)
field(STATUSMESSAGE_DESCRIPTOR)
field(STATUSSTARTTIME_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
APPLICATIONSOURCE_DESCRIPTOR.index -> builder.applicationSource = deserializeApplicationSourceDocument(deserializer)
CREATIONTIME_DESCRIPTOR.index -> builder.creationTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
SCALINGINSTRUCTIONS_DESCRIPTOR.index -> builder.scalingInstructions =
deserializer.deserializeList(SCALINGINSTRUCTIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeScalingInstructionDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
SCALINGPLANNAME_DESCRIPTOR.index -> builder.scalingPlanName = deserializeString()
SCALINGPLANVERSION_DESCRIPTOR.index -> builder.scalingPlanVersion = deserializeLong()
STATUSCODE_DESCRIPTOR.index -> builder.statusCode = deserializeString().let { ScalingPlanStatusCode.fromValue(it) }
STATUSMESSAGE_DESCRIPTOR.index -> builder.statusMessage = deserializeString()
STATUSSTARTTIME_DESCRIPTOR.index -> builder.statusStartTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}