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

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

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

package aws.sdk.kotlin.services.snowball.serde

import aws.sdk.kotlin.services.snowball.model.CreateJobRequest
import aws.sdk.kotlin.services.snowball.model.DeviceConfiguration
import aws.sdk.kotlin.services.snowball.model.ImpactLevel
import aws.sdk.kotlin.services.snowball.model.JobResource
import aws.sdk.kotlin.services.snowball.model.JobType
import aws.sdk.kotlin.services.snowball.model.Notification
import aws.sdk.kotlin.services.snowball.model.OnDeviceServiceConfiguration
import aws.sdk.kotlin.services.snowball.model.PickupDetails
import aws.sdk.kotlin.services.snowball.model.RemoteManagement
import aws.sdk.kotlin.services.snowball.model.ShippingOption
import aws.sdk.kotlin.services.snowball.model.SnowballCapacity
import aws.sdk.kotlin.services.snowball.model.SnowballType
import aws.sdk.kotlin.services.snowball.model.TaxDocuments
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 ADDRESSID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AddressId"))
    val CLUSTERID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ClusterId"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val DEVICECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("DeviceConfiguration"))
    val FORWARDINGADDRESSID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ForwardingAddressId"))
    val IMPACTLEVEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ImpactLevel"))
    val JOBTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("JobType"))
    val KMSKEYARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("KmsKeyARN"))
    val LONGTERMPRICINGID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LongTermPricingId"))
    val NOTIFICATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Notification"))
    val ONDEVICESERVICECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("OnDeviceServiceConfiguration"))
    val PICKUPDETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("PickupDetails"))
    val REMOTEMANAGEMENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("RemoteManagement"))
    val RESOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Resources"))
    val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RoleARN"))
    val SHIPPINGOPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ShippingOption"))
    val SNOWBALLCAPACITYPREFERENCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("SnowballCapacityPreference"))
    val SNOWBALLTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("SnowballType"))
    val TAXDOCUMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("TaxDocuments"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ADDRESSID_DESCRIPTOR)
        field(CLUSTERID_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(DEVICECONFIGURATION_DESCRIPTOR)
        field(FORWARDINGADDRESSID_DESCRIPTOR)
        field(IMPACTLEVEL_DESCRIPTOR)
        field(JOBTYPE_DESCRIPTOR)
        field(KMSKEYARN_DESCRIPTOR)
        field(LONGTERMPRICINGID_DESCRIPTOR)
        field(NOTIFICATION_DESCRIPTOR)
        field(ONDEVICESERVICECONFIGURATION_DESCRIPTOR)
        field(PICKUPDETAILS_DESCRIPTOR)
        field(REMOTEMANAGEMENT_DESCRIPTOR)
        field(RESOURCES_DESCRIPTOR)
        field(ROLEARN_DESCRIPTOR)
        field(SHIPPINGOPTION_DESCRIPTOR)
        field(SNOWBALLCAPACITYPREFERENCE_DESCRIPTOR)
        field(SNOWBALLTYPE_DESCRIPTOR)
        field(TAXDOCUMENTS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.addressId?.let { field(ADDRESSID_DESCRIPTOR, it) }
        input.clusterId?.let { field(CLUSTERID_DESCRIPTOR, it) }
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        input.deviceConfiguration?.let { field(DEVICECONFIGURATION_DESCRIPTOR, it, ::serializeDeviceConfigurationDocument) }
        input.forwardingAddressId?.let { field(FORWARDINGADDRESSID_DESCRIPTOR, it) }
        input.impactLevel?.let { field(IMPACTLEVEL_DESCRIPTOR, it.value) }
        input.jobType?.let { field(JOBTYPE_DESCRIPTOR, it.value) }
        input.kmsKeyArn?.let { field(KMSKEYARN_DESCRIPTOR, it) }
        input.longTermPricingId?.let { field(LONGTERMPRICINGID_DESCRIPTOR, it) }
        input.notification?.let { field(NOTIFICATION_DESCRIPTOR, it, ::serializeNotificationDocument) }
        input.onDeviceServiceConfiguration?.let { field(ONDEVICESERVICECONFIGURATION_DESCRIPTOR, it, ::serializeOnDeviceServiceConfigurationDocument) }
        input.pickupDetails?.let { field(PICKUPDETAILS_DESCRIPTOR, it, ::serializePickupDetailsDocument) }
        input.remoteManagement?.let { field(REMOTEMANAGEMENT_DESCRIPTOR, it.value) }
        input.resources?.let { field(RESOURCES_DESCRIPTOR, it, ::serializeJobResourceDocument) }
        input.roleArn?.let { field(ROLEARN_DESCRIPTOR, it) }
        input.shippingOption?.let { field(SHIPPINGOPTION_DESCRIPTOR, it.value) }
        input.snowballCapacityPreference?.let { field(SNOWBALLCAPACITYPREFERENCE_DESCRIPTOR, it.value) }
        input.snowballType?.let { field(SNOWBALLTYPE_DESCRIPTOR, it.value) }
        input.taxDocuments?.let { field(TAXDOCUMENTS_DESCRIPTOR, it, ::serializeTaxDocumentsDocument) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy