commonMain.aws.sdk.kotlin.services.lookoutmetrics.serde.UpdateMetricSetOperationSerializer.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
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.lookoutmetrics.serde
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.sdk.kotlin.services.lookoutmetrics.model.UpdateMetricSetRequest
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerialize
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 UpdateMetricSetOperationSerializer: HttpSerialize {
override suspend fun serialize(context: ExecutionContext, input: UpdateMetricSetRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/UpdateMetricSet"
}
val payload = serializeUpdateMetricSetOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/json")
}
return builder
}
}
private fun serializeUpdateMetricSetOperationBody(context: ExecutionContext, input: UpdateMetricSetRequest): ByteArray {
val serializer = JsonSerializer()
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 METRICSETARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MetricSetArn"))
val METRICSETDESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MetricSetDescription"))
val METRICSETFREQUENCY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("MetricSetFrequency"))
val METRICSOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("MetricSource"))
val OFFSET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Offset"))
val TIMESTAMPCOLUMN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("TimestampColumn"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(DIMENSIONFILTERLIST_DESCRIPTOR)
field(DIMENSIONLIST_DESCRIPTOR)
field(METRICLIST_DESCRIPTOR)
field(METRICSETARN_DESCRIPTOR)
field(METRICSETDESCRIPTION_DESCRIPTOR)
field(METRICSETFREQUENCY_DESCRIPTOR)
field(METRICSOURCE_DESCRIPTOR)
field(OFFSET_DESCRIPTOR)
field(TIMESTAMPCOLUMN_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
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.metricSetArn?.let { field(METRICSETARN_DESCRIPTOR, it) }
input.metricSetDescription?.let { field(METRICSETDESCRIPTION_DESCRIPTOR, it) }
input.metricSetFrequency?.let { field(METRICSETFREQUENCY_DESCRIPTOR, it.value) }
input.metricSource?.let { field(METRICSOURCE_DESCRIPTOR, it, ::serializeMetricSourceDocument) }
input.offset?.let { field(OFFSET_DESCRIPTOR, it) }
input.timestampColumn?.let { field(TIMESTAMPCOLUMN_DESCRIPTOR, it, ::serializeTimestampColumnDocument) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy