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

commonMain.aws.sdk.kotlin.services.iot.serde.ActiveViolationDocumentDeserializer.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.ActiveViolation
import aws.sdk.kotlin.services.iot.model.VerificationState
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 deserializeActiveViolationDocument(deserializer: Deserializer): ActiveViolation {
    val builder = ActiveViolation.Builder()
    val BEHAVIOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("behavior"))
    val LASTVIOLATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("lastViolationTime"))
    val LASTVIOLATIONVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("lastViolationValue"))
    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 VIOLATIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("violationId"))
    val VIOLATIONSTARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("violationStartTime"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(BEHAVIOR_DESCRIPTOR)
        field(LASTVIOLATIONTIME_DESCRIPTOR)
        field(LASTVIOLATIONVALUE_DESCRIPTOR)
        field(SECURITYPROFILENAME_DESCRIPTOR)
        field(THINGNAME_DESCRIPTOR)
        field(VERIFICATIONSTATE_DESCRIPTOR)
        field(VERIFICATIONSTATEDESCRIPTION_DESCRIPTOR)
        field(VIOLATIONEVENTADDITIONALINFO_DESCRIPTOR)
        field(VIOLATIONID_DESCRIPTOR)
        field(VIOLATIONSTARTTIME_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                BEHAVIOR_DESCRIPTOR.index -> builder.behavior = deserializeBehaviorDocument(deserializer)
                LASTVIOLATIONTIME_DESCRIPTOR.index -> builder.lastViolationTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                LASTVIOLATIONVALUE_DESCRIPTOR.index -> builder.lastViolationValue = 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)
                VIOLATIONID_DESCRIPTOR.index -> builder.violationId = deserializeString()
                VIOLATIONSTARTTIME_DESCRIPTOR.index -> builder.violationStartTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy