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

commonMain.aws.sdk.kotlin.services.autoscaling.serde.UpdateAutoScalingGroupOperationSerializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.35
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.InstanceMaintenancePolicy
import aws.sdk.kotlin.services.autoscaling.model.LaunchTemplateSpecification
import aws.sdk.kotlin.services.autoscaling.model.MixedInstancesPolicy
import aws.sdk.kotlin.services.autoscaling.model.UpdateAutoScalingGroupRequest
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 UpdateAutoScalingGroupOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateAutoScalingGroupRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeUpdateAutoScalingGroupOperationBody(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 serializeUpdateAutoScalingGroupOperationBody(context: ExecutionContext, input: UpdateAutoScalingGroupRequest): 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 INSTANCEMAINTENANCEPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("InstanceMaintenancePolicy"))
    val LAUNCHCONFIGURATIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("LaunchConfigurationName"))
    val LAUNCHTEMPLATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, FormUrlSerialName("LaunchTemplate"))
    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 TERMINATIONPOLICIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, FormUrlSerialName("TerminationPolicies"))
    val VPCZONEIDENTIFIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("VPCZoneIdentifier"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        trait(FormUrlSerialName("UpdateAutoScalingGroupType"))
        trait(QueryLiteral("Action", "UpdateAutoScalingGroup"))
        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(INSTANCEMAINTENANCEPOLICY_DESCRIPTOR)
        field(LAUNCHCONFIGURATIONNAME_DESCRIPTOR)
        field(LAUNCHTEMPLATE_DESCRIPTOR)
        field(MAXINSTANCELIFETIME_DESCRIPTOR)
        field(MAXSIZE_DESCRIPTOR)
        field(MINSIZE_DESCRIPTOR)
        field(MIXEDINSTANCESPOLICY_DESCRIPTOR)
        field(NEWINSTANCESPROTECTEDFROMSCALEIN_DESCRIPTOR)
        field(PLACEMENTGROUP_DESCRIPTOR)
        field(SERVICELINKEDROLEARN_DESCRIPTOR)
        field(TERMINATIONPOLICIES_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.instanceMaintenancePolicy?.let { field(INSTANCEMAINTENANCEPOLICY_DESCRIPTOR, it, ::serializeInstanceMaintenancePolicyDocument) }
        input.launchConfigurationName?.let { field(LAUNCHCONFIGURATIONNAME_DESCRIPTOR, it) }
        input.launchTemplate?.let { field(LAUNCHTEMPLATE_DESCRIPTOR, it, ::serializeLaunchTemplateSpecificationDocument) }
        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.terminationPolicies != null) {
            listField(TERMINATIONPOLICIES_DESCRIPTOR) {
                for (el0 in input.terminationPolicies) {
                    serializeString(el0)
                }
            }
        }
        input.vpcZoneIdentifier?.let { field(VPCZONEIDENTIFIER_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy