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

commonMain.aws.sdk.kotlin.services.snowball.serde.UpdateJobOperationSerializer.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.JobResource
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.ShippingOption
import aws.sdk.kotlin.services.snowball.model.SnowballCapacity
import aws.sdk.kotlin.services.snowball.model.UpdateJobRequest
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 UpdateJobOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateJobRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeUpdateJobOperationBody(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 serializeUpdateJobOperationBody(context: ExecutionContext, input: UpdateJobRequest): ByteArray {
    val serializer = JsonSerializer()
    val ADDRESSID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AddressId"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val FORWARDINGADDRESSID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ForwardingAddressId"))
    val JOBID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("JobId"))
    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 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 OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ADDRESSID_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(FORWARDINGADDRESSID_DESCRIPTOR)
        field(JOBID_DESCRIPTOR)
        field(NOTIFICATION_DESCRIPTOR)
        field(ONDEVICESERVICECONFIGURATION_DESCRIPTOR)
        field(PICKUPDETAILS_DESCRIPTOR)
        field(RESOURCES_DESCRIPTOR)
        field(ROLEARN_DESCRIPTOR)
        field(SHIPPINGOPTION_DESCRIPTOR)
        field(SNOWBALLCAPACITYPREFERENCE_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.addressId?.let { field(ADDRESSID_DESCRIPTOR, it) }
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        input.forwardingAddressId?.let { field(FORWARDINGADDRESSID_DESCRIPTOR, it) }
        input.jobId?.let { field(JOBID_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.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) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy