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

commonMain.aws.sdk.kotlin.services.gamelift.serde.UpdateContainerFleetOperationSerializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.gamelift.serde

import aws.sdk.kotlin.services.gamelift.model.ConnectionPortRange
import aws.sdk.kotlin.services.gamelift.model.ContainerFleetRemoveAttribute
import aws.sdk.kotlin.services.gamelift.model.DeploymentConfiguration
import aws.sdk.kotlin.services.gamelift.model.GameSessionCreationLimitPolicy
import aws.sdk.kotlin.services.gamelift.model.IpPermission
import aws.sdk.kotlin.services.gamelift.model.LogConfiguration
import aws.sdk.kotlin.services.gamelift.model.ProtectionPolicy
import aws.sdk.kotlin.services.gamelift.model.UpdateContainerFleetRequest
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 UpdateContainerFleetOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateContainerFleetRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

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

private fun serializeUpdateContainerFleetOperationBody(context: ExecutionContext, input: UpdateContainerFleetRequest): ByteArray {
    val serializer = JsonSerializer()
    val DEPLOYMENTCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("DeploymentConfiguration"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val FLEETID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FleetId"))
    val GAMESERVERCONTAINERGROUPDEFINITIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GameServerContainerGroupDefinitionName"))
    val GAMESERVERCONTAINERGROUPSPERINSTANCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("GameServerContainerGroupsPerInstance"))
    val GAMESESSIONCREATIONLIMITPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("GameSessionCreationLimitPolicy"))
    val INSTANCECONNECTIONPORTRANGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("InstanceConnectionPortRange"))
    val INSTANCEINBOUNDPERMISSIONAUTHORIZATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("InstanceInboundPermissionAuthorizations"))
    val INSTANCEINBOUNDPERMISSIONREVOCATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("InstanceInboundPermissionRevocations"))
    val LOGCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("LogConfiguration"))
    val METRICGROUPS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("MetricGroups"))
    val NEWGAMESESSIONPROTECTIONPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("NewGameSessionProtectionPolicy"))
    val PERINSTANCECONTAINERGROUPDEFINITIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PerInstanceContainerGroupDefinitionName"))
    val REMOVEATTRIBUTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("RemoveAttributes"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DEPLOYMENTCONFIGURATION_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(FLEETID_DESCRIPTOR)
        field(GAMESERVERCONTAINERGROUPDEFINITIONNAME_DESCRIPTOR)
        field(GAMESERVERCONTAINERGROUPSPERINSTANCE_DESCRIPTOR)
        field(GAMESESSIONCREATIONLIMITPOLICY_DESCRIPTOR)
        field(INSTANCECONNECTIONPORTRANGE_DESCRIPTOR)
        field(INSTANCEINBOUNDPERMISSIONAUTHORIZATIONS_DESCRIPTOR)
        field(INSTANCEINBOUNDPERMISSIONREVOCATIONS_DESCRIPTOR)
        field(LOGCONFIGURATION_DESCRIPTOR)
        field(METRICGROUPS_DESCRIPTOR)
        field(NEWGAMESESSIONPROTECTIONPOLICY_DESCRIPTOR)
        field(PERINSTANCECONTAINERGROUPDEFINITIONNAME_DESCRIPTOR)
        field(REMOVEATTRIBUTES_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.deploymentConfiguration?.let { field(DEPLOYMENTCONFIGURATION_DESCRIPTOR, it, ::serializeDeploymentConfigurationDocument) }
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        input.fleetId?.let { field(FLEETID_DESCRIPTOR, it) }
        input.gameServerContainerGroupDefinitionName?.let { field(GAMESERVERCONTAINERGROUPDEFINITIONNAME_DESCRIPTOR, it) }
        input.gameServerContainerGroupsPerInstance?.let { field(GAMESERVERCONTAINERGROUPSPERINSTANCE_DESCRIPTOR, it) }
        input.gameSessionCreationLimitPolicy?.let { field(GAMESESSIONCREATIONLIMITPOLICY_DESCRIPTOR, it, ::serializeGameSessionCreationLimitPolicyDocument) }
        input.instanceConnectionPortRange?.let { field(INSTANCECONNECTIONPORTRANGE_DESCRIPTOR, it, ::serializeConnectionPortRangeDocument) }
        if (input.instanceInboundPermissionAuthorizations != null) {
            listField(INSTANCEINBOUNDPERMISSIONAUTHORIZATIONS_DESCRIPTOR) {
                for (el0 in input.instanceInboundPermissionAuthorizations) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeIpPermissionDocument))
                }
            }
        }
        if (input.instanceInboundPermissionRevocations != null) {
            listField(INSTANCEINBOUNDPERMISSIONREVOCATIONS_DESCRIPTOR) {
                for (el0 in input.instanceInboundPermissionRevocations) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeIpPermissionDocument))
                }
            }
        }
        input.logConfiguration?.let { field(LOGCONFIGURATION_DESCRIPTOR, it, ::serializeLogConfigurationDocument) }
        if (input.metricGroups != null) {
            listField(METRICGROUPS_DESCRIPTOR) {
                for (el0 in input.metricGroups) {
                    serializeString(el0)
                }
            }
        }
        input.newGameSessionProtectionPolicy?.let { field(NEWGAMESESSIONPROTECTIONPOLICY_DESCRIPTOR, it.value) }
        input.perInstanceContainerGroupDefinitionName?.let { field(PERINSTANCECONTAINERGROUPDEFINITIONNAME_DESCRIPTOR, it) }
        if (input.removeAttributes != null) {
            listField(REMOVEATTRIBUTES_DESCRIPTOR) {
                for (el0 in input.removeAttributes) {
                    serializeString(el0.value)
                }
            }
        }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy