commonMain.aws.sdk.kotlin.services.backupgateway.serde.VirtualMachineDetailsDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of backupgateway-jvm Show documentation
Show all versions of backupgateway-jvm Show documentation
The AWS SDK for Kotlin client for Backup Gateway
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.backupgateway.serde
import aws.sdk.kotlin.services.backupgateway.model.VirtualMachineDetails
import aws.sdk.kotlin.services.backupgateway.model.VmwareTag
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 deserializeVirtualMachineDetailsDocument(deserializer: Deserializer): VirtualMachineDetails {
val builder = VirtualMachineDetails.Builder()
val HOSTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("HostName"))
val HYPERVISORID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("HypervisorId"))
val LASTBACKUPDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastBackupDate"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val PATH_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Path"))
val RESOURCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceArn"))
val VMWARETAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("VmwareTags"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(HOSTNAME_DESCRIPTOR)
field(HYPERVISORID_DESCRIPTOR)
field(LASTBACKUPDATE_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(PATH_DESCRIPTOR)
field(RESOURCEARN_DESCRIPTOR)
field(VMWARETAGS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
HOSTNAME_DESCRIPTOR.index -> builder.hostName = deserializeString()
HYPERVISORID_DESCRIPTOR.index -> builder.hypervisorId = deserializeString()
LASTBACKUPDATE_DESCRIPTOR.index -> builder.lastBackupDate = deserializeString().let { Instant.fromEpochSeconds(it) }
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
PATH_DESCRIPTOR.index -> builder.path = deserializeString()
RESOURCEARN_DESCRIPTOR.index -> builder.resourceArn = deserializeString()
VMWARETAGS_DESCRIPTOR.index -> builder.vmwareTags =
deserializer.deserializeList(VMWARETAGS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeVmwareTagDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}