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

commonMain.aws.sdk.kotlin.services.neptune.serde.CreateDBClusterOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.neptune.serde

import aws.sdk.kotlin.services.neptune.model.CreateDbClusterRequest
import aws.sdk.kotlin.services.neptune.model.ServerlessV2ScalingConfiguration
import aws.sdk.kotlin.services.neptune.model.Tag
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.formurl.FormUrlCollectionName
import aws.smithy.kotlin.runtime.serde.formurl.FormUrlSerialName
import aws.smithy.kotlin.runtime.serde.formurl.FormUrlSerializer
import aws.smithy.kotlin.runtime.serde.formurl.QueryLiteral
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct


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

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

        val payload = serializeCreateDBClusterOperationBody(context, input)
        builder.body = HttpBody.fromBytes(payload)
        if (builder.body !is HttpBody.Empty) {
            builder.headers.setMissing("Content-Type", "application/x-www-form-urlencoded")
        }
        return builder
    }
}

private fun serializeCreateDBClusterOperationBody(context: ExecutionContext, input: CreateDbClusterRequest): ByteArray {
    val serializer = FormUrlSerializer()
    val AVAILABILITYZONES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("AvailabilityZones"), FormUrlCollectionName("AvailabilityZone"))
    val BACKUPRETENTIONPERIOD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("BackupRetentionPeriod"))
    val CHARACTERSETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("CharacterSetName"))
    val COPYTAGSTOSNAPSHOT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, FormUrlSerialName("CopyTagsToSnapshot"))
    val DBCLUSTERIDENTIFIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("DBClusterIdentifier"))
    val DBCLUSTERPARAMETERGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("DBClusterParameterGroupName"))
    val DBSUBNETGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("DBSubnetGroupName"))
    val DATABASENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("DatabaseName"))
    val DELETIONPROTECTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, FormUrlSerialName("DeletionProtection"))
    val ENABLECLOUDWATCHLOGSEXPORTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("EnableCloudwatchLogsExports"))
    val ENABLEIAMDATABASEAUTHENTICATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, FormUrlSerialName("EnableIAMDatabaseAuthentication"))
    val ENGINE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("Engine"))
    val ENGINEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("EngineVersion"))
    val GLOBALCLUSTERIDENTIFIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("GlobalClusterIdentifier"))
    val KMSKEYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("KmsKeyId"))
    val MASTERUSERPASSWORD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("MasterUserPassword"))
    val MASTERUSERNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("MasterUsername"))
    val OPTIONGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("OptionGroupName"))
    val PORT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("Port"))
    val PRESIGNEDURL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("PreSignedUrl"))
    val PREFERREDBACKUPWINDOW_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("PreferredBackupWindow"))
    val PREFERREDMAINTENANCEWINDOW_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("PreferredMaintenanceWindow"))
    val REPLICATIONSOURCEIDENTIFIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("ReplicationSourceIdentifier"))
    val SERVERLESSV2SCALINGCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("ServerlessV2ScalingConfiguration"))
    val STORAGEENCRYPTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, FormUrlSerialName("StorageEncrypted"))
    val STORAGETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("StorageType"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("Tags"), FormUrlCollectionName("Tag"))
    val VPCSECURITYGROUPIDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("VpcSecurityGroupIds"), FormUrlCollectionName("VpcSecurityGroupId"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        trait(FormUrlSerialName("CreateDBClusterMessage"))
        trait(QueryLiteral("Action", "CreateDBCluster"))
        trait(QueryLiteral("Version", "2014-10-31"))
        field(AVAILABILITYZONES_DESCRIPTOR)
        field(BACKUPRETENTIONPERIOD_DESCRIPTOR)
        field(CHARACTERSETNAME_DESCRIPTOR)
        field(COPYTAGSTOSNAPSHOT_DESCRIPTOR)
        field(DBCLUSTERIDENTIFIER_DESCRIPTOR)
        field(DBCLUSTERPARAMETERGROUPNAME_DESCRIPTOR)
        field(DBSUBNETGROUPNAME_DESCRIPTOR)
        field(DATABASENAME_DESCRIPTOR)
        field(DELETIONPROTECTION_DESCRIPTOR)
        field(ENABLECLOUDWATCHLOGSEXPORTS_DESCRIPTOR)
        field(ENABLEIAMDATABASEAUTHENTICATION_DESCRIPTOR)
        field(ENGINE_DESCRIPTOR)
        field(ENGINEVERSION_DESCRIPTOR)
        field(GLOBALCLUSTERIDENTIFIER_DESCRIPTOR)
        field(KMSKEYID_DESCRIPTOR)
        field(MASTERUSERPASSWORD_DESCRIPTOR)
        field(MASTERUSERNAME_DESCRIPTOR)
        field(OPTIONGROUPNAME_DESCRIPTOR)
        field(PORT_DESCRIPTOR)
        field(PRESIGNEDURL_DESCRIPTOR)
        field(PREFERREDBACKUPWINDOW_DESCRIPTOR)
        field(PREFERREDMAINTENANCEWINDOW_DESCRIPTOR)
        field(REPLICATIONSOURCEIDENTIFIER_DESCRIPTOR)
        field(SERVERLESSV2SCALINGCONFIGURATION_DESCRIPTOR)
        field(STORAGEENCRYPTED_DESCRIPTOR)
        field(STORAGETYPE_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(VPCSECURITYGROUPIDS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        if (input.availabilityZones != null) {
            listField(AVAILABILITYZONES_DESCRIPTOR) {
                for (el0 in input.availabilityZones) {
                    serializeString(el0)
                }
            }
        }
        input.backupRetentionPeriod?.let { field(BACKUPRETENTIONPERIOD_DESCRIPTOR, it) }
        input.characterSetName?.let { field(CHARACTERSETNAME_DESCRIPTOR, it) }
        input.copyTagsToSnapshot?.let { field(COPYTAGSTOSNAPSHOT_DESCRIPTOR, it) }
        input.dbClusterIdentifier?.let { field(DBCLUSTERIDENTIFIER_DESCRIPTOR, it) }
        input.dbClusterParameterGroupName?.let { field(DBCLUSTERPARAMETERGROUPNAME_DESCRIPTOR, it) }
        input.dbSubnetGroupName?.let { field(DBSUBNETGROUPNAME_DESCRIPTOR, it) }
        input.databaseName?.let { field(DATABASENAME_DESCRIPTOR, it) }
        input.deletionProtection?.let { field(DELETIONPROTECTION_DESCRIPTOR, it) }
        if (input.enableCloudwatchLogsExports != null) {
            listField(ENABLECLOUDWATCHLOGSEXPORTS_DESCRIPTOR) {
                for (el0 in input.enableCloudwatchLogsExports) {
                    serializeString(el0)
                }
            }
        }
        input.enableIamDatabaseAuthentication?.let { field(ENABLEIAMDATABASEAUTHENTICATION_DESCRIPTOR, it) }
        input.engine?.let { field(ENGINE_DESCRIPTOR, it) }
        input.engineVersion?.let { field(ENGINEVERSION_DESCRIPTOR, it) }
        input.globalClusterIdentifier?.let { field(GLOBALCLUSTERIDENTIFIER_DESCRIPTOR, it) }
        input.kmsKeyId?.let { field(KMSKEYID_DESCRIPTOR, it) }
        input.masterUserPassword?.let { field(MASTERUSERPASSWORD_DESCRIPTOR, it) }
        input.masterUsername?.let { field(MASTERUSERNAME_DESCRIPTOR, it) }
        input.optionGroupName?.let { field(OPTIONGROUPNAME_DESCRIPTOR, it) }
        input.port?.let { field(PORT_DESCRIPTOR, it) }
        input.preSignedUrl?.let { field(PRESIGNEDURL_DESCRIPTOR, it) }
        input.preferredBackupWindow?.let { field(PREFERREDBACKUPWINDOW_DESCRIPTOR, it) }
        input.preferredMaintenanceWindow?.let { field(PREFERREDMAINTENANCEWINDOW_DESCRIPTOR, it) }
        input.replicationSourceIdentifier?.let { field(REPLICATIONSOURCEIDENTIFIER_DESCRIPTOR, it) }
        input.serverlessV2ScalingConfiguration?.let { field(SERVERLESSV2SCALINGCONFIGURATION_DESCRIPTOR, it, ::serializeServerlessV2ScalingConfigurationDocument) }
        input.storageEncrypted?.let { field(STORAGEENCRYPTED_DESCRIPTOR, it) }
        input.storageType?.let { field(STORAGETYPE_DESCRIPTOR, it) }
        if (input.tags != null) {
            listField(TAGS_DESCRIPTOR) {
                for (el0 in input.tags) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
                }
            }
        }
        if (input.vpcSecurityGroupIds != null) {
            listField(VPCSECURITYGROUPIDS_DESCRIPTOR) {
                for (el0 in input.vpcSecurityGroupIds) {
                    serializeString(el0)
                }
            }
        }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy