commonMain.aws.sdk.kotlin.services.snowdevicemanagement.serde.InstanceDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snowdevicemanagement-jvm Show documentation
Show all versions of snowdevicemanagement-jvm Show documentation
The AWS SDK for Kotlin client for Snow Device Management
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.snowdevicemanagement.serde
import aws.sdk.kotlin.services.snowdevicemanagement.model.Instance
import aws.sdk.kotlin.services.snowdevicemanagement.model.InstanceBlockDeviceMapping
import aws.sdk.kotlin.services.snowdevicemanagement.model.SecurityGroupIdentifier
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 deserializeInstanceDocument(deserializer: Deserializer): Instance {
val builder = Instance.Builder()
val AMILAUNCHINDEX_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("amiLaunchIndex"))
val BLOCKDEVICEMAPPINGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("blockDeviceMappings"))
val CPUOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("cpuOptions"))
val CREATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("createdAt"))
val IMAGEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("imageId"))
val INSTANCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("instanceId"))
val INSTANCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("instanceType"))
val PRIVATEIPADDRESS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("privateIpAddress"))
val PUBLICIPADDRESS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("publicIpAddress"))
val ROOTDEVICENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("rootDeviceName"))
val SECURITYGROUPS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("securityGroups"))
val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("state"))
val UPDATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("updatedAt"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AMILAUNCHINDEX_DESCRIPTOR)
field(BLOCKDEVICEMAPPINGS_DESCRIPTOR)
field(CPUOPTIONS_DESCRIPTOR)
field(CREATEDAT_DESCRIPTOR)
field(IMAGEID_DESCRIPTOR)
field(INSTANCEID_DESCRIPTOR)
field(INSTANCETYPE_DESCRIPTOR)
field(PRIVATEIPADDRESS_DESCRIPTOR)
field(PUBLICIPADDRESS_DESCRIPTOR)
field(ROOTDEVICENAME_DESCRIPTOR)
field(SECURITYGROUPS_DESCRIPTOR)
field(STATE_DESCRIPTOR)
field(UPDATEDAT_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
AMILAUNCHINDEX_DESCRIPTOR.index -> builder.amiLaunchIndex = deserializeInt()
BLOCKDEVICEMAPPINGS_DESCRIPTOR.index -> builder.blockDeviceMappings =
deserializer.deserializeList(BLOCKDEVICEMAPPINGS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeInstanceBlockDeviceMappingDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
CPUOPTIONS_DESCRIPTOR.index -> builder.cpuOptions = deserializeCpuOptionsDocument(deserializer)
CREATEDAT_DESCRIPTOR.index -> builder.createdAt = deserializeString().let { Instant.fromEpochSeconds(it) }
IMAGEID_DESCRIPTOR.index -> builder.imageId = deserializeString()
INSTANCEID_DESCRIPTOR.index -> builder.instanceId = deserializeString()
INSTANCETYPE_DESCRIPTOR.index -> builder.instanceType = deserializeString()
PRIVATEIPADDRESS_DESCRIPTOR.index -> builder.privateIpAddress = deserializeString()
PUBLICIPADDRESS_DESCRIPTOR.index -> builder.publicIpAddress = deserializeString()
ROOTDEVICENAME_DESCRIPTOR.index -> builder.rootDeviceName = deserializeString()
SECURITYGROUPS_DESCRIPTOR.index -> builder.securityGroups =
deserializer.deserializeList(SECURITYGROUPS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeSecurityGroupIdentifierDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
STATE_DESCRIPTOR.index -> builder.state = deserializeInstanceStateDocument(deserializer)
UPDATEDAT_DESCRIPTOR.index -> builder.updatedAt = deserializeString().let { Instant.fromEpochSeconds(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy