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

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

There is a newer version: 1.3.35
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.MetricDatum
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.Serializer
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.formurl.FormUrlSerialName
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.TimestampFormat

internal fun serializeMetricDatumDocument(serializer: Serializer, input: MetricDatum) {
    val COUNTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("Counts"))
    val DIMENSIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("Dimensions"))
    val METRICNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("MetricName"))
    val STATISTICVALUES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("StatisticValues"))
    val STORAGERESOLUTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("StorageResolution"))
    val TIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, FormUrlSerialName("Timestamp"))
    val UNIT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, FormUrlSerialName("Unit"))
    val VALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, FormUrlSerialName("Value"))
    val VALUES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("Values"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        trait(FormUrlSerialName("MetricDatum"))
        field(COUNTS_DESCRIPTOR)
        field(DIMENSIONS_DESCRIPTOR)
        field(METRICNAME_DESCRIPTOR)
        field(STATISTICVALUES_DESCRIPTOR)
        field(STORAGERESOLUTION_DESCRIPTOR)
        field(TIMESTAMP_DESCRIPTOR)
        field(UNIT_DESCRIPTOR)
        field(VALUE_DESCRIPTOR)
        field(VALUES_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.metricName?.let { field(METRICNAME_DESCRIPTOR, it) }
        if (input.dimensions != null) {
            listField(DIMENSIONS_DESCRIPTOR) {
                for (el0 in input.dimensions) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeDimensionDocument))
                }
            }
        }
        input.timestamp?.let { field(TIMESTAMP_DESCRIPTOR, it, TimestampFormat.ISO_8601) }
        input.value?.let { field(VALUE_DESCRIPTOR, it) }
        input.statisticValues?.let { field(STATISTICVALUES_DESCRIPTOR, it, ::serializeStatisticSetDocument) }
        if (input.values != null) {
            listField(VALUES_DESCRIPTOR) {
                for (el0 in input.values) {
                    serializeDouble(el0)
                }
            }
        }
        if (input.counts != null) {
            listField(COUNTS_DESCRIPTOR) {
                for (el0 in input.counts) {
                    serializeDouble(el0)
                }
            }
        }
        input.unit?.let { field(UNIT_DESCRIPTOR, it.value) }
        input.storageResolution?.let { field(STORAGERESOLUTION_DESCRIPTOR, it) }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy