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

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

There is a newer version: 1.3.77
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

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

import aws.sdk.kotlin.services.cloudwatchlogs.model.SuppressionPeriod
import aws.sdk.kotlin.services.cloudwatchlogs.model.SuppressionType
import aws.sdk.kotlin.services.cloudwatchlogs.model.UpdateAnomalyRequest
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 UpdateAnomalyOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateAnomalyRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

        builder.url {
            path.encoded = "/"
        }

        val payload = serializeUpdateAnomalyOperationBody(context, input)
        builder.body = HttpBody.fromBytes(payload)
        if (builder.body !is HttpBody.Empty) {
            builder.headers.setMissing("Content-Type", "application/x-amz-json-1.1")
        }
        return builder
    }
}

private fun serializeUpdateAnomalyOperationBody(context: ExecutionContext, input: UpdateAnomalyRequest): ByteArray {
    val serializer = JsonSerializer()
    val ANOMALYDETECTORARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("anomalyDetectorArn"))
    val ANOMALYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("anomalyId"))
    val BASELINE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("baseline"))
    val PATTERNID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("patternId"))
    val SUPPRESSIONPERIOD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("suppressionPeriod"))
    val SUPPRESSIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("suppressionType"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ANOMALYDETECTORARN_DESCRIPTOR)
        field(ANOMALYID_DESCRIPTOR)
        field(BASELINE_DESCRIPTOR)
        field(PATTERNID_DESCRIPTOR)
        field(SUPPRESSIONPERIOD_DESCRIPTOR)
        field(SUPPRESSIONTYPE_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.anomalyDetectorArn?.let { field(ANOMALYDETECTORARN_DESCRIPTOR, it) }
        input.anomalyId?.let { field(ANOMALYID_DESCRIPTOR, it) }
        input.baseline?.let { field(BASELINE_DESCRIPTOR, it) }
        input.patternId?.let { field(PATTERNID_DESCRIPTOR, it) }
        input.suppressionPeriod?.let { field(SUPPRESSIONPERIOD_DESCRIPTOR, it, ::serializeSuppressionPeriodDocument) }
        input.suppressionType?.let { field(SUPPRESSIONTYPE_DESCRIPTOR, it.value) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy