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

commonMain.aws.sdk.kotlin.services.autoscaling.serde.CreateLaunchConfigurationOperationSerializer.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.autoscaling.serde

import aws.sdk.kotlin.services.autoscaling.model.BlockDeviceMapping
import aws.sdk.kotlin.services.autoscaling.model.CreateLaunchConfigurationRequest
import aws.sdk.kotlin.services.autoscaling.model.InstanceMetadataOptions
import aws.sdk.kotlin.services.autoscaling.model.InstanceMonitoring
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.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 CreateLaunchConfigurationOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateLaunchConfigurationRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeCreateLaunchConfigurationOperationBody(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 serializeCreateLaunchConfigurationOperationBody(context: ExecutionContext, input: CreateLaunchConfigurationRequest): ByteArray {
    val serializer = FormUrlSerializer()
    val ASSOCIATEPUBLICIPADDRESS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, FormUrlSerialName("AssociatePublicIpAddress"))
    val BLOCKDEVICEMAPPINGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("BlockDeviceMappings"))
    val CLASSICLINKVPCID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("ClassicLinkVPCId"))
    val CLASSICLINKVPCSECURITYGROUPS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("ClassicLinkVPCSecurityGroups"))
    val EBSOPTIMIZED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, FormUrlSerialName("EbsOptimized"))
    val IAMINSTANCEPROFILE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("IamInstanceProfile"))
    val IMAGEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("ImageId"))
    val INSTANCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("InstanceId"))
    val INSTANCEMONITORING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("InstanceMonitoring"))
    val INSTANCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("InstanceType"))
    val KERNELID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("KernelId"))
    val KEYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("KeyName"))
    val LAUNCHCONFIGURATIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("LaunchConfigurationName"))
    val METADATAOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("MetadataOptions"))
    val PLACEMENTTENANCY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("PlacementTenancy"))
    val RAMDISKID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("RamdiskId"))
    val SECURITYGROUPS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("SecurityGroups"))
    val SPOTPRICE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("SpotPrice"))
    val USERDATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("UserData"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        trait(FormUrlSerialName("CreateLaunchConfigurationType"))
        trait(QueryLiteral("Action", "CreateLaunchConfiguration"))
        trait(QueryLiteral("Version", "2011-01-01"))
        field(ASSOCIATEPUBLICIPADDRESS_DESCRIPTOR)
        field(BLOCKDEVICEMAPPINGS_DESCRIPTOR)
        field(CLASSICLINKVPCID_DESCRIPTOR)
        field(CLASSICLINKVPCSECURITYGROUPS_DESCRIPTOR)
        field(EBSOPTIMIZED_DESCRIPTOR)
        field(IAMINSTANCEPROFILE_DESCRIPTOR)
        field(IMAGEID_DESCRIPTOR)
        field(INSTANCEID_DESCRIPTOR)
        field(INSTANCEMONITORING_DESCRIPTOR)
        field(INSTANCETYPE_DESCRIPTOR)
        field(KERNELID_DESCRIPTOR)
        field(KEYNAME_DESCRIPTOR)
        field(LAUNCHCONFIGURATIONNAME_DESCRIPTOR)
        field(METADATAOPTIONS_DESCRIPTOR)
        field(PLACEMENTTENANCY_DESCRIPTOR)
        field(RAMDISKID_DESCRIPTOR)
        field(SECURITYGROUPS_DESCRIPTOR)
        field(SPOTPRICE_DESCRIPTOR)
        field(USERDATA_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.associatePublicIpAddress?.let { field(ASSOCIATEPUBLICIPADDRESS_DESCRIPTOR, it) }
        if (input.blockDeviceMappings != null) {
            listField(BLOCKDEVICEMAPPINGS_DESCRIPTOR) {
                for (el0 in input.blockDeviceMappings) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeBlockDeviceMappingDocument))
                }
            }
        }
        input.classicLinkVpcId?.let { field(CLASSICLINKVPCID_DESCRIPTOR, it) }
        if (input.classicLinkVpcSecurityGroups != null) {
            listField(CLASSICLINKVPCSECURITYGROUPS_DESCRIPTOR) {
                for (el0 in input.classicLinkVpcSecurityGroups) {
                    serializeString(el0)
                }
            }
        }
        input.ebsOptimized?.let { field(EBSOPTIMIZED_DESCRIPTOR, it) }
        input.iamInstanceProfile?.let { field(IAMINSTANCEPROFILE_DESCRIPTOR, it) }
        input.imageId?.let { field(IMAGEID_DESCRIPTOR, it) }
        input.instanceId?.let { field(INSTANCEID_DESCRIPTOR, it) }
        input.instanceMonitoring?.let { field(INSTANCEMONITORING_DESCRIPTOR, it, ::serializeInstanceMonitoringDocument) }
        input.instanceType?.let { field(INSTANCETYPE_DESCRIPTOR, it) }
        input.kernelId?.let { field(KERNELID_DESCRIPTOR, it) }
        input.keyName?.let { field(KEYNAME_DESCRIPTOR, it) }
        input.launchConfigurationName?.let { field(LAUNCHCONFIGURATIONNAME_DESCRIPTOR, it) }
        input.metadataOptions?.let { field(METADATAOPTIONS_DESCRIPTOR, it, ::serializeInstanceMetadataOptionsDocument) }
        input.placementTenancy?.let { field(PLACEMENTTENANCY_DESCRIPTOR, it) }
        input.ramdiskId?.let { field(RAMDISKID_DESCRIPTOR, it) }
        if (input.securityGroups != null) {
            listField(SECURITYGROUPS_DESCRIPTOR) {
                for (el0 in input.securityGroups) {
                    serializeString(el0)
                }
            }
        }
        input.spotPrice?.let { field(SPOTPRICE_DESCRIPTOR, it) }
        input.userData?.let { field(USERDATA_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy