commonMain.aws.sdk.kotlin.services.backupgateway.serde.HypervisorDocumentDeserializer.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.Hypervisor
import aws.sdk.kotlin.services.backupgateway.model.HypervisorState
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
internal fun deserializeHypervisorDocument(deserializer: Deserializer): Hypervisor {
val builder = Hypervisor.Builder()
val HOST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Host"))
val HYPERVISORARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("HypervisorArn"))
val KMSKEYARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("KmsKeyArn"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("State"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(HOST_DESCRIPTOR)
field(HYPERVISORARN_DESCRIPTOR)
field(KMSKEYARN_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(STATE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
HOST_DESCRIPTOR.index -> builder.host = deserializeString()
HYPERVISORARN_DESCRIPTOR.index -> builder.hypervisorArn = deserializeString()
KMSKEYARN_DESCRIPTOR.index -> builder.kmsKeyArn = deserializeString()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
STATE_DESCRIPTOR.index -> builder.state = deserializeString().let { HypervisorState.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}