commonMain.aws.sdk.kotlin.services.lookoutmetrics.serde.CreateMetricSetOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lookoutmetrics-jvm Show documentation
Show all versions of lookoutmetrics-jvm Show documentation
The AWS SDK for Kotlin client for LookoutMetrics
The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.lookoutmetrics.serde
import aws.sdk.kotlin.services.lookoutmetrics.model.CreateMetricSetRequest
import aws.sdk.kotlin.services.lookoutmetrics.model.Frequency
import aws.sdk.kotlin.services.lookoutmetrics.model.Metric
import aws.sdk.kotlin.services.lookoutmetrics.model.MetricSetDimensionFilter
import aws.sdk.kotlin.services.lookoutmetrics.model.MetricSource
import aws.sdk.kotlin.services.lookoutmetrics.model.TimestampColumn
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerializer
import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder
import aws.smithy.kotlin.runtime.http.request.url
import aws.smithy.kotlin.runtime.operation.ExecutionContext
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.json.JsonSerializer
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
internal class CreateMetricSetOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateMetricSetRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/CreateMetricSet"
}
val payload = serializeCreateMetricSetOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/json")
}
return builder
}
}
private fun serializeCreateMetricSetOperationBody(context: ExecutionContext, input: CreateMetricSetRequest): ByteArray {
val serializer = JsonSerializer()
val ANOMALYDETECTORARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AnomalyDetectorArn"))
val DIMENSIONFILTERLIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("DimensionFilterList"))
val DIMENSIONLIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("DimensionList"))
val METRICLIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("MetricList"))
val METRICSETDESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MetricSetDescription"))
val METRICSETFREQUENCY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("MetricSetFrequency"))
val METRICSETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MetricSetName"))
val METRICSOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("MetricSource"))
val OFFSET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Offset"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tags"))
val TIMESTAMPCOLUMN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("TimestampColumn"))
val TIMEZONE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Timezone"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ANOMALYDETECTORARN_DESCRIPTOR)
field(DIMENSIONFILTERLIST_DESCRIPTOR)
field(DIMENSIONLIST_DESCRIPTOR)
field(METRICLIST_DESCRIPTOR)
field(METRICSETDESCRIPTION_DESCRIPTOR)
field(METRICSETFREQUENCY_DESCRIPTOR)
field(METRICSETNAME_DESCRIPTOR)
field(METRICSOURCE_DESCRIPTOR)
field(OFFSET_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(TIMESTAMPCOLUMN_DESCRIPTOR)
field(TIMEZONE_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.anomalyDetectorArn?.let { field(ANOMALYDETECTORARN_DESCRIPTOR, it) }
if (input.dimensionFilterList != null) {
listField(DIMENSIONFILTERLIST_DESCRIPTOR) {
for (el0 in input.dimensionFilterList) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeMetricSetDimensionFilterDocument))
}
}
}
if (input.dimensionList != null) {
listField(DIMENSIONLIST_DESCRIPTOR) {
for (el0 in input.dimensionList) {
serializeString(el0)
}
}
}
if (input.metricList != null) {
listField(METRICLIST_DESCRIPTOR) {
for (el0 in input.metricList) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeMetricDocument))
}
}
}
input.metricSetDescription?.let { field(METRICSETDESCRIPTION_DESCRIPTOR, it) }
input.metricSetFrequency?.let { field(METRICSETFREQUENCY_DESCRIPTOR, it.value) }
input.metricSetName?.let { field(METRICSETNAME_DESCRIPTOR, it) }
input.metricSource?.let { field(METRICSOURCE_DESCRIPTOR, it, ::serializeMetricSourceDocument) }
input.offset?.let { field(OFFSET_DESCRIPTOR, it) }
if (input.tags != null) {
mapField(TAGS_DESCRIPTOR) {
input.tags.forEach { (key, value) ->
entry(key, value)
}
}
}
input.timestampColumn?.let { field(TIMESTAMPCOLUMN_DESCRIPTOR, it, ::serializeTimestampColumnDocument) }
input.timezone?.let { field(TIMEZONE_DESCRIPTOR, it) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy