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

commonMain.aws.sdk.kotlin.services.cloudwatchlogs.serde.MetricTransformationDocumentSerializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.cloudwatchlogs.serde

import aws.sdk.kotlin.services.cloudwatchlogs.model.MetricTransformation
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.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

internal fun serializeMetricTransformationDocument(serializer: Serializer, input: MetricTransformation) {
    val DEFAULTVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("defaultValue"))
    val DIMENSIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("dimensions"))
    val METRICNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("metricName"))
    val METRICNAMESPACE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("metricNamespace"))
    val METRICVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("metricValue"))
    val UNIT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("unit"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DEFAULTVALUE_DESCRIPTOR)
        field(DIMENSIONS_DESCRIPTOR)
        field(METRICNAME_DESCRIPTOR)
        field(METRICNAMESPACE_DESCRIPTOR)
        field(METRICVALUE_DESCRIPTOR)
        field(UNIT_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        field(METRICNAME_DESCRIPTOR, input.metricName)
        field(METRICNAMESPACE_DESCRIPTOR, input.metricNamespace)
        field(METRICVALUE_DESCRIPTOR, input.metricValue)
        input.defaultValue?.let { field(DEFAULTVALUE_DESCRIPTOR, it) }
        if (input.dimensions != null) {
            mapField(DIMENSIONS_DESCRIPTOR) {
                input.dimensions.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.unit?.let { field(UNIT_DESCRIPTOR, it.value) }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy