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

commonMain.aws.sdk.kotlin.services.datasync.serde.CreateLocationEfsOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.datasync.serde

import aws.sdk.kotlin.services.datasync.model.CreateLocationEfsRequest
import aws.sdk.kotlin.services.datasync.model.Ec2Config
import aws.sdk.kotlin.services.datasync.model.EfsInTransitEncryption
import aws.sdk.kotlin.services.datasync.model.TagListEntry
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 CreateLocationEfsOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateLocationEfsRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeCreateLocationEfsOperationBody(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 serializeCreateLocationEfsOperationBody(context: ExecutionContext, input: CreateLocationEfsRequest): ByteArray {
    val serializer = JsonSerializer()
    val ACCESSPOINTARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AccessPointArn"))
    val EC2CONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Ec2Config"))
    val EFSFILESYSTEMARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("EfsFilesystemArn"))
    val FILESYSTEMACCESSROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FileSystemAccessRoleArn"))
    val INTRANSITENCRYPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("InTransitEncryption"))
    val SUBDIRECTORY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Subdirectory"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Tags"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACCESSPOINTARN_DESCRIPTOR)
        field(EC2CONFIG_DESCRIPTOR)
        field(EFSFILESYSTEMARN_DESCRIPTOR)
        field(FILESYSTEMACCESSROLEARN_DESCRIPTOR)
        field(INTRANSITENCRYPTION_DESCRIPTOR)
        field(SUBDIRECTORY_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.accessPointArn?.let { field(ACCESSPOINTARN_DESCRIPTOR, it) }
        input.ec2Config?.let { field(EC2CONFIG_DESCRIPTOR, it, ::serializeEc2ConfigDocument) }
        input.efsFilesystemArn?.let { field(EFSFILESYSTEMARN_DESCRIPTOR, it) }
        input.fileSystemAccessRoleArn?.let { field(FILESYSTEMACCESSROLEARN_DESCRIPTOR, it) }
        input.inTransitEncryption?.let { field(INTRANSITENCRYPTION_DESCRIPTOR, it.value) }
        input.subdirectory?.let { field(SUBDIRECTORY_DESCRIPTOR, it) }
        if (input.tags != null) {
            listField(TAGS_DESCRIPTOR) {
                for (el0 in input.tags) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagListEntryDocument))
                }
            }
        }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy