commonMain.aws.sdk.kotlin.services.gamelift.serde.CreateGameSessionOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gamelift-jvm Show documentation
Show all versions of gamelift-jvm Show documentation
The AWS SDK for Kotlin client for GameLift
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.gamelift.serde
import aws.sdk.kotlin.services.gamelift.model.CreateGameSessionRequest
import aws.sdk.kotlin.services.gamelift.model.GameProperty
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 CreateGameSessionOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateGameSessionRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeCreateGameSessionOperationBody(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 serializeCreateGameSessionOperationBody(context: ExecutionContext, input: CreateGameSessionRequest): ByteArray {
val serializer = JsonSerializer()
val ALIASID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AliasId"))
val CREATORID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CreatorId"))
val FLEETID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FleetId"))
val GAMEPROPERTIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("GameProperties"))
val GAMESESSIONDATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GameSessionData"))
val GAMESESSIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GameSessionId"))
val IDEMPOTENCYTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("IdempotencyToken"))
val LOCATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Location"))
val MAXIMUMPLAYERSESSIONCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MaximumPlayerSessionCount"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ALIASID_DESCRIPTOR)
field(CREATORID_DESCRIPTOR)
field(FLEETID_DESCRIPTOR)
field(GAMEPROPERTIES_DESCRIPTOR)
field(GAMESESSIONDATA_DESCRIPTOR)
field(GAMESESSIONID_DESCRIPTOR)
field(IDEMPOTENCYTOKEN_DESCRIPTOR)
field(LOCATION_DESCRIPTOR)
field(MAXIMUMPLAYERSESSIONCOUNT_DESCRIPTOR)
field(NAME_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.aliasId?.let { field(ALIASID_DESCRIPTOR, it) }
input.creatorId?.let { field(CREATORID_DESCRIPTOR, it) }
input.fleetId?.let { field(FLEETID_DESCRIPTOR, it) }
if (input.gameProperties != null) {
listField(GAMEPROPERTIES_DESCRIPTOR) {
for (el0 in input.gameProperties) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeGamePropertyDocument))
}
}
}
input.gameSessionData?.let { field(GAMESESSIONDATA_DESCRIPTOR, it) }
input.gameSessionId?.let { field(GAMESESSIONID_DESCRIPTOR, it) }
input.idempotencyToken?.let { field(IDEMPOTENCYTOKEN_DESCRIPTOR, it) }
input.location?.let { field(LOCATION_DESCRIPTOR, it) }
input.maximumPlayerSessionCount?.let { field(MAXIMUMPLAYERSESSIONCOUNT_DESCRIPTOR, it) }
input.name?.let { field(NAME_DESCRIPTOR, it) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy