commonMain.aws.sdk.kotlin.services.cloudwatch.serde.AnomalyDetectorDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudwatch-jvm Show documentation
Show all versions of cloudwatch-jvm Show documentation
The AWS SDK for Kotlin client for CloudWatch
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.cloudwatch.serde
import aws.sdk.kotlin.services.cloudwatch.model.AnomalyDetector
import aws.sdk.kotlin.services.cloudwatch.model.AnomalyDetectorStateValue
import aws.smithy.kotlin.runtime.serde.getOrDeserializeErr
import aws.smithy.kotlin.runtime.serde.parse
import aws.smithy.kotlin.runtime.serde.xml.XmlTagReader
import aws.smithy.kotlin.runtime.serde.xml.tryData
internal fun deserializeAnomalyDetectorDocument(reader: XmlTagReader): AnomalyDetector {
val builder = AnomalyDetector.Builder()
loop@while (true) {
val curr = reader.nextTag() ?: break@loop
when (curr.tagName) {
// Namespace com.amazonaws.cloudwatch#AnomalyDetector$Namespace
"Namespace" -> builder.namespace = curr.tryData()
.getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#Namespace`)" }
// MetricName com.amazonaws.cloudwatch#AnomalyDetector$MetricName
"MetricName" -> builder.metricName = curr.tryData()
.getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#MetricName`)" }
// Dimensions com.amazonaws.cloudwatch#AnomalyDetector$Dimensions
"Dimensions" -> builder.dimensions = deserializeDimensionsShape(curr)
// Stat com.amazonaws.cloudwatch#AnomalyDetector$Stat
"Stat" -> builder.stat = curr.tryData()
.getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#AnomalyDetectorMetricStat`)" }
// Configuration com.amazonaws.cloudwatch#AnomalyDetector$Configuration
"Configuration" -> builder.configuration = deserializeAnomalyDetectorConfigurationDocument(curr)
// StateValue com.amazonaws.cloudwatch#AnomalyDetector$StateValue
"StateValue" -> builder.stateValue = curr.tryData()
.parse { AnomalyDetectorStateValue.fromValue(it) }
.getOrDeserializeErr { "expected (enum: `com.amazonaws.cloudwatch#AnomalyDetectorStateValue`)" }
// MetricCharacteristics com.amazonaws.cloudwatch#AnomalyDetector$MetricCharacteristics
"MetricCharacteristics" -> builder.metricCharacteristics = deserializeMetricCharacteristicsDocument(curr)
// SingleMetricAnomalyDetector com.amazonaws.cloudwatch#AnomalyDetector$SingleMetricAnomalyDetector
"SingleMetricAnomalyDetector" -> builder.singleMetricAnomalyDetector = deserializeSingleMetricAnomalyDetectorDocument(curr)
// MetricMathAnomalyDetector com.amazonaws.cloudwatch#AnomalyDetector$MetricMathAnomalyDetector
"MetricMathAnomalyDetector" -> builder.metricMathAnomalyDetector = deserializeMetricMathAnomalyDetectorDocument(curr)
else -> {}
}
curr.drop()
}
builder.correctErrors()
return builder.build()
}