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

commonMain.aws.sdk.kotlin.services.devopsguru.serde.ReactiveAnomalyDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.79
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.devopsguru.serde

import aws.sdk.kotlin.services.devopsguru.model.AnomalyResource
import aws.sdk.kotlin.services.devopsguru.model.AnomalySeverity
import aws.sdk.kotlin.services.devopsguru.model.AnomalyStatus
import aws.sdk.kotlin.services.devopsguru.model.AnomalyType
import aws.sdk.kotlin.services.devopsguru.model.ReactiveAnomaly
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 kotlin.collections.mutableListOf

internal fun deserializeReactiveAnomalyDocument(deserializer: Deserializer): ReactiveAnomaly {
    val builder = ReactiveAnomaly.Builder()
    val ANOMALYREPORTEDTIMERANGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("AnomalyReportedTimeRange"))
    val ANOMALYRESOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AnomalyResources"))
    val ANOMALYTIMERANGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("AnomalyTimeRange"))
    val ASSOCIATEDINSIGHTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AssociatedInsightId"))
    val CAUSALANOMALYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CausalAnomalyId"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Id"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val RESOURCECOLLECTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ResourceCollection"))
    val SEVERITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Severity"))
    val SOURCEDETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("SourceDetails"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
    val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Type"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ANOMALYREPORTEDTIMERANGE_DESCRIPTOR)
        field(ANOMALYRESOURCES_DESCRIPTOR)
        field(ANOMALYTIMERANGE_DESCRIPTOR)
        field(ASSOCIATEDINSIGHTID_DESCRIPTOR)
        field(CAUSALANOMALYID_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(ID_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(RESOURCECOLLECTION_DESCRIPTOR)
        field(SEVERITY_DESCRIPTOR)
        field(SOURCEDETAILS_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(TYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ANOMALYREPORTEDTIMERANGE_DESCRIPTOR.index -> builder.anomalyReportedTimeRange = deserializeAnomalyReportedTimeRangeDocument(deserializer)
                ANOMALYRESOURCES_DESCRIPTOR.index -> builder.anomalyResources =
                    deserializer.deserializeList(ANOMALYRESOURCES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeAnomalyResourceDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ANOMALYTIMERANGE_DESCRIPTOR.index -> builder.anomalyTimeRange = deserializeAnomalyTimeRangeDocument(deserializer)
                ASSOCIATEDINSIGHTID_DESCRIPTOR.index -> builder.associatedInsightId = deserializeString()
                CAUSALANOMALYID_DESCRIPTOR.index -> builder.causalAnomalyId = deserializeString()
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                ID_DESCRIPTOR.index -> builder.id = deserializeString()
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                RESOURCECOLLECTION_DESCRIPTOR.index -> builder.resourceCollection = deserializeResourceCollectionDocument(deserializer)
                SEVERITY_DESCRIPTOR.index -> builder.severity = deserializeString().let { AnomalySeverity.fromValue(it) }
                SOURCEDETAILS_DESCRIPTOR.index -> builder.sourceDetails = deserializeAnomalySourceDetailsDocument(deserializer)
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { AnomalyStatus.fromValue(it) }
                TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { AnomalyType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy