commonMain.aws.sdk.kotlin.services.applicationautoscaling.serde.ScheduledActionDocumentDeserializer.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.ScheduledAction
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 aws.smithy.kotlin.runtime.time.TimestampFormat
internal fun deserializeScheduledActionDocument(deserializer: Deserializer): ScheduledAction {
val builder = ScheduledAction.Builder()
val CREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreationTime"))
val ENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("EndTime"))
val RESOURCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceId"))
val SCALABLEDIMENSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ScalableDimension"))
val SCALABLETARGETACTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ScalableTargetAction"))
val SCHEDULE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Schedule"))
val SCHEDULEDACTIONARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ScheduledActionARN"))
val SCHEDULEDACTIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ScheduledActionName"))
val SERVICENAMESPACE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ServiceNamespace"))
val STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StartTime"))
val TIMEZONE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Timezone"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CREATIONTIME_DESCRIPTOR)
field(ENDTIME_DESCRIPTOR)
field(RESOURCEID_DESCRIPTOR)
field(SCALABLEDIMENSION_DESCRIPTOR)
field(SCALABLETARGETACTION_DESCRIPTOR)
field(SCHEDULE_DESCRIPTOR)
field(SCHEDULEDACTIONARN_DESCRIPTOR)
field(SCHEDULEDACTIONNAME_DESCRIPTOR)
field(SERVICENAMESPACE_DESCRIPTOR)
field(STARTTIME_DESCRIPTOR)
field(TIMEZONE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CREATIONTIME_DESCRIPTOR.index -> builder.creationTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
ENDTIME_DESCRIPTOR.index -> builder.endTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
RESOURCEID_DESCRIPTOR.index -> builder.resourceId = deserializeString()
SCALABLEDIMENSION_DESCRIPTOR.index -> builder.scalableDimension = deserializeString().let { ScalableDimension.fromValue(it) }
SCALABLETARGETACTION_DESCRIPTOR.index -> builder.scalableTargetAction = deserializeScalableTargetActionDocument(deserializer)
SCHEDULE_DESCRIPTOR.index -> builder.schedule = deserializeString()
SCHEDULEDACTIONARN_DESCRIPTOR.index -> builder.scheduledActionArn = deserializeString()
SCHEDULEDACTIONNAME_DESCRIPTOR.index -> builder.scheduledActionName = deserializeString()
SERVICENAMESPACE_DESCRIPTOR.index -> builder.serviceNamespace = deserializeString().let { ServiceNamespace.fromValue(it) }
STARTTIME_DESCRIPTOR.index -> builder.startTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
TIMEZONE_DESCRIPTOR.index -> builder.timezone = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}