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

commonMain.aws.sdk.kotlin.services.timestreaminfluxdb.serde.CreateDbInstanceOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.timestreaminfluxdb.serde

import aws.sdk.kotlin.services.timestreaminfluxdb.model.CreateDbInstanceRequest
import aws.sdk.kotlin.services.timestreaminfluxdb.model.DbInstanceType
import aws.sdk.kotlin.services.timestreaminfluxdb.model.DbStorageType
import aws.sdk.kotlin.services.timestreaminfluxdb.model.DeploymentType
import aws.sdk.kotlin.services.timestreaminfluxdb.model.LogDeliveryConfiguration
import aws.sdk.kotlin.services.timestreaminfluxdb.model.NetworkType
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 CreateDbInstanceOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateDbInstanceRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeCreateDbInstanceOperationBody(context, input)
        builder.body = HttpBody.fromBytes(payload)
        if (builder.body !is HttpBody.Empty) {
            builder.headers.setMissing("Content-Type", "application/x-amz-json-1.0")
        }
        return builder
    }
}

private fun serializeCreateDbInstanceOperationBody(context: ExecutionContext, input: CreateDbInstanceRequest): ByteArray {
    val serializer = JsonSerializer()
    val ALLOCATEDSTORAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("allocatedStorage"))
    val BUCKET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("bucket"))
    val DBINSTANCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("dbInstanceType"))
    val DBPARAMETERGROUPIDENTIFIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("dbParameterGroupIdentifier"))
    val DBSTORAGETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("dbStorageType"))
    val DEPLOYMENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("deploymentType"))
    val LOGDELIVERYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("logDeliveryConfiguration"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val NETWORKTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("networkType"))
    val ORGANIZATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("organization"))
    val PASSWORD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("password"))
    val PORT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("port"))
    val PUBLICLYACCESSIBLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("publiclyAccessible"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("tags"))
    val USERNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("username"))
    val VPCSECURITYGROUPIDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("vpcSecurityGroupIds"))
    val VPCSUBNETIDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("vpcSubnetIds"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ALLOCATEDSTORAGE_DESCRIPTOR)
        field(BUCKET_DESCRIPTOR)
        field(DBINSTANCETYPE_DESCRIPTOR)
        field(DBPARAMETERGROUPIDENTIFIER_DESCRIPTOR)
        field(DBSTORAGETYPE_DESCRIPTOR)
        field(DEPLOYMENTTYPE_DESCRIPTOR)
        field(LOGDELIVERYCONFIGURATION_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(NETWORKTYPE_DESCRIPTOR)
        field(ORGANIZATION_DESCRIPTOR)
        field(PASSWORD_DESCRIPTOR)
        field(PORT_DESCRIPTOR)
        field(PUBLICLYACCESSIBLE_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(USERNAME_DESCRIPTOR)
        field(VPCSECURITYGROUPIDS_DESCRIPTOR)
        field(VPCSUBNETIDS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.allocatedStorage?.let { field(ALLOCATEDSTORAGE_DESCRIPTOR, it) }
        input.bucket?.let { field(BUCKET_DESCRIPTOR, it) }
        input.dbInstanceType?.let { field(DBINSTANCETYPE_DESCRIPTOR, it.value) }
        input.dbParameterGroupIdentifier?.let { field(DBPARAMETERGROUPIDENTIFIER_DESCRIPTOR, it) }
        input.dbStorageType?.let { field(DBSTORAGETYPE_DESCRIPTOR, it.value) }
        input.deploymentType?.let { field(DEPLOYMENTTYPE_DESCRIPTOR, it.value) }
        input.logDeliveryConfiguration?.let { field(LOGDELIVERYCONFIGURATION_DESCRIPTOR, it, ::serializeLogDeliveryConfigurationDocument) }
        input.name?.let { field(NAME_DESCRIPTOR, it) }
        input.networkType?.let { field(NETWORKTYPE_DESCRIPTOR, it.value) }
        input.organization?.let { field(ORGANIZATION_DESCRIPTOR, it) }
        input.password?.let { field(PASSWORD_DESCRIPTOR, it) }
        input.port?.let { field(PORT_DESCRIPTOR, it) }
        input.publiclyAccessible?.let { field(PUBLICLYACCESSIBLE_DESCRIPTOR, it) }
        if (input.tags != null) {
            mapField(TAGS_DESCRIPTOR) {
                input.tags.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.username?.let { field(USERNAME_DESCRIPTOR, it) }
        if (input.vpcSecurityGroupIds != null) {
            listField(VPCSECURITYGROUPIDS_DESCRIPTOR) {
                for (el0 in input.vpcSecurityGroupIds) {
                    serializeString(el0)
                }
            }
        }
        if (input.vpcSubnetIds != null) {
            listField(VPCSUBNETIDS_DESCRIPTOR) {
                for (el0 in input.vpcSubnetIds) {
                    serializeString(el0)
                }
            }
        }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy