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

commonMain.aws.sdk.kotlin.services.xray.serde.InsightDocumentDeserializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.xray.serde

import aws.sdk.kotlin.services.xray.model.AnomalousService
import aws.sdk.kotlin.services.xray.model.Insight
import aws.sdk.kotlin.services.xray.model.InsightCategory
import aws.sdk.kotlin.services.xray.model.InsightState
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 aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf

internal fun deserializeInsightDocument(deserializer: Deserializer): Insight {
    val builder = Insight.Builder()
    val CATEGORIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Categories"))
    val CLIENTREQUESTIMPACTSTATISTICS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ClientRequestImpactStatistics"))
    val ENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("EndTime"))
    val GROUPARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GroupARN"))
    val GROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GroupName"))
    val INSIGHTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("InsightId"))
    val ROOTCAUSESERVICEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("RootCauseServiceId"))
    val ROOTCAUSESERVICEREQUESTIMPACTSTATISTICS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("RootCauseServiceRequestImpactStatistics"))
    val STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StartTime"))
    val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("State"))
    val SUMMARY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Summary"))
    val TOPANOMALOUSSERVICES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("TopAnomalousServices"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CATEGORIES_DESCRIPTOR)
        field(CLIENTREQUESTIMPACTSTATISTICS_DESCRIPTOR)
        field(ENDTIME_DESCRIPTOR)
        field(GROUPARN_DESCRIPTOR)
        field(GROUPNAME_DESCRIPTOR)
        field(INSIGHTID_DESCRIPTOR)
        field(ROOTCAUSESERVICEID_DESCRIPTOR)
        field(ROOTCAUSESERVICEREQUESTIMPACTSTATISTICS_DESCRIPTOR)
        field(STARTTIME_DESCRIPTOR)
        field(STATE_DESCRIPTOR)
        field(SUMMARY_DESCRIPTOR)
        field(TOPANOMALOUSSERVICES_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CATEGORIES_DESCRIPTOR.index -> builder.categories =
                    deserializer.deserializeList(CATEGORIES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { InsightCategory.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                CLIENTREQUESTIMPACTSTATISTICS_DESCRIPTOR.index -> builder.clientRequestImpactStatistics = deserializeRequestImpactStatisticsDocument(deserializer)
                ENDTIME_DESCRIPTOR.index -> builder.endTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                GROUPARN_DESCRIPTOR.index -> builder.groupArn = deserializeString()
                GROUPNAME_DESCRIPTOR.index -> builder.groupName = deserializeString()
                INSIGHTID_DESCRIPTOR.index -> builder.insightId = deserializeString()
                ROOTCAUSESERVICEID_DESCRIPTOR.index -> builder.rootCauseServiceId = deserializeServiceIdDocument(deserializer)
                ROOTCAUSESERVICEREQUESTIMPACTSTATISTICS_DESCRIPTOR.index -> builder.rootCauseServiceRequestImpactStatistics = deserializeRequestImpactStatisticsDocument(deserializer)
                STARTTIME_DESCRIPTOR.index -> builder.startTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                STATE_DESCRIPTOR.index -> builder.state = deserializeString().let { InsightState.fromValue(it) }
                SUMMARY_DESCRIPTOR.index -> builder.summary = deserializeString()
                TOPANOMALOUSSERVICES_DESCRIPTOR.index -> builder.topAnomalousServices =
                    deserializer.deserializeList(TOPANOMALOUSSERVICES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeAnomalousServiceDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy