commonMain.aws.sdk.kotlin.services.autoscaling.serde.MetricDocumentDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.autoscaling.serde
import aws.sdk.kotlin.services.autoscaling.model.Metric
import aws.sdk.kotlin.services.autoscaling.model.MetricDimension
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
import aws.smithy.kotlin.runtime.serde.xml.XmlDeserializer
import aws.smithy.kotlin.runtime.serde.xml.XmlNamespace
import aws.smithy.kotlin.runtime.serde.xml.XmlSerialName
import kotlin.collections.mutableListOf
internal fun deserializeMetricDocument(deserializer: Deserializer): Metric {
val builder = Metric.Builder()
val DIMENSIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, XmlSerialName("Dimensions"))
val METRICNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("MetricName"))
val NAMESPACE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("Namespace"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
trait(XmlSerialName("Metric"))
trait(XmlNamespace("http://autoscaling.amazonaws.com/doc/2011-01-01/"))
field(DIMENSIONS_DESCRIPTOR)
field(METRICNAME_DESCRIPTOR)
field(NAMESPACE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
DIMENSIONS_DESCRIPTOR.index -> builder.dimensions =
deserializer.deserializeList(DIMENSIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeMetricDimensionDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
METRICNAME_DESCRIPTOR.index -> builder.metricName = deserializeString()
NAMESPACE_DESCRIPTOR.index -> builder.namespace = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy