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

commonMain.aws.sdk.kotlin.services.iot.serde.ViolationEventDocumentDeserializer.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.VerificationState
import aws.sdk.kotlin.services.iot.model.ViolationEvent
import aws.sdk.kotlin.services.iot.model.ViolationEventType
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 aws.smithy.kotlin.runtime.time.Instant

internal fun deserializeViolationEventDocument(deserializer: Deserializer): ViolationEvent {
    val builder = ViolationEvent.Builder()
    val BEHAVIOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("behavior"))
    val METRICVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("metricValue"))
    val SECURITYPROFILENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("securityProfileName"))
    val THINGNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("thingName"))
    val VERIFICATIONSTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("verificationState"))
    val VERIFICATIONSTATEDESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("verificationStateDescription"))
    val VIOLATIONEVENTADDITIONALINFO_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("violationEventAdditionalInfo"))
    val VIOLATIONEVENTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("violationEventTime"))
    val VIOLATIONEVENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("violationEventType"))
    val VIOLATIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("violationId"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(BEHAVIOR_DESCRIPTOR)
        field(METRICVALUE_DESCRIPTOR)
        field(SECURITYPROFILENAME_DESCRIPTOR)
        field(THINGNAME_DESCRIPTOR)
        field(VERIFICATIONSTATE_DESCRIPTOR)
        field(VERIFICATIONSTATEDESCRIPTION_DESCRIPTOR)
        field(VIOLATIONEVENTADDITIONALINFO_DESCRIPTOR)
        field(VIOLATIONEVENTTIME_DESCRIPTOR)
        field(VIOLATIONEVENTTYPE_DESCRIPTOR)
        field(VIOLATIONID_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                BEHAVIOR_DESCRIPTOR.index -> builder.behavior = deserializeBehaviorDocument(deserializer)
                METRICVALUE_DESCRIPTOR.index -> builder.metricValue = deserializeMetricValueDocument(deserializer)
                SECURITYPROFILENAME_DESCRIPTOR.index -> builder.securityProfileName = deserializeString()
                THINGNAME_DESCRIPTOR.index -> builder.thingName = deserializeString()
                VERIFICATIONSTATE_DESCRIPTOR.index -> builder.verificationState = deserializeString().let { VerificationState.fromValue(it) }
                VERIFICATIONSTATEDESCRIPTION_DESCRIPTOR.index -> builder.verificationStateDescription = deserializeString()
                VIOLATIONEVENTADDITIONALINFO_DESCRIPTOR.index -> builder.violationEventAdditionalInfo = deserializeViolationEventAdditionalInfoDocument(deserializer)
                VIOLATIONEVENTTIME_DESCRIPTOR.index -> builder.violationEventTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                VIOLATIONEVENTTYPE_DESCRIPTOR.index -> builder.violationEventType = deserializeString().let { ViolationEventType.fromValue(it) }
                VIOLATIONID_DESCRIPTOR.index -> builder.violationId = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy