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

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

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

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

import aws.sdk.kotlin.services.datasync.model.HdfsAuthenticationType
import aws.sdk.kotlin.services.datasync.model.HdfsNameNode
import aws.sdk.kotlin.services.datasync.model.QopConfiguration
import aws.sdk.kotlin.services.datasync.model.UpdateLocationHdfsRequest
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
import aws.smithy.kotlin.runtime.text.encoding.encodeBase64String


internal class UpdateLocationHdfsOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateLocationHdfsRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeUpdateLocationHdfsOperationBody(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 serializeUpdateLocationHdfsOperationBody(context: ExecutionContext, input: UpdateLocationHdfsRequest): ByteArray {
    val serializer = JsonSerializer()
    val AGENTARNS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AgentArns"))
    val AUTHENTICATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("AuthenticationType"))
    val BLOCKSIZE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("BlockSize"))
    val KERBEROSKEYTAB_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Blob, JsonSerialName("KerberosKeytab"))
    val KERBEROSKRB5CONF_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Blob, JsonSerialName("KerberosKrb5Conf"))
    val KERBEROSPRINCIPAL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("KerberosPrincipal"))
    val KMSKEYPROVIDERURI_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("KmsKeyProviderUri"))
    val LOCATIONARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LocationArn"))
    val NAMENODES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("NameNodes"))
    val QOPCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("QopConfiguration"))
    val REPLICATIONFACTOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("ReplicationFactor"))
    val SIMPLEUSER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SimpleUser"))
    val SUBDIRECTORY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Subdirectory"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(AGENTARNS_DESCRIPTOR)
        field(AUTHENTICATIONTYPE_DESCRIPTOR)
        field(BLOCKSIZE_DESCRIPTOR)
        field(KERBEROSKEYTAB_DESCRIPTOR)
        field(KERBEROSKRB5CONF_DESCRIPTOR)
        field(KERBEROSPRINCIPAL_DESCRIPTOR)
        field(KMSKEYPROVIDERURI_DESCRIPTOR)
        field(LOCATIONARN_DESCRIPTOR)
        field(NAMENODES_DESCRIPTOR)
        field(QOPCONFIGURATION_DESCRIPTOR)
        field(REPLICATIONFACTOR_DESCRIPTOR)
        field(SIMPLEUSER_DESCRIPTOR)
        field(SUBDIRECTORY_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        if (input.agentArns != null) {
            listField(AGENTARNS_DESCRIPTOR) {
                for (el0 in input.agentArns) {
                    serializeString(el0)
                }
            }
        }
        input.authenticationType?.let { field(AUTHENTICATIONTYPE_DESCRIPTOR, it.value) }
        input.blockSize?.let { field(BLOCKSIZE_DESCRIPTOR, it) }
        input.kerberosKeytab?.let { field(KERBEROSKEYTAB_DESCRIPTOR, it.encodeBase64String()) }
        input.kerberosKrb5Conf?.let { field(KERBEROSKRB5CONF_DESCRIPTOR, it.encodeBase64String()) }
        input.kerberosPrincipal?.let { field(KERBEROSPRINCIPAL_DESCRIPTOR, it) }
        input.kmsKeyProviderUri?.let { field(KMSKEYPROVIDERURI_DESCRIPTOR, it) }
        input.locationArn?.let { field(LOCATIONARN_DESCRIPTOR, it) }
        if (input.nameNodes != null) {
            listField(NAMENODES_DESCRIPTOR) {
                for (el0 in input.nameNodes) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeHdfsNameNodeDocument))
                }
            }
        }
        input.qopConfiguration?.let { field(QOPCONFIGURATION_DESCRIPTOR, it, ::serializeQopConfigurationDocument) }
        input.replicationFactor?.let { field(REPLICATIONFACTOR_DESCRIPTOR, it) }
        input.simpleUser?.let { field(SIMPLEUSER_DESCRIPTOR, it) }
        input.subdirectory?.let { field(SUBDIRECTORY_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy