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

commonMain.aws.sdk.kotlin.services.cloudwatchlogs.serde.AnomalyDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.cloudwatchlogs.serde

import aws.sdk.kotlin.services.cloudwatchlogs.model.Anomaly
import aws.sdk.kotlin.services.cloudwatchlogs.model.LogEvent
import aws.sdk.kotlin.services.cloudwatchlogs.model.PatternToken
import aws.sdk.kotlin.services.cloudwatchlogs.model.State
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
import kotlin.collections.mutableMapOf

internal fun deserializeAnomalyDocument(deserializer: Deserializer): Anomaly {
    val builder = Anomaly.Builder()
    val ACTIVE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("active"))
    val ANOMALYDETECTORARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("anomalyDetectorArn"))
    val ANOMALYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("anomalyId"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
    val FIRSTSEEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("firstSeen"))
    val HISTOGRAM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("histogram"))
    val ISPATTERNLEVELSUPPRESSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("isPatternLevelSuppression"))
    val LASTSEEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("lastSeen"))
    val LOGGROUPARNLIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("logGroupArnList"))
    val LOGSAMPLES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("logSamples"))
    val PATTERNID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("patternId"))
    val PATTERNREGEX_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("patternRegex"))
    val PATTERNSTRING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("patternString"))
    val PATTERNTOKENS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("patternTokens"))
    val PRIORITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("priority"))
    val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("state"))
    val SUPPRESSED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("suppressed"))
    val SUPPRESSEDDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("suppressedDate"))
    val SUPPRESSEDUNTIL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("suppressedUntil"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACTIVE_DESCRIPTOR)
        field(ANOMALYDETECTORARN_DESCRIPTOR)
        field(ANOMALYID_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(FIRSTSEEN_DESCRIPTOR)
        field(HISTOGRAM_DESCRIPTOR)
        field(ISPATTERNLEVELSUPPRESSION_DESCRIPTOR)
        field(LASTSEEN_DESCRIPTOR)
        field(LOGGROUPARNLIST_DESCRIPTOR)
        field(LOGSAMPLES_DESCRIPTOR)
        field(PATTERNID_DESCRIPTOR)
        field(PATTERNREGEX_DESCRIPTOR)
        field(PATTERNSTRING_DESCRIPTOR)
        field(PATTERNTOKENS_DESCRIPTOR)
        field(PRIORITY_DESCRIPTOR)
        field(STATE_DESCRIPTOR)
        field(SUPPRESSED_DESCRIPTOR)
        field(SUPPRESSEDDATE_DESCRIPTOR)
        field(SUPPRESSEDUNTIL_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACTIVE_DESCRIPTOR.index -> builder.active = deserializeBoolean()
                ANOMALYDETECTORARN_DESCRIPTOR.index -> builder.anomalyDetectorArn = deserializeString()
                ANOMALYID_DESCRIPTOR.index -> builder.anomalyId = deserializeString()
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                FIRSTSEEN_DESCRIPTOR.index -> builder.firstSeen = deserializeLong()
                HISTOGRAM_DESCRIPTOR.index -> builder.histogram =
                    deserializer.deserializeMap(HISTOGRAM_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeLong() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                ISPATTERNLEVELSUPPRESSION_DESCRIPTOR.index -> builder.isPatternLevelSuppression = deserializeBoolean()
                LASTSEEN_DESCRIPTOR.index -> builder.lastSeen = deserializeLong()
                LOGGROUPARNLIST_DESCRIPTOR.index -> builder.logGroupArnList =
                    deserializer.deserializeList(LOGGROUPARNLIST_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                LOGSAMPLES_DESCRIPTOR.index -> builder.logSamples =
                    deserializer.deserializeList(LOGSAMPLES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLogEventDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                PATTERNID_DESCRIPTOR.index -> builder.patternId = deserializeString()
                PATTERNREGEX_DESCRIPTOR.index -> builder.patternRegex = deserializeString()
                PATTERNSTRING_DESCRIPTOR.index -> builder.patternString = deserializeString()
                PATTERNTOKENS_DESCRIPTOR.index -> builder.patternTokens =
                    deserializer.deserializeList(PATTERNTOKENS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializePatternTokenDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                PRIORITY_DESCRIPTOR.index -> builder.priority = deserializeString()
                STATE_DESCRIPTOR.index -> builder.state = deserializeString().let { State.fromValue(it) }
                SUPPRESSED_DESCRIPTOR.index -> builder.suppressed = deserializeBoolean()
                SUPPRESSEDDATE_DESCRIPTOR.index -> builder.suppressedDate = deserializeLong()
                SUPPRESSEDUNTIL_DESCRIPTOR.index -> builder.suppressedUntil = deserializeLong()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy