commonMain.aws.sdk.kotlin.services.cloudwatch.serde.DatapointValueMapShapeDeserializer.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.smithy.kotlin.runtime.serde.DeserializationException
import aws.smithy.kotlin.runtime.serde.getOrDeserializeErr
import aws.smithy.kotlin.runtime.serde.parseDouble
import aws.smithy.kotlin.runtime.serde.xml.XmlTagReader
import aws.smithy.kotlin.runtime.serde.xml.tryData
import kotlin.collections.MutableMap
internal fun deserializeDatapointValueMapShape(reader: XmlTagReader): Map {
val result = mutableMapOf()
loop@while (true) {
val curr = reader.nextTag() ?: break@loop
when (curr.tagName) {
"entry" -> {
deserializeDatapointValueMapEntry(result, curr)
}
else -> {}
}
curr.drop()
}
return result
}
internal fun deserializeDatapointValueMapEntry(dest: MutableMap, reader: XmlTagReader) {
var key: String? = null
var value: Double? = null
loop@while (true) {
val curr = reader.nextTag() ?: break@loop
when (curr.tagName) {
"key" -> key = curr.tryData()
.getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#ExtendedStatistic`)" }
"value" -> value = curr.tryData()
.parseDouble()
.getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#DatapointValue`)" }
else -> {}
}
curr.drop()
}
if (key == null) throw DeserializationException("missing key map entry")
if (value == null) throw DeserializationException("missing value map entry")
dest[key] = value
}