
commonMain.aws.sdk.kotlin.services.opensearch.serde.UpgradeHistoryDocumentDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.opensearch.serde
import aws.sdk.kotlin.services.opensearch.model.UpgradeHistory
import aws.sdk.kotlin.services.opensearch.model.UpgradeStatus
import aws.sdk.kotlin.services.opensearch.model.UpgradeStepItem
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 deserializeUpgradeHistoryDocument(deserializer: Deserializer): UpgradeHistory {
val builder = UpgradeHistory.Builder()
val STARTTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StartTimestamp"))
val STEPSLIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("StepsList"))
val UPGRADENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("UpgradeName"))
val UPGRADESTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("UpgradeStatus"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(STARTTIMESTAMP_DESCRIPTOR)
field(STEPSLIST_DESCRIPTOR)
field(UPGRADENAME_DESCRIPTOR)
field(UPGRADESTATUS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
STARTTIMESTAMP_DESCRIPTOR.index -> builder.startTimestamp = deserializeString().let { Instant.fromEpochSeconds(it) }
STEPSLIST_DESCRIPTOR.index -> builder.stepsList =
deserializer.deserializeList(STEPSLIST_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeUpgradeStepItemDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
UPGRADENAME_DESCRIPTOR.index -> builder.upgradeName = deserializeString()
UPGRADESTATUS_DESCRIPTOR.index -> builder.upgradeStatus = deserializeString().let { UpgradeStatus.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy