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

commonMain.aws.sdk.kotlin.services.chatbot.serde.CreateSlackChannelConfigurationOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.chatbot.serde

import aws.sdk.kotlin.services.chatbot.model.CreateSlackChannelConfigurationRequest
import aws.sdk.kotlin.services.chatbot.model.Tag
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 CreateSlackChannelConfigurationOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateSlackChannelConfigurationRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

        builder.url {
            path.encoded = "/create-slack-channel-configuration"
        }

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

private fun serializeCreateSlackChannelConfigurationOperationBody(context: ExecutionContext, input: CreateSlackChannelConfigurationRequest): ByteArray {
    val serializer = JsonSerializer()
    val CONFIGURATIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ConfigurationName"))
    val GUARDRAILPOLICYARNS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("GuardrailPolicyArns"))
    val IAMROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("IamRoleArn"))
    val LOGGINGLEVEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LoggingLevel"))
    val SLACKCHANNELID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SlackChannelId"))
    val SLACKCHANNELNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SlackChannelName"))
    val SLACKTEAMID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SlackTeamId"))
    val SNSTOPICARNS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("SnsTopicArns"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Tags"))
    val USERAUTHORIZATIONREQUIRED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("UserAuthorizationRequired"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CONFIGURATIONNAME_DESCRIPTOR)
        field(GUARDRAILPOLICYARNS_DESCRIPTOR)
        field(IAMROLEARN_DESCRIPTOR)
        field(LOGGINGLEVEL_DESCRIPTOR)
        field(SLACKCHANNELID_DESCRIPTOR)
        field(SLACKCHANNELNAME_DESCRIPTOR)
        field(SLACKTEAMID_DESCRIPTOR)
        field(SNSTOPICARNS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(USERAUTHORIZATIONREQUIRED_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.configurationName?.let { field(CONFIGURATIONNAME_DESCRIPTOR, it) }
        if (input.guardrailPolicyArns != null) {
            listField(GUARDRAILPOLICYARNS_DESCRIPTOR) {
                for (el0 in input.guardrailPolicyArns) {
                    serializeString(el0)
                }
            }
        }
        input.iamRoleArn?.let { field(IAMROLEARN_DESCRIPTOR, it) }
        input.loggingLevel?.let { field(LOGGINGLEVEL_DESCRIPTOR, it) }
        input.slackChannelId?.let { field(SLACKCHANNELID_DESCRIPTOR, it) }
        input.slackChannelName?.let { field(SLACKCHANNELNAME_DESCRIPTOR, it) }
        input.slackTeamId?.let { field(SLACKTEAMID_DESCRIPTOR, it) }
        if (input.snsTopicArns != null) {
            listField(SNSTOPICARNS_DESCRIPTOR) {
                for (el0 in input.snsTopicArns) {
                    serializeString(el0)
                }
            }
        }
        if (input.tags != null) {
            listField(TAGS_DESCRIPTOR) {
                for (el0 in input.tags) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
                }
            }
        }
        input.userAuthorizationRequired?.let { field(USERAUTHORIZATIONREQUIRED_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy