All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.gamelift.serde.ComputeDocumentDeserializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.gamelift.serde

import aws.sdk.kotlin.services.gamelift.model.Compute
import aws.sdk.kotlin.services.gamelift.model.ComputeStatus
import aws.sdk.kotlin.services.gamelift.model.ContainerAttribute
import aws.sdk.kotlin.services.gamelift.model.Ec2InstanceType
import aws.sdk.kotlin.services.gamelift.model.OperatingSystem
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.mutableListOf

internal fun deserializeComputeDocument(deserializer: Deserializer): Compute {
    val builder = Compute.Builder()
    val COMPUTEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ComputeArn"))
    val COMPUTENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ComputeName"))
    val COMPUTESTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ComputeStatus"))
    val CONTAINERATTRIBUTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ContainerAttributes"))
    val CREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreationTime"))
    val DNSNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DnsName"))
    val FLEETARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FleetArn"))
    val FLEETID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FleetId"))
    val GAMELIFTAGENTENDPOINT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GameLiftAgentEndpoint"))
    val GAMELIFTSERVICESDKENDPOINT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GameLiftServiceSdkEndpoint"))
    val GAMESERVERCONTAINERGROUPDEFINITIONARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GameServerContainerGroupDefinitionArn"))
    val INSTANCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("InstanceId"))
    val IPADDRESS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("IpAddress"))
    val LOCATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Location"))
    val OPERATINGSYSTEM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("OperatingSystem"))
    val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Type"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(COMPUTEARN_DESCRIPTOR)
        field(COMPUTENAME_DESCRIPTOR)
        field(COMPUTESTATUS_DESCRIPTOR)
        field(CONTAINERATTRIBUTES_DESCRIPTOR)
        field(CREATIONTIME_DESCRIPTOR)
        field(DNSNAME_DESCRIPTOR)
        field(FLEETARN_DESCRIPTOR)
        field(FLEETID_DESCRIPTOR)
        field(GAMELIFTAGENTENDPOINT_DESCRIPTOR)
        field(GAMELIFTSERVICESDKENDPOINT_DESCRIPTOR)
        field(GAMESERVERCONTAINERGROUPDEFINITIONARN_DESCRIPTOR)
        field(INSTANCEID_DESCRIPTOR)
        field(IPADDRESS_DESCRIPTOR)
        field(LOCATION_DESCRIPTOR)
        field(OPERATINGSYSTEM_DESCRIPTOR)
        field(TYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                COMPUTEARN_DESCRIPTOR.index -> builder.computeArn = deserializeString()
                COMPUTENAME_DESCRIPTOR.index -> builder.computeName = deserializeString()
                COMPUTESTATUS_DESCRIPTOR.index -> builder.computeStatus = deserializeString().let { ComputeStatus.fromValue(it) }
                CONTAINERATTRIBUTES_DESCRIPTOR.index -> builder.containerAttributes =
                    deserializer.deserializeList(CONTAINERATTRIBUTES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeContainerAttributeDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                CREATIONTIME_DESCRIPTOR.index -> builder.creationTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                DNSNAME_DESCRIPTOR.index -> builder.dnsName = deserializeString()
                FLEETARN_DESCRIPTOR.index -> builder.fleetArn = deserializeString()
                FLEETID_DESCRIPTOR.index -> builder.fleetId = deserializeString()
                GAMELIFTAGENTENDPOINT_DESCRIPTOR.index -> builder.gameLiftAgentEndpoint = deserializeString()
                GAMELIFTSERVICESDKENDPOINT_DESCRIPTOR.index -> builder.gameLiftServiceSdkEndpoint = deserializeString()
                GAMESERVERCONTAINERGROUPDEFINITIONARN_DESCRIPTOR.index -> builder.gameServerContainerGroupDefinitionArn = deserializeString()
                INSTANCEID_DESCRIPTOR.index -> builder.instanceId = deserializeString()
                IPADDRESS_DESCRIPTOR.index -> builder.ipAddress = deserializeString()
                LOCATION_DESCRIPTOR.index -> builder.location = deserializeString()
                OPERATINGSYSTEM_DESCRIPTOR.index -> builder.operatingSystem = deserializeString().let { OperatingSystem.fromValue(it) }
                TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { Ec2InstanceType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy