commonMain.aws.sdk.kotlin.services.devopsguru.serde.ProactiveAnomalyDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devopsguru-jvm Show documentation
Show all versions of devopsguru-jvm Show documentation
The AWS SDK for Kotlin client for DevOps Guru
// 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.ProactiveAnomaly
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 deserializeProactiveAnomalyDocument(deserializer: Deserializer): ProactiveAnomaly {
val builder = ProactiveAnomaly.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 DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Id"))
val LIMIT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("Limit"))
val PREDICTIONTIMERANGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("PredictionTimeRange"))
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 SOURCEMETADATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("SourceMetadata"))
val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
val UPDATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("UpdateTime"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ANOMALYREPORTEDTIMERANGE_DESCRIPTOR)
field(ANOMALYRESOURCES_DESCRIPTOR)
field(ANOMALYTIMERANGE_DESCRIPTOR)
field(ASSOCIATEDINSIGHTID_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(ID_DESCRIPTOR)
field(LIMIT_DESCRIPTOR)
field(PREDICTIONTIMERANGE_DESCRIPTOR)
field(RESOURCECOLLECTION_DESCRIPTOR)
field(SEVERITY_DESCRIPTOR)
field(SOURCEDETAILS_DESCRIPTOR)
field(SOURCEMETADATA_DESCRIPTOR)
field(STATUS_DESCRIPTOR)
field(UPDATETIME_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()
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
ID_DESCRIPTOR.index -> builder.id = deserializeString()
LIMIT_DESCRIPTOR.index -> builder.limit = deserializeDouble()
PREDICTIONTIMERANGE_DESCRIPTOR.index -> builder.predictionTimeRange = deserializePredictionTimeRangeDocument(deserializer)
RESOURCECOLLECTION_DESCRIPTOR.index -> builder.resourceCollection = deserializeResourceCollectionDocument(deserializer)
SEVERITY_DESCRIPTOR.index -> builder.severity = deserializeString().let { AnomalySeverity.fromValue(it) }
SOURCEDETAILS_DESCRIPTOR.index -> builder.sourceDetails = deserializeAnomalySourceDetailsDocument(deserializer)
SOURCEMETADATA_DESCRIPTOR.index -> builder.sourceMetadata = deserializeAnomalySourceMetadataDocument(deserializer)
STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { AnomalyStatus.fromValue(it) }
UPDATETIME_DESCRIPTOR.index -> builder.updateTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}