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

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

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

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

import aws.sdk.kotlin.services.glue.model.CodeGenConfigurationNode
import aws.sdk.kotlin.services.glue.model.ConnectionsList
import aws.sdk.kotlin.services.glue.model.CreateJobRequest
import aws.sdk.kotlin.services.glue.model.ExecutionClass
import aws.sdk.kotlin.services.glue.model.ExecutionProperty
import aws.sdk.kotlin.services.glue.model.JobCommand
import aws.sdk.kotlin.services.glue.model.JobMode
import aws.sdk.kotlin.services.glue.model.NotificationProperty
import aws.sdk.kotlin.services.glue.model.SourceControlDetails
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 CreateJobOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateJobRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeCreateJobOperationBody(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 serializeCreateJobOperationBody(context: ExecutionContext, input: CreateJobRequest): ByteArray {
    val serializer = JsonSerializer()
    val ALLOCATEDCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("AllocatedCapacity"))
    val CODEGENCONFIGURATIONNODES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("CodeGenConfigurationNodes"))
    val COMMAND_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Command"))
    val CONNECTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Connections"))
    val DEFAULTARGUMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("DefaultArguments"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val EXECUTIONCLASS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ExecutionClass"))
    val EXECUTIONPROPERTY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ExecutionProperty"))
    val GLUEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GlueVersion"))
    val JOBMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("JobMode"))
    val JOBRUNQUEUINGENABLED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("JobRunQueuingEnabled"))
    val LOGURI_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LogUri"))
    val MAINTENANCEWINDOW_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MaintenanceWindow"))
    val MAXCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("MaxCapacity"))
    val MAXRETRIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MaxRetries"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val NONOVERRIDABLEARGUMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("NonOverridableArguments"))
    val NOTIFICATIONPROPERTY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("NotificationProperty"))
    val NUMBEROFWORKERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("NumberOfWorkers"))
    val ROLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Role"))
    val SECURITYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SecurityConfiguration"))
    val SOURCECONTROLDETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("SourceControlDetails"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tags"))
    val TIMEOUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Timeout"))
    val WORKERTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("WorkerType"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ALLOCATEDCAPACITY_DESCRIPTOR)
        field(CODEGENCONFIGURATIONNODES_DESCRIPTOR)
        field(COMMAND_DESCRIPTOR)
        field(CONNECTIONS_DESCRIPTOR)
        field(DEFAULTARGUMENTS_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(EXECUTIONCLASS_DESCRIPTOR)
        field(EXECUTIONPROPERTY_DESCRIPTOR)
        field(GLUEVERSION_DESCRIPTOR)
        field(JOBMODE_DESCRIPTOR)
        field(JOBRUNQUEUINGENABLED_DESCRIPTOR)
        field(LOGURI_DESCRIPTOR)
        field(MAINTENANCEWINDOW_DESCRIPTOR)
        field(MAXCAPACITY_DESCRIPTOR)
        field(MAXRETRIES_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(NONOVERRIDABLEARGUMENTS_DESCRIPTOR)
        field(NOTIFICATIONPROPERTY_DESCRIPTOR)
        field(NUMBEROFWORKERS_DESCRIPTOR)
        field(ROLE_DESCRIPTOR)
        field(SECURITYCONFIGURATION_DESCRIPTOR)
        field(SOURCECONTROLDETAILS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(TIMEOUT_DESCRIPTOR)
        field(WORKERTYPE_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.allocatedCapacity?.let { field(ALLOCATEDCAPACITY_DESCRIPTOR, it) }
        if (input.codeGenConfigurationNodes != null) {
            mapField(CODEGENCONFIGURATIONNODES_DESCRIPTOR) {
                input.codeGenConfigurationNodes.forEach { (key, value) -> entry(key, asSdkSerializable(value, ::serializeCodeGenConfigurationNodeDocument)) }
            }
        }
        input.command?.let { field(COMMAND_DESCRIPTOR, it, ::serializeJobCommandDocument) }
        input.connections?.let { field(CONNECTIONS_DESCRIPTOR, it, ::serializeConnectionsListDocument) }
        if (input.defaultArguments != null) {
            mapField(DEFAULTARGUMENTS_DESCRIPTOR) {
                input.defaultArguments.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        input.executionClass?.let { field(EXECUTIONCLASS_DESCRIPTOR, it.value) }
        input.executionProperty?.let { field(EXECUTIONPROPERTY_DESCRIPTOR, it, ::serializeExecutionPropertyDocument) }
        input.glueVersion?.let { field(GLUEVERSION_DESCRIPTOR, it) }
        input.jobMode?.let { field(JOBMODE_DESCRIPTOR, it.value) }
        input.jobRunQueuingEnabled?.let { field(JOBRUNQUEUINGENABLED_DESCRIPTOR, it) }
        input.logUri?.let { field(LOGURI_DESCRIPTOR, it) }
        input.maintenanceWindow?.let { field(MAINTENANCEWINDOW_DESCRIPTOR, it) }
        input.maxCapacity?.let { field(MAXCAPACITY_DESCRIPTOR, it) }
        input.maxRetries?.let { field(MAXRETRIES_DESCRIPTOR, it) }
        input.name?.let { field(NAME_DESCRIPTOR, it) }
        if (input.nonOverridableArguments != null) {
            mapField(NONOVERRIDABLEARGUMENTS_DESCRIPTOR) {
                input.nonOverridableArguments.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.notificationProperty?.let { field(NOTIFICATIONPROPERTY_DESCRIPTOR, it, ::serializeNotificationPropertyDocument) }
        input.numberOfWorkers?.let { field(NUMBEROFWORKERS_DESCRIPTOR, it) }
        input.role?.let { field(ROLE_DESCRIPTOR, it) }
        input.securityConfiguration?.let { field(SECURITYCONFIGURATION_DESCRIPTOR, it) }
        input.sourceControlDetails?.let { field(SOURCECONTROLDETAILS_DESCRIPTOR, it, ::serializeSourceControlDetailsDocument) }
        if (input.tags != null) {
            mapField(TAGS_DESCRIPTOR) {
                input.tags.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.timeout?.let { field(TIMEOUT_DESCRIPTOR, it) }
        input.workerType?.let { field(WORKERTYPE_DESCRIPTOR, it.value) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy