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

commonMain.aws.sdk.kotlin.services.gamelift.serde.UpdateGameSessionQueueOperationSerializer.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.gamelift.serde

import aws.sdk.kotlin.services.gamelift.model.FilterConfiguration
import aws.sdk.kotlin.services.gamelift.model.GameSessionQueueDestination
import aws.sdk.kotlin.services.gamelift.model.PlayerLatencyPolicy
import aws.sdk.kotlin.services.gamelift.model.PriorityConfiguration
import aws.sdk.kotlin.services.gamelift.model.UpdateGameSessionQueueRequest
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 UpdateGameSessionQueueOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateGameSessionQueueRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeUpdateGameSessionQueueOperationBody(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 serializeUpdateGameSessionQueueOperationBody(context: ExecutionContext, input: UpdateGameSessionQueueRequest): ByteArray {
    val serializer = JsonSerializer()
    val CUSTOMEVENTDATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CustomEventData"))
    val DESTINATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Destinations"))
    val FILTERCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("FilterConfiguration"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val NOTIFICATIONTARGET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("NotificationTarget"))
    val PLAYERLATENCYPOLICIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("PlayerLatencyPolicies"))
    val PRIORITYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("PriorityConfiguration"))
    val TIMEOUTINSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("TimeoutInSeconds"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CUSTOMEVENTDATA_DESCRIPTOR)
        field(DESTINATIONS_DESCRIPTOR)
        field(FILTERCONFIGURATION_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(NOTIFICATIONTARGET_DESCRIPTOR)
        field(PLAYERLATENCYPOLICIES_DESCRIPTOR)
        field(PRIORITYCONFIGURATION_DESCRIPTOR)
        field(TIMEOUTINSECONDS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.customEventData?.let { field(CUSTOMEVENTDATA_DESCRIPTOR, it) }
        if (input.destinations != null) {
            listField(DESTINATIONS_DESCRIPTOR) {
                for (el0 in input.destinations) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeGameSessionQueueDestinationDocument))
                }
            }
        }
        input.filterConfiguration?.let { field(FILTERCONFIGURATION_DESCRIPTOR, it, ::serializeFilterConfigurationDocument) }
        input.name?.let { field(NAME_DESCRIPTOR, it) }
        input.notificationTarget?.let { field(NOTIFICATIONTARGET_DESCRIPTOR, it) }
        if (input.playerLatencyPolicies != null) {
            listField(PLAYERLATENCYPOLICIES_DESCRIPTOR) {
                for (el0 in input.playerLatencyPolicies) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializePlayerLatencyPolicyDocument))
                }
            }
        }
        input.priorityConfiguration?.let { field(PRIORITYCONFIGURATION_DESCRIPTOR, it, ::serializePriorityConfigurationDocument) }
        input.timeoutInSeconds?.let { field(TIMEOUTINSECONDS_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy