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

commonMain.aws.sdk.kotlin.services.glue.serde.CreateDevEndpointOperationSerializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.glue.serde

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

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

        val payload = serializeCreateDevEndpointOperationBody(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 serializeCreateDevEndpointOperationBody(context: ExecutionContext, input: CreateDevEndpointRequest): ByteArray {
    val serializer = JsonSerializer()
    val ARGUMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Arguments"))
    val ENDPOINTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("EndpointName"))
    val EXTRAJARSS3PATH_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ExtraJarsS3Path"))
    val EXTRAPYTHONLIBSS3PATH_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ExtraPythonLibsS3Path"))
    val GLUEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GlueVersion"))
    val NUMBEROFNODES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("NumberOfNodes"))
    val NUMBEROFWORKERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("NumberOfWorkers"))
    val PUBLICKEY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PublicKey"))
    val PUBLICKEYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("PublicKeys"))
    val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RoleArn"))
    val SECURITYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SecurityConfiguration"))
    val SECURITYGROUPIDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("SecurityGroupIds"))
    val SUBNETID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SubnetId"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tags"))
    val WORKERTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("WorkerType"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ARGUMENTS_DESCRIPTOR)
        field(ENDPOINTNAME_DESCRIPTOR)
        field(EXTRAJARSS3PATH_DESCRIPTOR)
        field(EXTRAPYTHONLIBSS3PATH_DESCRIPTOR)
        field(GLUEVERSION_DESCRIPTOR)
        field(NUMBEROFNODES_DESCRIPTOR)
        field(NUMBEROFWORKERS_DESCRIPTOR)
        field(PUBLICKEY_DESCRIPTOR)
        field(PUBLICKEYS_DESCRIPTOR)
        field(ROLEARN_DESCRIPTOR)
        field(SECURITYCONFIGURATION_DESCRIPTOR)
        field(SECURITYGROUPIDS_DESCRIPTOR)
        field(SUBNETID_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(WORKERTYPE_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        if (input.arguments != null) {
            mapField(ARGUMENTS_DESCRIPTOR) {
                input.arguments.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.endpointName?.let { field(ENDPOINTNAME_DESCRIPTOR, it) }
        input.extraJarsS3Path?.let { field(EXTRAJARSS3PATH_DESCRIPTOR, it) }
        input.extraPythonLibsS3Path?.let { field(EXTRAPYTHONLIBSS3PATH_DESCRIPTOR, it) }
        input.glueVersion?.let { field(GLUEVERSION_DESCRIPTOR, it) }
        input.numberOfNodes?.let { field(NUMBEROFNODES_DESCRIPTOR, it) }
        input.numberOfWorkers?.let { field(NUMBEROFWORKERS_DESCRIPTOR, it) }
        input.publicKey?.let { field(PUBLICKEY_DESCRIPTOR, it) }
        if (input.publicKeys != null) {
            listField(PUBLICKEYS_DESCRIPTOR) {
                for (el0 in input.publicKeys) {
                    serializeString(el0)
                }
            }
        }
        input.roleArn?.let { field(ROLEARN_DESCRIPTOR, it) }
        input.securityConfiguration?.let { field(SECURITYCONFIGURATION_DESCRIPTOR, it) }
        if (input.securityGroupIds != null) {
            listField(SECURITYGROUPIDS_DESCRIPTOR) {
                for (el0 in input.securityGroupIds) {
                    serializeString(el0)
                }
            }
        }
        input.subnetId?.let { field(SUBNETID_DESCRIPTOR, it) }
        if (input.tags != null) {
            mapField(TAGS_DESCRIPTOR) {
                input.tags.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.workerType?.let { field(WORKERTYPE_DESCRIPTOR, it.value) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy