commonMain.aws.sdk.kotlin.services.cloudwatch.serde.AlarmHistoryItemDocumentDeserializer.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.AlarmHistoryItem
import aws.sdk.kotlin.services.cloudwatch.model.AlarmType
import aws.sdk.kotlin.services.cloudwatch.model.HistoryItemType
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 deserializeAlarmHistoryItemDocument(reader: XmlTagReader): AlarmHistoryItem {
val builder = AlarmHistoryItem.Builder()
loop@while (true) {
val curr = reader.nextTag() ?: break@loop
when (curr.tagName) {
// AlarmName com.amazonaws.cloudwatch#AlarmHistoryItem$AlarmName
"AlarmName" -> builder.alarmName = curr.tryData()
.getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#AlarmName`)" }
// AlarmType com.amazonaws.cloudwatch#AlarmHistoryItem$AlarmType
"AlarmType" -> builder.alarmType = curr.tryData()
.parse { AlarmType.fromValue(it) }
.getOrDeserializeErr { "expected (enum: `com.amazonaws.cloudwatch#AlarmType`)" }
// Timestamp com.amazonaws.cloudwatch#AlarmHistoryItem$Timestamp
"Timestamp" -> builder.timestamp = curr.tryData()
.parseTimestamp(TimestampFormat.ISO_8601)
.getOrDeserializeErr { "expected (timestamp: `com.amazonaws.cloudwatch#Timestamp`)" }
// HistoryItemType com.amazonaws.cloudwatch#AlarmHistoryItem$HistoryItemType
"HistoryItemType" -> builder.historyItemType = curr.tryData()
.parse { HistoryItemType.fromValue(it) }
.getOrDeserializeErr { "expected (enum: `com.amazonaws.cloudwatch#HistoryItemType`)" }
// HistorySummary com.amazonaws.cloudwatch#AlarmHistoryItem$HistorySummary
"HistorySummary" -> builder.historySummary = curr.tryData()
.getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#HistorySummary`)" }
// HistoryData com.amazonaws.cloudwatch#AlarmHistoryItem$HistoryData
"HistoryData" -> builder.historyData = curr.tryData()
.getOrDeserializeErr { "expected (string: `com.amazonaws.cloudwatch#HistoryData`)" }
else -> {}
}
curr.drop()
}
builder.correctErrors()
return builder.build()
}