commonMain.aws.sdk.kotlin.services.cloudwatch.serde.DatapointDocumentDeserializer.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.Datapoint
import aws.sdk.kotlin.services.cloudwatch.model.StandardUnit
import aws.smithy.kotlin.runtime.serde.getOrDeserializeErr
import aws.smithy.kotlin.runtime.serde.parse
import aws.smithy.kotlin.runtime.serde.parseDouble
import aws.smithy.kotlin.runtime.serde.parseTimestamp
import aws.smithy.kotlin.runtime.serde.xml.XmlTagReader
import aws.smithy.kotlin.runtime.serde.xml.tryData
import aws.smithy.kotlin.runtime.time.TimestampFormat
internal fun deserializeDatapointDocument(reader: XmlTagReader): Datapoint {
val builder = Datapoint.Builder()
loop@while (true) {
val curr = reader.nextTag() ?: break@loop
when (curr.tagName) {
// Timestamp com.amazonaws.cloudwatch#Datapoint$Timestamp
"Timestamp" -> builder.timestamp = curr.tryData()
.parseTimestamp(TimestampFormat.ISO_8601)
.getOrDeserializeErr { "expected (timestamp: `com.amazonaws.cloudwatch#Timestamp`)" }
// SampleCount com.amazonaws.cloudwatch#Datapoint$SampleCount
"SampleCount" -> builder.sampleCount = curr.tryData()
.parseDouble()
.getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#DatapointValue`)" }
// Average com.amazonaws.cloudwatch#Datapoint$Average
"Average" -> builder.average = curr.tryData()
.parseDouble()
.getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#DatapointValue`)" }
// Sum com.amazonaws.cloudwatch#Datapoint$Sum
"Sum" -> builder.sum = curr.tryData()
.parseDouble()
.getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#DatapointValue`)" }
// Minimum com.amazonaws.cloudwatch#Datapoint$Minimum
"Minimum" -> builder.minimum = curr.tryData()
.parseDouble()
.getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#DatapointValue`)" }
// Maximum com.amazonaws.cloudwatch#Datapoint$Maximum
"Maximum" -> builder.maximum = curr.tryData()
.parseDouble()
.getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#DatapointValue`)" }
// Unit com.amazonaws.cloudwatch#Datapoint$Unit
"Unit" -> builder.unit = curr.tryData()
.parse { StandardUnit.fromValue(it) }
.getOrDeserializeErr { "expected (enum: `com.amazonaws.cloudwatch#StandardUnit`)" }
// ExtendedStatistics com.amazonaws.cloudwatch#Datapoint$ExtendedStatistics
"ExtendedStatistics" -> builder.extendedStatistics = deserializeDatapointValueMapShape(curr)
else -> {}
}
curr.drop()
}
builder.correctErrors()
return builder.build()
}