
commonMain.aws.sdk.kotlin.services.gamelift.serde.UpdateGameSessionOperationSerializer.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.GameProperty
import aws.sdk.kotlin.services.gamelift.model.PlayerSessionCreationPolicy
import aws.sdk.kotlin.services.gamelift.model.ProtectionPolicy
import aws.sdk.kotlin.services.gamelift.model.UpdateGameSessionRequest
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerialize
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 UpdateGameSessionOperationSerializer: HttpSerialize {
override suspend fun serialize(context: ExecutionContext, input: UpdateGameSessionRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeUpdateGameSessionOperationBody(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 serializeUpdateGameSessionOperationBody(context: ExecutionContext, input: UpdateGameSessionRequest): ByteArray {
val serializer = JsonSerializer()
val GAMEPROPERTIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("GameProperties"))
val GAMESESSIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GameSessionId"))
val MAXIMUMPLAYERSESSIONCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("MaximumPlayerSessionCount"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val PLAYERSESSIONCREATIONPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PlayerSessionCreationPolicy"))
val PROTECTIONPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ProtectionPolicy"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(GAMEPROPERTIES_DESCRIPTOR)
field(GAMESESSIONID_DESCRIPTOR)
field(MAXIMUMPLAYERSESSIONCOUNT_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(PLAYERSESSIONCREATIONPOLICY_DESCRIPTOR)
field(PROTECTIONPOLICY_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
if (input.gameProperties != null) {
listField(GAMEPROPERTIES_DESCRIPTOR) {
for (el0 in input.gameProperties) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeGamePropertyDocument))
}
}
}
input.gameSessionId?.let { field(GAMESESSIONID_DESCRIPTOR, it) }
input.maximumPlayerSessionCount?.let { field(MAXIMUMPLAYERSESSIONCOUNT_DESCRIPTOR, it) }
input.name?.let { field(NAME_DESCRIPTOR, it) }
input.playerSessionCreationPolicy?.let { field(PLAYERSESSIONCREATIONPOLICY_DESCRIPTOR, it.value) }
input.protectionPolicy?.let { field(PROTECTIONPOLICY_DESCRIPTOR, it.value) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy