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

commonMain.aws.sdk.kotlin.services.databrew.transform.CreateProfileJobOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.databrew.transform

import aws.sdk.kotlin.services.databrew.model.CreateProfileJobRequest
import aws.sdk.kotlin.services.databrew.model.EncryptionMode
import aws.sdk.kotlin.services.databrew.model.JobSample
import aws.sdk.kotlin.services.databrew.model.LogSubscription
import aws.sdk.kotlin.services.databrew.model.ProfileConfiguration
import aws.sdk.kotlin.services.databrew.model.S3Location
import aws.sdk.kotlin.services.databrew.model.ValidationConfiguration
import aws.smithy.kotlin.runtime.client.ExecutionContext
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.content.ByteArrayContent
import aws.smithy.kotlin.runtime.http.operation.HttpSerialize
import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder
import aws.smithy.kotlin.runtime.http.request.url
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 CreateProfileJobOperationSerializer: HttpSerialize {
    override suspend fun serialize(context: ExecutionContext, input: CreateProfileJobRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

        builder.url {
            path = "/profileJobs"
        }

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

private fun serializeCreateProfileJobOperationBody(context: ExecutionContext, input: CreateProfileJobRequest): ByteArray {
    val serializer = JsonSerializer()
    val CONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Configuration"))
    val DATASETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DatasetName"))
    val ENCRYPTIONKEYARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("EncryptionKeyArn"))
    val ENCRYPTIONMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("EncryptionMode"))
    val JOBSAMPLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("JobSample"))
    val LOGSUBSCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LogSubscription"))
    val MAXCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MaxCapacity"))
    val MAXRETRIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MaxRetries"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val OUTPUTLOCATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("OutputLocation"))
    val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RoleArn"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tags"))
    val TIMEOUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Timeout"))
    val VALIDATIONCONFIGURATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ValidationConfigurations"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CONFIGURATION_DESCRIPTOR)
        field(DATASETNAME_DESCRIPTOR)
        field(ENCRYPTIONKEYARN_DESCRIPTOR)
        field(ENCRYPTIONMODE_DESCRIPTOR)
        field(JOBSAMPLE_DESCRIPTOR)
        field(LOGSUBSCRIPTION_DESCRIPTOR)
        field(MAXCAPACITY_DESCRIPTOR)
        field(MAXRETRIES_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(OUTPUTLOCATION_DESCRIPTOR)
        field(ROLEARN_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(TIMEOUT_DESCRIPTOR)
        field(VALIDATIONCONFIGURATIONS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.configuration?.let { field(CONFIGURATION_DESCRIPTOR, it, ::serializeProfileConfigurationDocument) }
        input.datasetName?.let { field(DATASETNAME_DESCRIPTOR, it) }
        input.encryptionKeyArn?.let { field(ENCRYPTIONKEYARN_DESCRIPTOR, it) }
        input.encryptionMode?.let { field(ENCRYPTIONMODE_DESCRIPTOR, it.value) }
        input.jobSample?.let { field(JOBSAMPLE_DESCRIPTOR, it, ::serializeJobSampleDocument) }
        input.logSubscription?.let { field(LOGSUBSCRIPTION_DESCRIPTOR, it.value) }
        if (input.maxCapacity != 0) field(MAXCAPACITY_DESCRIPTOR, input.maxCapacity)
        if (input.maxRetries != 0) field(MAXRETRIES_DESCRIPTOR, input.maxRetries)
        input.name?.let { field(NAME_DESCRIPTOR, it) }
        input.outputLocation?.let { field(OUTPUTLOCATION_DESCRIPTOR, it, ::serializeS3LocationDocument) }
        input.roleArn?.let { field(ROLEARN_DESCRIPTOR, it) }
        if (input.tags != null) {
            mapField(TAGS_DESCRIPTOR) {
                input.tags.forEach { (key, value) -> entry(key, value) }
            }
        }
        if (input.timeout != 0) field(TIMEOUT_DESCRIPTOR, input.timeout)
        if (input.validationConfigurations != null) {
            listField(VALIDATIONCONFIGURATIONS_DESCRIPTOR) {
                for (el0 in input.validationConfigurations) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeValidationConfigurationDocument))
                }
            }
        }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy