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

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

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

        val payload = serializeStartJobRunOperationBody(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 serializeStartJobRunOperationBody(context: ExecutionContext, input: StartJobRunRequest): ByteArray {
    val serializer = JsonSerializer()
    val ALLOCATEDCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("AllocatedCapacity"))
    val ARGUMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Arguments"))
    val EXECUTIONCLASS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ExecutionClass"))
    val JOBNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("JobName"))
    val JOBRUNID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("JobRunId"))
    val JOBRUNQUEUINGENABLED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("JobRunQueuingEnabled"))
    val MAXCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("MaxCapacity"))
    val NOTIFICATIONPROPERTY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("NotificationProperty"))
    val NUMBEROFWORKERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("NumberOfWorkers"))
    val SECURITYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SecurityConfiguration"))
    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(ARGUMENTS_DESCRIPTOR)
        field(EXECUTIONCLASS_DESCRIPTOR)
        field(JOBNAME_DESCRIPTOR)
        field(JOBRUNID_DESCRIPTOR)
        field(JOBRUNQUEUINGENABLED_DESCRIPTOR)
        field(MAXCAPACITY_DESCRIPTOR)
        field(NOTIFICATIONPROPERTY_DESCRIPTOR)
        field(NUMBEROFWORKERS_DESCRIPTOR)
        field(SECURITYCONFIGURATION_DESCRIPTOR)
        field(TIMEOUT_DESCRIPTOR)
        field(WORKERTYPE_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.allocatedCapacity?.let { field(ALLOCATEDCAPACITY_DESCRIPTOR, it) }
        if (input.arguments != null) {
            mapField(ARGUMENTS_DESCRIPTOR) {
                input.arguments.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.executionClass?.let { field(EXECUTIONCLASS_DESCRIPTOR, it.value) }
        input.jobName?.let { field(JOBNAME_DESCRIPTOR, it) }
        input.jobRunId?.let { field(JOBRUNID_DESCRIPTOR, it) }
        input.jobRunQueuingEnabled?.let { field(JOBRUNQUEUINGENABLED_DESCRIPTOR, it) }
        input.maxCapacity?.let { field(MAXCAPACITY_DESCRIPTOR, it) }
        input.notificationProperty?.let { field(NOTIFICATIONPROPERTY_DESCRIPTOR, it, ::serializeNotificationPropertyDocument) }
        input.numberOfWorkers?.let { field(NUMBEROFWORKERS_DESCRIPTOR, it) }
        input.securityConfiguration?.let { field(SECURITYCONFIGURATION_DESCRIPTOR, it) }
        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