commonMain.aws.sdk.kotlin.services.iotwireless.serde.SummaryMetricQueryResultDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iotwireless-jvm Show documentation
Show all versions of iotwireless-jvm Show documentation
The AWS Kotlin client for IoT Wireless
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.iotwireless.serde
import aws.sdk.kotlin.services.iotwireless.model.AggregationPeriod
import aws.sdk.kotlin.services.iotwireless.model.Dimension
import aws.sdk.kotlin.services.iotwireless.model.MetricName
import aws.sdk.kotlin.services.iotwireless.model.MetricQueryStatus
import aws.sdk.kotlin.services.iotwireless.model.MetricQueryValue
import aws.sdk.kotlin.services.iotwireless.model.SummaryMetricQueryResult
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.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
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.time.Instant
import aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf
internal fun deserializeSummaryMetricQueryResultDocument(deserializer: Deserializer): SummaryMetricQueryResult {
val builder = SummaryMetricQueryResult.Builder()
val AGGREGATIONPERIOD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("AggregationPeriod"))
val DIMENSIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Dimensions"))
val ENDTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("EndTimestamp"))
val ERROR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Error"))
val METRICNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("MetricName"))
val QUERYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("QueryId"))
val QUERYSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("QueryStatus"))
val STARTTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StartTimestamp"))
val TIMESTAMPS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Timestamps"))
val UNIT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Unit"))
val VALUES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Values"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AGGREGATIONPERIOD_DESCRIPTOR)
field(DIMENSIONS_DESCRIPTOR)
field(ENDTIMESTAMP_DESCRIPTOR)
field(ERROR_DESCRIPTOR)
field(METRICNAME_DESCRIPTOR)
field(QUERYID_DESCRIPTOR)
field(QUERYSTATUS_DESCRIPTOR)
field(STARTTIMESTAMP_DESCRIPTOR)
field(TIMESTAMPS_DESCRIPTOR)
field(UNIT_DESCRIPTOR)
field(VALUES_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
AGGREGATIONPERIOD_DESCRIPTOR.index -> builder.aggregationPeriod = deserializeString().let { AggregationPeriod.fromValue(it) }
DIMENSIONS_DESCRIPTOR.index -> builder.dimensions =
deserializer.deserializeList(DIMENSIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeDimensionDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
ENDTIMESTAMP_DESCRIPTOR.index -> builder.endTimestamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
ERROR_DESCRIPTOR.index -> builder.error = deserializeString()
METRICNAME_DESCRIPTOR.index -> builder.metricName = deserializeString().let { MetricName.fromValue(it) }
QUERYID_DESCRIPTOR.index -> builder.queryId = deserializeString()
QUERYSTATUS_DESCRIPTOR.index -> builder.queryStatus = deserializeString().let { MetricQueryStatus.fromValue(it) }
STARTTIMESTAMP_DESCRIPTOR.index -> builder.startTimestamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
TIMESTAMPS_DESCRIPTOR.index -> builder.timestamps =
deserializer.deserializeList(TIMESTAMPS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeInstant(TimestampFormat.EPOCH_SECONDS) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
UNIT_DESCRIPTOR.index -> builder.unit = deserializeString()
VALUES_DESCRIPTOR.index -> builder.values =
deserializer.deserializeList(VALUES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeMetricQueryValueDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy