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

commonMain.aws.sdk.kotlin.services.iot.serde.DetectMitigationActionsTaskSummaryDocumentDeserializer.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.DetectMitigationActionsTaskStatus
import aws.sdk.kotlin.services.iot.model.DetectMitigationActionsTaskSummary
import aws.sdk.kotlin.services.iot.model.MitigationAction
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
import kotlin.collections.mutableListOf

internal fun deserializeDetectMitigationActionsTaskSummaryDocument(deserializer: Deserializer): DetectMitigationActionsTaskSummary {
    val builder = DetectMitigationActionsTaskSummary.Builder()
    val ACTIONSDEFINITION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("actionsDefinition"))
    val ONLYACTIVEVIOLATIONSINCLUDED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("onlyActiveViolationsIncluded"))
    val SUPPRESSEDALERTSINCLUDED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("suppressedAlertsIncluded"))
    val TARGET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("target"))
    val TASKENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("taskEndTime"))
    val TASKID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("taskId"))
    val TASKSTARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("taskStartTime"))
    val TASKSTATISTICS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("taskStatistics"))
    val TASKSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("taskStatus"))
    val VIOLATIONEVENTOCCURRENCERANGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("violationEventOccurrenceRange"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACTIONSDEFINITION_DESCRIPTOR)
        field(ONLYACTIVEVIOLATIONSINCLUDED_DESCRIPTOR)
        field(SUPPRESSEDALERTSINCLUDED_DESCRIPTOR)
        field(TARGET_DESCRIPTOR)
        field(TASKENDTIME_DESCRIPTOR)
        field(TASKID_DESCRIPTOR)
        field(TASKSTARTTIME_DESCRIPTOR)
        field(TASKSTATISTICS_DESCRIPTOR)
        field(TASKSTATUS_DESCRIPTOR)
        field(VIOLATIONEVENTOCCURRENCERANGE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACTIONSDEFINITION_DESCRIPTOR.index -> builder.actionsDefinition =
                    deserializer.deserializeList(ACTIONSDEFINITION_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeMitigationActionDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ONLYACTIVEVIOLATIONSINCLUDED_DESCRIPTOR.index -> builder.onlyActiveViolationsIncluded = deserializeBoolean()
                SUPPRESSEDALERTSINCLUDED_DESCRIPTOR.index -> builder.suppressedAlertsIncluded = deserializeBoolean()
                TARGET_DESCRIPTOR.index -> builder.target = deserializeDetectMitigationActionsTaskTargetDocument(deserializer)
                TASKENDTIME_DESCRIPTOR.index -> builder.taskEndTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                TASKID_DESCRIPTOR.index -> builder.taskId = deserializeString()
                TASKSTARTTIME_DESCRIPTOR.index -> builder.taskStartTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                TASKSTATISTICS_DESCRIPTOR.index -> builder.taskStatistics = deserializeDetectMitigationActionsTaskStatisticsDocument(deserializer)
                TASKSTATUS_DESCRIPTOR.index -> builder.taskStatus = deserializeString().let { DetectMitigationActionsTaskStatus.fromValue(it) }
                VIOLATIONEVENTOCCURRENCERANGE_DESCRIPTOR.index -> builder.violationEventOccurrenceRange = deserializeViolationEventOccurrenceRangeDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy