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

commonMain.aws.sdk.kotlin.services.deadline.serde.ServiceManagedEc2InstanceCapabilitiesDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.deadline.serde

import aws.sdk.kotlin.services.deadline.model.CpuArchitectureType
import aws.sdk.kotlin.services.deadline.model.FleetAmountCapability
import aws.sdk.kotlin.services.deadline.model.FleetAttributeCapability
import aws.sdk.kotlin.services.deadline.model.ServiceManagedEc2InstanceCapabilities
import aws.sdk.kotlin.services.deadline.model.ServiceManagedFleetOperatingSystemFamily
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 kotlin.collections.mutableListOf

internal fun deserializeServiceManagedEc2InstanceCapabilitiesDocument(deserializer: Deserializer): ServiceManagedEc2InstanceCapabilities {
    val builder = ServiceManagedEc2InstanceCapabilities.Builder()
    val ALLOWEDINSTANCETYPES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("allowedInstanceTypes"))
    val CPUARCHITECTURETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("cpuArchitectureType"))
    val CUSTOMAMOUNTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("customAmounts"))
    val CUSTOMATTRIBUTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("customAttributes"))
    val EXCLUDEDINSTANCETYPES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("excludedInstanceTypes"))
    val MEMORYMIB_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("memoryMiB"))
    val OSFAMILY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("osFamily"))
    val ROOTEBSVOLUME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("rootEbsVolume"))
    val VCPUCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("vCpuCount"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ALLOWEDINSTANCETYPES_DESCRIPTOR)
        field(CPUARCHITECTURETYPE_DESCRIPTOR)
        field(CUSTOMAMOUNTS_DESCRIPTOR)
        field(CUSTOMATTRIBUTES_DESCRIPTOR)
        field(EXCLUDEDINSTANCETYPES_DESCRIPTOR)
        field(MEMORYMIB_DESCRIPTOR)
        field(OSFAMILY_DESCRIPTOR)
        field(ROOTEBSVOLUME_DESCRIPTOR)
        field(VCPUCOUNT_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ALLOWEDINSTANCETYPES_DESCRIPTOR.index -> builder.allowedInstanceTypes =
                    deserializer.deserializeList(ALLOWEDINSTANCETYPES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                CPUARCHITECTURETYPE_DESCRIPTOR.index -> builder.cpuArchitectureType = deserializeString().let { CpuArchitectureType.fromValue(it) }
                CUSTOMAMOUNTS_DESCRIPTOR.index -> builder.customAmounts =
                    deserializer.deserializeList(CUSTOMAMOUNTS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeFleetAmountCapabilityDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                CUSTOMATTRIBUTES_DESCRIPTOR.index -> builder.customAttributes =
                    deserializer.deserializeList(CUSTOMATTRIBUTES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeFleetAttributeCapabilityDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                EXCLUDEDINSTANCETYPES_DESCRIPTOR.index -> builder.excludedInstanceTypes =
                    deserializer.deserializeList(EXCLUDEDINSTANCETYPES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                MEMORYMIB_DESCRIPTOR.index -> builder.memoryMib = deserializeMemoryMibRangeDocument(deserializer)
                OSFAMILY_DESCRIPTOR.index -> builder.osFamily = deserializeString().let { ServiceManagedFleetOperatingSystemFamily.fromValue(it) }
                ROOTEBSVOLUME_DESCRIPTOR.index -> builder.rootEbsVolume = deserializeEc2EbsVolumeDocument(deserializer)
                VCPUCOUNT_DESCRIPTOR.index -> builder.vCpuCount = deserializeVCpuCountRangeDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy