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

commonMain.aws.sdk.kotlin.services.computeoptimizer.serde.LicenseConfigurationDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.computeoptimizer.serde

import aws.sdk.kotlin.services.computeoptimizer.model.LicenseConfiguration
import aws.sdk.kotlin.services.computeoptimizer.model.LicenseEdition
import aws.sdk.kotlin.services.computeoptimizer.model.LicenseModel
import aws.sdk.kotlin.services.computeoptimizer.model.LicenseName
import aws.sdk.kotlin.services.computeoptimizer.model.MetricSource
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 deserializeLicenseConfigurationDocument(deserializer: Deserializer): LicenseConfiguration {
    val builder = LicenseConfiguration.Builder()
    val INSTANCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("instanceType"))
    val LICENSEEDITION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("licenseEdition"))
    val LICENSEMODEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("licenseModel"))
    val LICENSENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("licenseName"))
    val LICENSEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("licenseVersion"))
    val METRICSSOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("metricsSource"))
    val NUMBEROFCORES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("numberOfCores"))
    val OPERATINGSYSTEM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("operatingSystem"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(INSTANCETYPE_DESCRIPTOR)
        field(LICENSEEDITION_DESCRIPTOR)
        field(LICENSEMODEL_DESCRIPTOR)
        field(LICENSENAME_DESCRIPTOR)
        field(LICENSEVERSION_DESCRIPTOR)
        field(METRICSSOURCE_DESCRIPTOR)
        field(NUMBEROFCORES_DESCRIPTOR)
        field(OPERATINGSYSTEM_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                INSTANCETYPE_DESCRIPTOR.index -> builder.instanceType = deserializeString()
                LICENSEEDITION_DESCRIPTOR.index -> builder.licenseEdition = deserializeString().let { LicenseEdition.fromValue(it) }
                LICENSEMODEL_DESCRIPTOR.index -> builder.licenseModel = deserializeString().let { LicenseModel.fromValue(it) }
                LICENSENAME_DESCRIPTOR.index -> builder.licenseName = deserializeString().let { LicenseName.fromValue(it) }
                LICENSEVERSION_DESCRIPTOR.index -> builder.licenseVersion = deserializeString()
                METRICSSOURCE_DESCRIPTOR.index -> builder.metricsSource =
                    deserializer.deserializeList(METRICSSOURCE_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeMetricSourceDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                NUMBEROFCORES_DESCRIPTOR.index -> builder.numberOfCores = deserializeInt()
                OPERATINGSYSTEM_DESCRIPTOR.index -> builder.operatingSystem = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy