commonMain.aws.sdk.kotlin.services.applicationautoscaling.serde.ScalingActivityDocumentDeserializer.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
The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.applicationautoscaling.serde
import aws.sdk.kotlin.services.applicationautoscaling.model.NotScaledReason
import aws.sdk.kotlin.services.applicationautoscaling.model.ScalableDimension
import aws.sdk.kotlin.services.applicationautoscaling.model.ScalingActivity
import aws.sdk.kotlin.services.applicationautoscaling.model.ScalingActivityStatusCode
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
import kotlin.collections.mutableListOf
internal fun deserializeScalingActivityDocument(deserializer: Deserializer): ScalingActivity {
val builder = ScalingActivity.Builder()
val ACTIVITYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ActivityId"))
val CAUSE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Cause"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val DETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Details"))
val ENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("EndTime"))
val NOTSCALEDREASONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("NotScaledReasons"))
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 STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StartTime"))
val STATUSCODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("StatusCode"))
val STATUSMESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StatusMessage"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ACTIVITYID_DESCRIPTOR)
field(CAUSE_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(DETAILS_DESCRIPTOR)
field(ENDTIME_DESCRIPTOR)
field(NOTSCALEDREASONS_DESCRIPTOR)
field(RESOURCEID_DESCRIPTOR)
field(SCALABLEDIMENSION_DESCRIPTOR)
field(SERVICENAMESPACE_DESCRIPTOR)
field(STARTTIME_DESCRIPTOR)
field(STATUSCODE_DESCRIPTOR)
field(STATUSMESSAGE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ACTIVITYID_DESCRIPTOR.index -> builder.activityId = deserializeString()
CAUSE_DESCRIPTOR.index -> builder.cause = deserializeString()
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
DETAILS_DESCRIPTOR.index -> builder.details = deserializeString()
ENDTIME_DESCRIPTOR.index -> builder.endTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
NOTSCALEDREASONS_DESCRIPTOR.index -> builder.notScaledReasons =
deserializer.deserializeList(NOTSCALEDREASONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeNotScaledReasonDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
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) }
STARTTIME_DESCRIPTOR.index -> builder.startTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
STATUSCODE_DESCRIPTOR.index -> builder.statusCode = deserializeString().let { ScalingActivityStatusCode.fromValue(it) }
STATUSMESSAGE_DESCRIPTOR.index -> builder.statusMessage = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}