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

commonMain.aws.sdk.kotlin.services.transfer.serde.UpdateServerOperationSerializer.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.EndpointDetails
import aws.sdk.kotlin.services.transfer.model.EndpointType
import aws.sdk.kotlin.services.transfer.model.IdentityProviderDetails
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.UpdateServerRequest
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 UpdateServerOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateServerRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeUpdateServerOperationBody(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 serializeUpdateServerOperationBody(context: ExecutionContext, input: UpdateServerRequest): ByteArray {
    val serializer = JsonSerializer()
    val CERTIFICATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Certificate"))
    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 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 SERVERID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ServerId"))
    val STRUCTUREDLOGDESTINATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("StructuredLogDestinations"))
    val WORKFLOWDETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("WorkflowDetails"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CERTIFICATE_DESCRIPTOR)
        field(ENDPOINTDETAILS_DESCRIPTOR)
        field(ENDPOINTTYPE_DESCRIPTOR)
        field(HOSTKEY_DESCRIPTOR)
        field(IDENTITYPROVIDERDETAILS_DESCRIPTOR)
        field(LOGGINGROLE_DESCRIPTOR)
        field(POSTAUTHENTICATIONLOGINBANNER_DESCRIPTOR)
        field(PREAUTHENTICATIONLOGINBANNER_DESCRIPTOR)
        field(PROTOCOLDETAILS_DESCRIPTOR)
        field(PROTOCOLS_DESCRIPTOR)
        field(S3STORAGEOPTIONS_DESCRIPTOR)
        field(SECURITYPOLICYNAME_DESCRIPTOR)
        field(SERVERID_DESCRIPTOR)
        field(STRUCTUREDLOGDESTINATIONS_DESCRIPTOR)
        field(WORKFLOWDETAILS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.certificate?.let { field(CERTIFICATE_DESCRIPTOR, it) }
        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.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) }
        input.serverId?.let { field(SERVERID_DESCRIPTOR, it) }
        if (input.structuredLogDestinations != null) {
            listField(STRUCTUREDLOGDESTINATIONS_DESCRIPTOR) {
                for (el0 in input.structuredLogDestinations) {
                    serializeString(el0)
                }
            }
        }
        input.workflowDetails?.let { field(WORKFLOWDETAILS_DESCRIPTOR, it, ::serializeWorkflowDetailsDocument) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy