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

commonMain.aws.sdk.kotlin.services.iot.serde.BehaviorCriteriaDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.iot.serde

import aws.sdk.kotlin.services.iot.model.BehaviorCriteria
import aws.sdk.kotlin.services.iot.model.ComparisonOperator
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 deserializeBehaviorCriteriaDocument(deserializer: Deserializer): BehaviorCriteria {
    val builder = BehaviorCriteria.Builder()
    val COMPARISONOPERATOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("comparisonOperator"))
    val CONSECUTIVEDATAPOINTSTOALARM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("consecutiveDatapointsToAlarm"))
    val CONSECUTIVEDATAPOINTSTOCLEAR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("consecutiveDatapointsToClear"))
    val DURATIONSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("durationSeconds"))
    val MLDETECTIONCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("mlDetectionConfig"))
    val STATISTICALTHRESHOLD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("statisticalThreshold"))
    val VALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("value"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(COMPARISONOPERATOR_DESCRIPTOR)
        field(CONSECUTIVEDATAPOINTSTOALARM_DESCRIPTOR)
        field(CONSECUTIVEDATAPOINTSTOCLEAR_DESCRIPTOR)
        field(DURATIONSECONDS_DESCRIPTOR)
        field(MLDETECTIONCONFIG_DESCRIPTOR)
        field(STATISTICALTHRESHOLD_DESCRIPTOR)
        field(VALUE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                COMPARISONOPERATOR_DESCRIPTOR.index -> builder.comparisonOperator = deserializeString().let { ComparisonOperator.fromValue(it) }
                CONSECUTIVEDATAPOINTSTOALARM_DESCRIPTOR.index -> builder.consecutiveDatapointsToAlarm = deserializeInt()
                CONSECUTIVEDATAPOINTSTOCLEAR_DESCRIPTOR.index -> builder.consecutiveDatapointsToClear = deserializeInt()
                DURATIONSECONDS_DESCRIPTOR.index -> builder.durationSeconds = deserializeInt()
                MLDETECTIONCONFIG_DESCRIPTOR.index -> builder.mlDetectionConfig = deserializeMachineLearningDetectionConfigDocument(deserializer)
                STATISTICALTHRESHOLD_DESCRIPTOR.index -> builder.statisticalThreshold = deserializeStatisticalThresholdDocument(deserializer)
                VALUE_DESCRIPTOR.index -> builder.value = deserializeMetricValueDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy