commonMain.aws.sdk.kotlin.services.backup.serde.CopyJobDocumentDeserializer.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.CopyJob
import aws.sdk.kotlin.services.backup.model.CopyJobState
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.mutableMapOf
internal fun deserializeCopyJobDocument(deserializer: Deserializer): CopyJob {
val builder = CopyJob.Builder()
val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AccountId"))
val BACKUPSIZEINBYTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("BackupSizeInBytes"))
val CHILDJOBSINSTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("ChildJobsInState"))
val COMPLETIONDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CompletionDate"))
val COMPOSITEMEMBERIDENTIFIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CompositeMemberIdentifier"))
val COPYJOBID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CopyJobId"))
val CREATEDBY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("CreatedBy"))
val CREATIONDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreationDate"))
val DESTINATIONBACKUPVAULTARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DestinationBackupVaultArn"))
val DESTINATIONRECOVERYPOINTARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DestinationRecoveryPointArn"))
val IAMROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("IamRoleArn"))
val ISPARENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsParent"))
val MESSAGECATEGORY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MessageCategory"))
val NUMBEROFCHILDJOBS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("NumberOfChildJobs"))
val PARENTJOBID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ParentJobId"))
val RESOURCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceArn"))
val RESOURCENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceName"))
val RESOURCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceType"))
val SOURCEBACKUPVAULTARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SourceBackupVaultArn"))
val SOURCERECOVERYPOINTARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SourceRecoveryPointArn"))
val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("State"))
val STATUSMESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StatusMessage"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ACCOUNTID_DESCRIPTOR)
field(BACKUPSIZEINBYTES_DESCRIPTOR)
field(CHILDJOBSINSTATE_DESCRIPTOR)
field(COMPLETIONDATE_DESCRIPTOR)
field(COMPOSITEMEMBERIDENTIFIER_DESCRIPTOR)
field(COPYJOBID_DESCRIPTOR)
field(CREATEDBY_DESCRIPTOR)
field(CREATIONDATE_DESCRIPTOR)
field(DESTINATIONBACKUPVAULTARN_DESCRIPTOR)
field(DESTINATIONRECOVERYPOINTARN_DESCRIPTOR)
field(IAMROLEARN_DESCRIPTOR)
field(ISPARENT_DESCRIPTOR)
field(MESSAGECATEGORY_DESCRIPTOR)
field(NUMBEROFCHILDJOBS_DESCRIPTOR)
field(PARENTJOBID_DESCRIPTOR)
field(RESOURCEARN_DESCRIPTOR)
field(RESOURCENAME_DESCRIPTOR)
field(RESOURCETYPE_DESCRIPTOR)
field(SOURCEBACKUPVAULTARN_DESCRIPTOR)
field(SOURCERECOVERYPOINTARN_DESCRIPTOR)
field(STATE_DESCRIPTOR)
field(STATUSMESSAGE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ACCOUNTID_DESCRIPTOR.index -> builder.accountId = deserializeString()
BACKUPSIZEINBYTES_DESCRIPTOR.index -> builder.backupSizeInBytes = deserializeLong()
CHILDJOBSINSTATE_DESCRIPTOR.index -> builder.childJobsInState =
deserializer.deserializeMap(CHILDJOBSINSTATE_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = CopyJobState.fromValue(key())
val v0 = if (nextHasValue()) { deserializeLong() } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
COMPLETIONDATE_DESCRIPTOR.index -> builder.completionDate = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
COMPOSITEMEMBERIDENTIFIER_DESCRIPTOR.index -> builder.compositeMemberIdentifier = deserializeString()
COPYJOBID_DESCRIPTOR.index -> builder.copyJobId = deserializeString()
CREATEDBY_DESCRIPTOR.index -> builder.createdBy = deserializeRecoveryPointCreatorDocument(deserializer)
CREATIONDATE_DESCRIPTOR.index -> builder.creationDate = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DESTINATIONBACKUPVAULTARN_DESCRIPTOR.index -> builder.destinationBackupVaultArn = deserializeString()
DESTINATIONRECOVERYPOINTARN_DESCRIPTOR.index -> builder.destinationRecoveryPointArn = deserializeString()
IAMROLEARN_DESCRIPTOR.index -> builder.iamRoleArn = deserializeString()
ISPARENT_DESCRIPTOR.index -> builder.isParent = deserializeBoolean()
MESSAGECATEGORY_DESCRIPTOR.index -> builder.messageCategory = deserializeString()
NUMBEROFCHILDJOBS_DESCRIPTOR.index -> builder.numberOfChildJobs = deserializeLong()
PARENTJOBID_DESCRIPTOR.index -> builder.parentJobId = deserializeString()
RESOURCEARN_DESCRIPTOR.index -> builder.resourceArn = deserializeString()
RESOURCENAME_DESCRIPTOR.index -> builder.resourceName = deserializeString()
RESOURCETYPE_DESCRIPTOR.index -> builder.resourceType = deserializeString()
SOURCEBACKUPVAULTARN_DESCRIPTOR.index -> builder.sourceBackupVaultArn = deserializeString()
SOURCERECOVERYPOINTARN_DESCRIPTOR.index -> builder.sourceRecoveryPointArn = deserializeString()
STATE_DESCRIPTOR.index -> builder.state = deserializeString().let { CopyJobState.fromValue(it) }
STATUSMESSAGE_DESCRIPTOR.index -> builder.statusMessage = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}