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

commonMain.aws.sdk.kotlin.services.autoscaling.serde.CreateAutoScalingGroupOperationSerializer.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.CreateAutoScalingGroupRequest
import aws.sdk.kotlin.services.autoscaling.model.InstanceMaintenancePolicy
import aws.sdk.kotlin.services.autoscaling.model.LaunchTemplateSpecification
import aws.sdk.kotlin.services.autoscaling.model.LifecycleHookSpecification
import aws.sdk.kotlin.services.autoscaling.model.MixedInstancesPolicy
import aws.sdk.kotlin.services.autoscaling.model.Tag
import aws.sdk.kotlin.services.autoscaling.model.TrafficSourceIdentifier
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 CreateAutoScalingGroupOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateAutoScalingGroupRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeCreateAutoScalingGroupOperationBody(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 serializeCreateAutoScalingGroupOperationBody(context: ExecutionContext, input: CreateAutoScalingGroupRequest): ByteArray {
    val serializer = FormUrlSerializer()
    val AUTOSCALINGGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("AutoScalingGroupName"))
    val AVAILABILITYZONES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("AvailabilityZones"))
    val CAPACITYREBALANCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, FormUrlSerialName("CapacityRebalance"))
    val CONTEXT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("Context"))
    val DEFAULTCOOLDOWN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("DefaultCooldown"))
    val DEFAULTINSTANCEWARMUP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("DefaultInstanceWarmup"))
    val DESIREDCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("DesiredCapacity"))
    val DESIREDCAPACITYTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("DesiredCapacityType"))
    val HEALTHCHECKGRACEPERIOD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("HealthCheckGracePeriod"))
    val HEALTHCHECKTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("HealthCheckType"))
    val INSTANCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("InstanceId"))
    val INSTANCEMAINTENANCEPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("InstanceMaintenancePolicy"))
    val LAUNCHCONFIGURATIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("LaunchConfigurationName"))
    val LAUNCHTEMPLATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("LaunchTemplate"))
    val LIFECYCLEHOOKSPECIFICATIONLIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("LifecycleHookSpecificationList"))
    val LOADBALANCERNAMES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("LoadBalancerNames"))
    val MAXINSTANCELIFETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("MaxInstanceLifetime"))
    val MAXSIZE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("MaxSize"))
    val MINSIZE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("MinSize"))
    val MIXEDINSTANCESPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("MixedInstancesPolicy"))
    val NEWINSTANCESPROTECTEDFROMSCALEIN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, FormUrlSerialName("NewInstancesProtectedFromScaleIn"))
    val PLACEMENTGROUP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("PlacementGroup"))
    val SERVICELINKEDROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("ServiceLinkedRoleARN"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("Tags"))
    val TARGETGROUPARNS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("TargetGroupARNs"))
    val TERMINATIONPOLICIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("TerminationPolicies"))
    val TRAFFICSOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("TrafficSources"))
    val VPCZONEIDENTIFIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("VPCZoneIdentifier"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        trait(FormUrlSerialName("CreateAutoScalingGroupType"))
        trait(QueryLiteral("Action", "CreateAutoScalingGroup"))
        trait(QueryLiteral("Version", "2011-01-01"))
        field(AUTOSCALINGGROUPNAME_DESCRIPTOR)
        field(AVAILABILITYZONES_DESCRIPTOR)
        field(CAPACITYREBALANCE_DESCRIPTOR)
        field(CONTEXT_DESCRIPTOR)
        field(DEFAULTCOOLDOWN_DESCRIPTOR)
        field(DEFAULTINSTANCEWARMUP_DESCRIPTOR)
        field(DESIREDCAPACITY_DESCRIPTOR)
        field(DESIREDCAPACITYTYPE_DESCRIPTOR)
        field(HEALTHCHECKGRACEPERIOD_DESCRIPTOR)
        field(HEALTHCHECKTYPE_DESCRIPTOR)
        field(INSTANCEID_DESCRIPTOR)
        field(INSTANCEMAINTENANCEPOLICY_DESCRIPTOR)
        field(LAUNCHCONFIGURATIONNAME_DESCRIPTOR)
        field(LAUNCHTEMPLATE_DESCRIPTOR)
        field(LIFECYCLEHOOKSPECIFICATIONLIST_DESCRIPTOR)
        field(LOADBALANCERNAMES_DESCRIPTOR)
        field(MAXINSTANCELIFETIME_DESCRIPTOR)
        field(MAXSIZE_DESCRIPTOR)
        field(MINSIZE_DESCRIPTOR)
        field(MIXEDINSTANCESPOLICY_DESCRIPTOR)
        field(NEWINSTANCESPROTECTEDFROMSCALEIN_DESCRIPTOR)
        field(PLACEMENTGROUP_DESCRIPTOR)
        field(SERVICELINKEDROLEARN_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(TARGETGROUPARNS_DESCRIPTOR)
        field(TERMINATIONPOLICIES_DESCRIPTOR)
        field(TRAFFICSOURCES_DESCRIPTOR)
        field(VPCZONEIDENTIFIER_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.autoScalingGroupName?.let { field(AUTOSCALINGGROUPNAME_DESCRIPTOR, it) }
        if (input.availabilityZones != null) {
            listField(AVAILABILITYZONES_DESCRIPTOR) {
                for (el0 in input.availabilityZones) {
                    serializeString(el0)
                }
            }
        }
        input.capacityRebalance?.let { field(CAPACITYREBALANCE_DESCRIPTOR, it) }
        input.context?.let { field(CONTEXT_DESCRIPTOR, it) }
        input.defaultCooldown?.let { field(DEFAULTCOOLDOWN_DESCRIPTOR, it) }
        input.defaultInstanceWarmup?.let { field(DEFAULTINSTANCEWARMUP_DESCRIPTOR, it) }
        input.desiredCapacity?.let { field(DESIREDCAPACITY_DESCRIPTOR, it) }
        input.desiredCapacityType?.let { field(DESIREDCAPACITYTYPE_DESCRIPTOR, it) }
        input.healthCheckGracePeriod?.let { field(HEALTHCHECKGRACEPERIOD_DESCRIPTOR, it) }
        input.healthCheckType?.let { field(HEALTHCHECKTYPE_DESCRIPTOR, it) }
        input.instanceId?.let { field(INSTANCEID_DESCRIPTOR, it) }
        input.instanceMaintenancePolicy?.let { field(INSTANCEMAINTENANCEPOLICY_DESCRIPTOR, it, ::serializeInstanceMaintenancePolicyDocument) }
        input.launchConfigurationName?.let { field(LAUNCHCONFIGURATIONNAME_DESCRIPTOR, it) }
        input.launchTemplate?.let { field(LAUNCHTEMPLATE_DESCRIPTOR, it, ::serializeLaunchTemplateSpecificationDocument) }
        if (input.lifecycleHookSpecificationList != null) {
            listField(LIFECYCLEHOOKSPECIFICATIONLIST_DESCRIPTOR) {
                for (el0 in input.lifecycleHookSpecificationList) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeLifecycleHookSpecificationDocument))
                }
            }
        }
        if (input.loadBalancerNames != null) {
            listField(LOADBALANCERNAMES_DESCRIPTOR) {
                for (el0 in input.loadBalancerNames) {
                    serializeString(el0)
                }
            }
        }
        input.maxInstanceLifetime?.let { field(MAXINSTANCELIFETIME_DESCRIPTOR, it) }
        input.maxSize?.let { field(MAXSIZE_DESCRIPTOR, it) }
        input.minSize?.let { field(MINSIZE_DESCRIPTOR, it) }
        input.mixedInstancesPolicy?.let { field(MIXEDINSTANCESPOLICY_DESCRIPTOR, it, ::serializeMixedInstancesPolicyDocument) }
        input.newInstancesProtectedFromScaleIn?.let { field(NEWINSTANCESPROTECTEDFROMSCALEIN_DESCRIPTOR, it) }
        input.placementGroup?.let { field(PLACEMENTGROUP_DESCRIPTOR, it) }
        input.serviceLinkedRoleArn?.let { field(SERVICELINKEDROLEARN_DESCRIPTOR, it) }
        if (input.tags != null) {
            listField(TAGS_DESCRIPTOR) {
                for (el0 in input.tags) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
                }
            }
        }
        if (input.targetGroupArns != null) {
            listField(TARGETGROUPARNS_DESCRIPTOR) {
                for (el0 in input.targetGroupArns) {
                    serializeString(el0)
                }
            }
        }
        if (input.terminationPolicies != null) {
            listField(TERMINATIONPOLICIES_DESCRIPTOR) {
                for (el0 in input.terminationPolicies) {
                    serializeString(el0)
                }
            }
        }
        if (input.trafficSources != null) {
            listField(TRAFFICSOURCES_DESCRIPTOR) {
                for (el0 in input.trafficSources) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeTrafficSourceIdentifierDocument))
                }
            }
        }
        input.vpcZoneIdentifier?.let { field(VPCZONEIDENTIFIER_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy