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

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

There is a newer version: 1.3.99
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

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

import aws.sdk.kotlin.services.gamelift.model.Ec2InstanceType
import aws.sdk.kotlin.services.gamelift.model.FleetCapacity
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 deserializeFleetCapacityDocument(deserializer: Deserializer): FleetCapacity {
    val builder = FleetCapacity.Builder()
    val FLEETARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FleetArn"))
    val FLEETID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FleetId"))
    val GAMESERVERCONTAINERGROUPCOUNTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("GameServerContainerGroupCounts"))
    val INSTANCECOUNTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("InstanceCounts"))
    val INSTANCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("InstanceType"))
    val LOCATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Location"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(FLEETARN_DESCRIPTOR)
        field(FLEETID_DESCRIPTOR)
        field(GAMESERVERCONTAINERGROUPCOUNTS_DESCRIPTOR)
        field(INSTANCECOUNTS_DESCRIPTOR)
        field(INSTANCETYPE_DESCRIPTOR)
        field(LOCATION_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                FLEETARN_DESCRIPTOR.index -> builder.fleetArn = deserializeString()
                FLEETID_DESCRIPTOR.index -> builder.fleetId = deserializeString()
                GAMESERVERCONTAINERGROUPCOUNTS_DESCRIPTOR.index -> builder.gameServerContainerGroupCounts = deserializeGameServerContainerGroupCountsDocument(deserializer)
                INSTANCECOUNTS_DESCRIPTOR.index -> builder.instanceCounts = deserializeEc2InstanceCountsDocument(deserializer)
                INSTANCETYPE_DESCRIPTOR.index -> builder.instanceType = deserializeString().let { Ec2InstanceType.fromValue(it) }
                LOCATION_DESCRIPTOR.index -> builder.location = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy