commonMain.aws.sdk.kotlin.services.backup.serde.RestoreTestingRecoveryPointSelectionDocumentDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.backup.serde
import aws.sdk.kotlin.services.backup.model.RestoreTestingRecoveryPointSelection
import aws.sdk.kotlin.services.backup.model.RestoreTestingRecoveryPointSelectionAlgorithm
import aws.sdk.kotlin.services.backup.model.RestoreTestingRecoveryPointType
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 kotlin.collections.mutableListOf
internal fun deserializeRestoreTestingRecoveryPointSelectionDocument(deserializer: Deserializer): RestoreTestingRecoveryPointSelection {
val builder = RestoreTestingRecoveryPointSelection.Builder()
val ALGORITHM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Algorithm"))
val EXCLUDEVAULTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ExcludeVaults"))
val INCLUDEVAULTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("IncludeVaults"))
val RECOVERYPOINTTYPES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("RecoveryPointTypes"))
val SELECTIONWINDOWDAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("SelectionWindowDays"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ALGORITHM_DESCRIPTOR)
field(EXCLUDEVAULTS_DESCRIPTOR)
field(INCLUDEVAULTS_DESCRIPTOR)
field(RECOVERYPOINTTYPES_DESCRIPTOR)
field(SELECTIONWINDOWDAYS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ALGORITHM_DESCRIPTOR.index -> builder.algorithm = deserializeString().let { RestoreTestingRecoveryPointSelectionAlgorithm.fromValue(it) }
EXCLUDEVAULTS_DESCRIPTOR.index -> builder.excludeVaults =
deserializer.deserializeList(EXCLUDEVAULTS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
INCLUDEVAULTS_DESCRIPTOR.index -> builder.includeVaults =
deserializer.deserializeList(INCLUDEVAULTS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
RECOVERYPOINTTYPES_DESCRIPTOR.index -> builder.recoveryPointTypes =
deserializer.deserializeList(RECOVERYPOINTTYPES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString().let { RestoreTestingRecoveryPointType.fromValue(it) } } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
SELECTIONWINDOWDAYS_DESCRIPTOR.index -> builder.selectionWindowDays = deserializeInt()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}