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

commonMain.aws.sdk.kotlin.services.cloudwatch.serde.MetricStreamEntryDocumentDeserializer.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.MetricStreamEntry
import aws.sdk.kotlin.services.cloudwatch.model.MetricStreamOutputFormat
import aws.smithy.kotlin.runtime.serde.getOrDeserializeErr
import aws.smithy.kotlin.runtime.serde.parse
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 deserializeMetricStreamEntryDocument(reader: XmlTagReader): MetricStreamEntry {
    val builder = MetricStreamEntry.Builder()

    loop@while (true) {
        val curr = reader.nextTag() ?: break@loop
        when (curr.tagName) {
            // Arn com.amazonaws.cloudwatch#MetricStreamEntry$Arn
            "Arn" -> builder.arn = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#AmazonResourceName`)" }
            // CreationDate com.amazonaws.cloudwatch#MetricStreamEntry$CreationDate
            "CreationDate" -> builder.creationDate = curr.tryData()
                .parseTimestamp(TimestampFormat.ISO_8601)
                .getOrDeserializeErr { "expected (timestamp: `com.amazonaws.cloudwatch#Timestamp`)" }
            // LastUpdateDate com.amazonaws.cloudwatch#MetricStreamEntry$LastUpdateDate
            "LastUpdateDate" -> builder.lastUpdateDate = curr.tryData()
                .parseTimestamp(TimestampFormat.ISO_8601)
                .getOrDeserializeErr { "expected (timestamp: `com.amazonaws.cloudwatch#Timestamp`)" }
            // Name com.amazonaws.cloudwatch#MetricStreamEntry$Name
            "Name" -> builder.name = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#MetricStreamName`)" }
            // FirehoseArn com.amazonaws.cloudwatch#MetricStreamEntry$FirehoseArn
            "FirehoseArn" -> builder.firehoseArn = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#AmazonResourceName`)" }
            // State com.amazonaws.cloudwatch#MetricStreamEntry$State
            "State" -> builder.state = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#MetricStreamState`)" }
            // OutputFormat com.amazonaws.cloudwatch#MetricStreamEntry$OutputFormat
            "OutputFormat" -> builder.outputFormat = curr.tryData()
                .parse { MetricStreamOutputFormat.fromValue(it) }
                .getOrDeserializeErr { "expected (enum: `com.amazonaws.cloudwatch#MetricStreamOutputFormat`)" }
            else -> {}
        }
        curr.drop()
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy