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

commonMain.aws.sdk.kotlin.services.servicequotas.serde.ServiceQuotaDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.servicequotas.serde

import aws.sdk.kotlin.services.servicequotas.model.AppliedLevelEnum
import aws.sdk.kotlin.services.servicequotas.model.ServiceQuota
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 deserializeServiceQuotaDocument(deserializer: Deserializer): ServiceQuota {
    val builder = ServiceQuota.Builder()
    val ADJUSTABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("Adjustable"))
    val ERRORREASON_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ErrorReason"))
    val GLOBALQUOTA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("GlobalQuota"))
    val PERIOD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Period"))
    val QUOTAAPPLIEDATLEVEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("QuotaAppliedAtLevel"))
    val QUOTAARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("QuotaArn"))
    val QUOTACODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("QuotaCode"))
    val QUOTACONTEXT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("QuotaContext"))
    val QUOTANAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("QuotaName"))
    val SERVICECODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ServiceCode"))
    val SERVICENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ServiceName"))
    val UNIT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Unit"))
    val USAGEMETRIC_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("UsageMetric"))
    val VALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("Value"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ADJUSTABLE_DESCRIPTOR)
        field(ERRORREASON_DESCRIPTOR)
        field(GLOBALQUOTA_DESCRIPTOR)
        field(PERIOD_DESCRIPTOR)
        field(QUOTAAPPLIEDATLEVEL_DESCRIPTOR)
        field(QUOTAARN_DESCRIPTOR)
        field(QUOTACODE_DESCRIPTOR)
        field(QUOTACONTEXT_DESCRIPTOR)
        field(QUOTANAME_DESCRIPTOR)
        field(SERVICECODE_DESCRIPTOR)
        field(SERVICENAME_DESCRIPTOR)
        field(UNIT_DESCRIPTOR)
        field(USAGEMETRIC_DESCRIPTOR)
        field(VALUE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ADJUSTABLE_DESCRIPTOR.index -> builder.adjustable = deserializeBoolean()
                ERRORREASON_DESCRIPTOR.index -> builder.errorReason = deserializeErrorReasonDocument(deserializer)
                GLOBALQUOTA_DESCRIPTOR.index -> builder.globalQuota = deserializeBoolean()
                PERIOD_DESCRIPTOR.index -> builder.period = deserializeQuotaPeriodDocument(deserializer)
                QUOTAAPPLIEDATLEVEL_DESCRIPTOR.index -> builder.quotaAppliedAtLevel = deserializeString().let { AppliedLevelEnum.fromValue(it) }
                QUOTAARN_DESCRIPTOR.index -> builder.quotaArn = deserializeString()
                QUOTACODE_DESCRIPTOR.index -> builder.quotaCode = deserializeString()
                QUOTACONTEXT_DESCRIPTOR.index -> builder.quotaContext = deserializeQuotaContextInfoDocument(deserializer)
                QUOTANAME_DESCRIPTOR.index -> builder.quotaName = deserializeString()
                SERVICECODE_DESCRIPTOR.index -> builder.serviceCode = deserializeString()
                SERVICENAME_DESCRIPTOR.index -> builder.serviceName = deserializeString()
                UNIT_DESCRIPTOR.index -> builder.unit = deserializeString()
                USAGEMETRIC_DESCRIPTOR.index -> builder.usageMetric = deserializeMetricInfoDocument(deserializer)
                VALUE_DESCRIPTOR.index -> builder.value = deserializeDouble()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy