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

commonMain.aws.sdk.kotlin.services.neptune.serde.RestoreDBClusterFromSnapshotOperationSerializer.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.RestoreDbClusterFromSnapshotRequest
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 RestoreDBClusterFromSnapshotOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: RestoreDbClusterFromSnapshotRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeRestoreDBClusterFromSnapshotOperationBody(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 serializeRestoreDBClusterFromSnapshotOperationBody(context: ExecutionContext, input: RestoreDbClusterFromSnapshotRequest): ByteArray {
    val serializer = FormUrlSerializer()
    val AVAILABILITYZONES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("AvailabilityZones"), FormUrlCollectionName("AvailabilityZone"))
    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 KMSKEYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("KmsKeyId"))
    val OPTIONGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("OptionGroupName"))
    val PORT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("Port"))
    val SERVERLESSV2SCALINGCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("ServerlessV2ScalingConfiguration"))
    val SNAPSHOTIDENTIFIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("SnapshotIdentifier"))
    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("RestoreDBClusterFromSnapshotMessage"))
        trait(QueryLiteral("Action", "RestoreDBClusterFromSnapshot"))
        trait(QueryLiteral("Version", "2014-10-31"))
        field(AVAILABILITYZONES_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(KMSKEYID_DESCRIPTOR)
        field(OPTIONGROUPNAME_DESCRIPTOR)
        field(PORT_DESCRIPTOR)
        field(SERVERLESSV2SCALINGCONFIGURATION_DESCRIPTOR)
        field(SNAPSHOTIDENTIFIER_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.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.kmsKeyId?.let { field(KMSKEYID_DESCRIPTOR, it) }
        input.optionGroupName?.let { field(OPTIONGROUPNAME_DESCRIPTOR, it) }
        input.port?.let { field(PORT_DESCRIPTOR, it) }
        input.serverlessV2ScalingConfiguration?.let { field(SERVERLESSV2SCALINGCONFIGURATION_DESCRIPTOR, it, ::serializeServerlessV2ScalingConfigurationDocument) }
        input.snapshotIdentifier?.let { field(SNAPSHOTIDENTIFIER_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