commonMain.aws.sdk.kotlin.services.backup.serde.BackupRuleDocumentDeserializer.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.BackupRule
import aws.sdk.kotlin.services.backup.model.CopyAction
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
import kotlin.collections.mutableMapOf
internal fun deserializeBackupRuleDocument(deserializer: Deserializer): BackupRule {
val builder = BackupRule.Builder()
val COMPLETIONWINDOWMINUTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("CompletionWindowMinutes"))
val COPYACTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("CopyActions"))
val ENABLECONTINUOUSBACKUP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("EnableContinuousBackup"))
val LIFECYCLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Lifecycle"))
val RECOVERYPOINTTAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("RecoveryPointTags"))
val RULEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RuleId"))
val RULENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RuleName"))
val SCHEDULEEXPRESSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ScheduleExpression"))
val SCHEDULEEXPRESSIONTIMEZONE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ScheduleExpressionTimezone"))
val STARTWINDOWMINUTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("StartWindowMinutes"))
val TARGETBACKUPVAULTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("TargetBackupVaultName"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(COMPLETIONWINDOWMINUTES_DESCRIPTOR)
field(COPYACTIONS_DESCRIPTOR)
field(ENABLECONTINUOUSBACKUP_DESCRIPTOR)
field(LIFECYCLE_DESCRIPTOR)
field(RECOVERYPOINTTAGS_DESCRIPTOR)
field(RULEID_DESCRIPTOR)
field(RULENAME_DESCRIPTOR)
field(SCHEDULEEXPRESSION_DESCRIPTOR)
field(SCHEDULEEXPRESSIONTIMEZONE_DESCRIPTOR)
field(STARTWINDOWMINUTES_DESCRIPTOR)
field(TARGETBACKUPVAULTNAME_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
COMPLETIONWINDOWMINUTES_DESCRIPTOR.index -> builder.completionWindowMinutes = deserializeLong()
COPYACTIONS_DESCRIPTOR.index -> builder.copyActions =
deserializer.deserializeList(COPYACTIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeCopyActionDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
ENABLECONTINUOUSBACKUP_DESCRIPTOR.index -> builder.enableContinuousBackup = deserializeBoolean()
LIFECYCLE_DESCRIPTOR.index -> builder.lifecycle = deserializeLifecycleDocument(deserializer)
RECOVERYPOINTTAGS_DESCRIPTOR.index -> builder.recoveryPointTags =
deserializer.deserializeMap(RECOVERYPOINTTAGS_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = key()
val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
RULEID_DESCRIPTOR.index -> builder.ruleId = deserializeString()
RULENAME_DESCRIPTOR.index -> builder.ruleName = deserializeString()
SCHEDULEEXPRESSION_DESCRIPTOR.index -> builder.scheduleExpression = deserializeString()
SCHEDULEEXPRESSIONTIMEZONE_DESCRIPTOR.index -> builder.scheduleExpressionTimezone = deserializeString()
STARTWINDOWMINUTES_DESCRIPTOR.index -> builder.startWindowMinutes = deserializeLong()
TARGETBACKUPVAULTNAME_DESCRIPTOR.index -> builder.targetBackupVaultName = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}