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

commonMain.aws.sdk.kotlin.services.cloudwatch.serde.InsightRuleMetricDatapointDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.cloudwatch.serde

import aws.sdk.kotlin.services.cloudwatch.model.InsightRuleMetricDatapoint
import aws.smithy.kotlin.runtime.serde.getOrDeserializeErr
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 deserializeInsightRuleMetricDatapointDocument(reader: XmlTagReader): InsightRuleMetricDatapoint {
    val builder = InsightRuleMetricDatapoint.Builder()

    loop@while (true) {
        val curr = reader.nextTag() ?: break@loop
        when (curr.tagName) {
            // Timestamp com.amazonaws.cloudwatch#InsightRuleMetricDatapoint$Timestamp
            "Timestamp" -> builder.timestamp = curr.tryData()
                .parseTimestamp(TimestampFormat.ISO_8601)
                .getOrDeserializeErr { "expected (timestamp: `com.amazonaws.cloudwatch#Timestamp`)" }
            // UniqueContributors com.amazonaws.cloudwatch#InsightRuleMetricDatapoint$UniqueContributors
            "UniqueContributors" -> builder.uniqueContributors = curr.tryData()
                .parseDouble()
                .getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#InsightRuleUnboundDouble`)" }
            // MaxContributorValue com.amazonaws.cloudwatch#InsightRuleMetricDatapoint$MaxContributorValue
            "MaxContributorValue" -> builder.maxContributorValue = curr.tryData()
                .parseDouble()
                .getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#InsightRuleUnboundDouble`)" }
            // SampleCount com.amazonaws.cloudwatch#InsightRuleMetricDatapoint$SampleCount
            "SampleCount" -> builder.sampleCount = curr.tryData()
                .parseDouble()
                .getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#InsightRuleUnboundDouble`)" }
            // Average com.amazonaws.cloudwatch#InsightRuleMetricDatapoint$Average
            "Average" -> builder.average = curr.tryData()
                .parseDouble()
                .getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#InsightRuleUnboundDouble`)" }
            // Sum com.amazonaws.cloudwatch#InsightRuleMetricDatapoint$Sum
            "Sum" -> builder.sum = curr.tryData()
                .parseDouble()
                .getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#InsightRuleUnboundDouble`)" }
            // Minimum com.amazonaws.cloudwatch#InsightRuleMetricDatapoint$Minimum
            "Minimum" -> builder.minimum = curr.tryData()
                .parseDouble()
                .getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#InsightRuleUnboundDouble`)" }
            // Maximum com.amazonaws.cloudwatch#InsightRuleMetricDatapoint$Maximum
            "Maximum" -> builder.maximum = curr.tryData()
                .parseDouble()
                .getOrDeserializeErr { "expected (double: `com.amazonaws.cloudwatch#InsightRuleUnboundDouble`)" }
            else -> {}
        }
        curr.drop()
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy