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

commonMain.aws.sdk.kotlin.services.deadline.serde.CustomerManagedWorkerCapabilitiesDocumentDeserializer.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.AcceleratorType
import aws.sdk.kotlin.services.deadline.model.CpuArchitectureType
import aws.sdk.kotlin.services.deadline.model.CustomerManagedFleetOperatingSystemFamily
import aws.sdk.kotlin.services.deadline.model.CustomerManagedWorkerCapabilities
import aws.sdk.kotlin.services.deadline.model.FleetAmountCapability
import aws.sdk.kotlin.services.deadline.model.FleetAttributeCapability
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 deserializeCustomerManagedWorkerCapabilitiesDocument(deserializer: Deserializer): CustomerManagedWorkerCapabilities {
    val builder = CustomerManagedWorkerCapabilities.Builder()
    val ACCELERATORCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("acceleratorCount"))
    val ACCELERATORTOTALMEMORYMIB_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("acceleratorTotalMemoryMiB"))
    val ACCELERATORTYPES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("acceleratorTypes"))
    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 MEMORYMIB_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("memoryMiB"))
    val OSFAMILY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("osFamily"))
    val VCPUCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("vCpuCount"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACCELERATORCOUNT_DESCRIPTOR)
        field(ACCELERATORTOTALMEMORYMIB_DESCRIPTOR)
        field(ACCELERATORTYPES_DESCRIPTOR)
        field(CPUARCHITECTURETYPE_DESCRIPTOR)
        field(CUSTOMAMOUNTS_DESCRIPTOR)
        field(CUSTOMATTRIBUTES_DESCRIPTOR)
        field(MEMORYMIB_DESCRIPTOR)
        field(OSFAMILY_DESCRIPTOR)
        field(VCPUCOUNT_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACCELERATORCOUNT_DESCRIPTOR.index -> builder.acceleratorCount = deserializeAcceleratorCountRangeDocument(deserializer)
                ACCELERATORTOTALMEMORYMIB_DESCRIPTOR.index -> builder.acceleratorTotalMemoryMib = deserializeAcceleratorTotalMemoryMibRangeDocument(deserializer)
                ACCELERATORTYPES_DESCRIPTOR.index -> builder.acceleratorTypes =
                    deserializer.deserializeList(ACCELERATORTYPES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { AcceleratorType.fromValue(it) } } 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
                    }
                MEMORYMIB_DESCRIPTOR.index -> builder.memoryMib = deserializeMemoryMibRangeDocument(deserializer)
                OSFAMILY_DESCRIPTOR.index -> builder.osFamily = deserializeString().let { CustomerManagedFleetOperatingSystemFamily.fromValue(it) }
                VCPUCOUNT_DESCRIPTOR.index -> builder.vCpuCount = deserializeVCpuCountRangeDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy