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

commonMain.aws.sdk.kotlin.services.ssmincidents.serde.UpdateResponsePlanOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.ssmincidents.serde

import aws.sdk.kotlin.services.ssmincidents.model.Action
import aws.sdk.kotlin.services.ssmincidents.model.ChatChannel
import aws.sdk.kotlin.services.ssmincidents.model.Integration
import aws.sdk.kotlin.services.ssmincidents.model.NotificationTargetItem
import aws.sdk.kotlin.services.ssmincidents.model.UpdateResponsePlanRequest
import aws.smithy.kotlin.runtime.client.idempotencyTokenProvider
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 UpdateResponsePlanOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateResponsePlanRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

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

private fun serializeUpdateResponsePlanOperationBody(context: ExecutionContext, input: UpdateResponsePlanRequest): ByteArray {
    val serializer = JsonSerializer()
    val ACTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("actions"))
    val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("arn"))
    val CHATCHANNEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("chatChannel"))
    val CLIENTTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("clientToken"))
    val DISPLAYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("displayName"))
    val ENGAGEMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("engagements"))
    val INCIDENTTEMPLATEDEDUPESTRING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("incidentTemplateDedupeString"))
    val INCIDENTTEMPLATEIMPACT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("incidentTemplateImpact"))
    val INCIDENTTEMPLATENOTIFICATIONTARGETS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("incidentTemplateNotificationTargets"))
    val INCIDENTTEMPLATESUMMARY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("incidentTemplateSummary"))
    val INCIDENTTEMPLATETAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("incidentTemplateTags"))
    val INCIDENTTEMPLATETITLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("incidentTemplateTitle"))
    val INTEGRATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("integrations"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACTIONS_DESCRIPTOR)
        field(ARN_DESCRIPTOR)
        field(CHATCHANNEL_DESCRIPTOR)
        field(CLIENTTOKEN_DESCRIPTOR)
        field(DISPLAYNAME_DESCRIPTOR)
        field(ENGAGEMENTS_DESCRIPTOR)
        field(INCIDENTTEMPLATEDEDUPESTRING_DESCRIPTOR)
        field(INCIDENTTEMPLATEIMPACT_DESCRIPTOR)
        field(INCIDENTTEMPLATENOTIFICATIONTARGETS_DESCRIPTOR)
        field(INCIDENTTEMPLATESUMMARY_DESCRIPTOR)
        field(INCIDENTTEMPLATETAGS_DESCRIPTOR)
        field(INCIDENTTEMPLATETITLE_DESCRIPTOR)
        field(INTEGRATIONS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        if (input.actions != null) {
            listField(ACTIONS_DESCRIPTOR) {
                for (el0 in input.actions) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeActionDocument))
                }
            }
        }
        field(ARN_DESCRIPTOR, input.arn)
        input.chatChannel?.let { field(CHATCHANNEL_DESCRIPTOR, it, ::serializeChatChannelDocument) }
        input.clientToken?.let { field(CLIENTTOKEN_DESCRIPTOR, it) } ?: field(CLIENTTOKEN_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
        input.displayName?.let { field(DISPLAYNAME_DESCRIPTOR, it) }
        if (input.engagements != null) {
            listField(ENGAGEMENTS_DESCRIPTOR) {
                for (el0 in input.engagements) {
                    serializeString(el0)
                }
            }
        }
        input.incidentTemplateDedupeString?.let { field(INCIDENTTEMPLATEDEDUPESTRING_DESCRIPTOR, it) }
        input.incidentTemplateImpact?.let { field(INCIDENTTEMPLATEIMPACT_DESCRIPTOR, it) }
        if (input.incidentTemplateNotificationTargets != null) {
            listField(INCIDENTTEMPLATENOTIFICATIONTARGETS_DESCRIPTOR) {
                for (el0 in input.incidentTemplateNotificationTargets) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeNotificationTargetItemDocument))
                }
            }
        }
        input.incidentTemplateSummary?.let { field(INCIDENTTEMPLATESUMMARY_DESCRIPTOR, it) }
        if (input.incidentTemplateTags != null) {
            mapField(INCIDENTTEMPLATETAGS_DESCRIPTOR) {
                input.incidentTemplateTags.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.incidentTemplateTitle?.let { field(INCIDENTTEMPLATETITLE_DESCRIPTOR, it) }
        if (input.integrations != null) {
            listField(INTEGRATIONS_DESCRIPTOR) {
                for (el0 in input.integrations) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeIntegrationDocument))
                }
            }
        }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy