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

commonMain.aws.sdk.kotlin.services.transfer.serde.CreateServerOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.transfer.serde

import aws.sdk.kotlin.services.transfer.model.CreateServerRequest
import aws.sdk.kotlin.services.transfer.model.Domain
import aws.sdk.kotlin.services.transfer.model.EndpointDetails
import aws.sdk.kotlin.services.transfer.model.EndpointType
import aws.sdk.kotlin.services.transfer.model.IdentityProviderDetails
import aws.sdk.kotlin.services.transfer.model.IdentityProviderType
import aws.sdk.kotlin.services.transfer.model.Protocol
import aws.sdk.kotlin.services.transfer.model.ProtocolDetails
import aws.sdk.kotlin.services.transfer.model.S3StorageOptions
import aws.sdk.kotlin.services.transfer.model.Tag
import aws.sdk.kotlin.services.transfer.model.WorkflowDetails
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 CreateServerOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateServerRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeCreateServerOperationBody(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 serializeCreateServerOperationBody(context: ExecutionContext, input: CreateServerRequest): ByteArray {
    val serializer = JsonSerializer()
    val CERTIFICATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Certificate"))
    val DOMAIN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Domain"))
    val ENDPOINTDETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("EndpointDetails"))
    val ENDPOINTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("EndpointType"))
    val HOSTKEY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("HostKey"))
    val IDENTITYPROVIDERDETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("IdentityProviderDetails"))
    val IDENTITYPROVIDERTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("IdentityProviderType"))
    val LOGGINGROLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LoggingRole"))
    val POSTAUTHENTICATIONLOGINBANNER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PostAuthenticationLoginBanner"))
    val PREAUTHENTICATIONLOGINBANNER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PreAuthenticationLoginBanner"))
    val PROTOCOLDETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ProtocolDetails"))
    val PROTOCOLS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Protocols"))
    val S3STORAGEOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("S3StorageOptions"))
    val SECURITYPOLICYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SecurityPolicyName"))
    val STRUCTUREDLOGDESTINATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("StructuredLogDestinations"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Tags"))
    val WORKFLOWDETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("WorkflowDetails"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CERTIFICATE_DESCRIPTOR)
        field(DOMAIN_DESCRIPTOR)
        field(ENDPOINTDETAILS_DESCRIPTOR)
        field(ENDPOINTTYPE_DESCRIPTOR)
        field(HOSTKEY_DESCRIPTOR)
        field(IDENTITYPROVIDERDETAILS_DESCRIPTOR)
        field(IDENTITYPROVIDERTYPE_DESCRIPTOR)
        field(LOGGINGROLE_DESCRIPTOR)
        field(POSTAUTHENTICATIONLOGINBANNER_DESCRIPTOR)
        field(PREAUTHENTICATIONLOGINBANNER_DESCRIPTOR)
        field(PROTOCOLDETAILS_DESCRIPTOR)
        field(PROTOCOLS_DESCRIPTOR)
        field(S3STORAGEOPTIONS_DESCRIPTOR)
        field(SECURITYPOLICYNAME_DESCRIPTOR)
        field(STRUCTUREDLOGDESTINATIONS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(WORKFLOWDETAILS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.certificate?.let { field(CERTIFICATE_DESCRIPTOR, it) }
        input.domain?.let { field(DOMAIN_DESCRIPTOR, it.value) }
        input.endpointDetails?.let { field(ENDPOINTDETAILS_DESCRIPTOR, it, ::serializeEndpointDetailsDocument) }
        input.endpointType?.let { field(ENDPOINTTYPE_DESCRIPTOR, it.value) }
        input.hostKey?.let { field(HOSTKEY_DESCRIPTOR, it) }
        input.identityProviderDetails?.let { field(IDENTITYPROVIDERDETAILS_DESCRIPTOR, it, ::serializeIdentityProviderDetailsDocument) }
        input.identityProviderType?.let { field(IDENTITYPROVIDERTYPE_DESCRIPTOR, it.value) }
        input.loggingRole?.let { field(LOGGINGROLE_DESCRIPTOR, it) }
        input.postAuthenticationLoginBanner?.let { field(POSTAUTHENTICATIONLOGINBANNER_DESCRIPTOR, it) }
        input.preAuthenticationLoginBanner?.let { field(PREAUTHENTICATIONLOGINBANNER_DESCRIPTOR, it) }
        input.protocolDetails?.let { field(PROTOCOLDETAILS_DESCRIPTOR, it, ::serializeProtocolDetailsDocument) }
        if (input.protocols != null) {
            listField(PROTOCOLS_DESCRIPTOR) {
                for (el0 in input.protocols) {
                    serializeString(el0.value)
                }
            }
        }
        input.s3StorageOptions?.let { field(S3STORAGEOPTIONS_DESCRIPTOR, it, ::serializeS3StorageOptionsDocument) }
        input.securityPolicyName?.let { field(SECURITYPOLICYNAME_DESCRIPTOR, it) }
        if (input.structuredLogDestinations != null) {
            listField(STRUCTUREDLOGDESTINATIONS_DESCRIPTOR) {
                for (el0 in input.structuredLogDestinations) {
                    serializeString(el0)
                }
            }
        }
        if (input.tags != null) {
            listField(TAGS_DESCRIPTOR) {
                for (el0 in input.tags) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
                }
            }
        }
        input.workflowDetails?.let { field(WORKFLOWDETAILS_DESCRIPTOR, it, ::serializeWorkflowDetailsDocument) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy