commonMain.aws.sdk.kotlin.services.gamelift.serde.CreateMatchmakingConfigurationOperationSerializer.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.BackfillMode
import aws.sdk.kotlin.services.gamelift.model.CreateMatchmakingConfigurationRequest
import aws.sdk.kotlin.services.gamelift.model.FlexMatchMode
import aws.sdk.kotlin.services.gamelift.model.GameProperty
import aws.sdk.kotlin.services.gamelift.model.Tag
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 CreateMatchmakingConfigurationOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateMatchmakingConfigurationRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeCreateMatchmakingConfigurationOperationBody(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 serializeCreateMatchmakingConfigurationOperationBody(context: ExecutionContext, input: CreateMatchmakingConfigurationRequest): ByteArray {
val serializer = JsonSerializer()
val ACCEPTANCEREQUIRED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("AcceptanceRequired"))
val ACCEPTANCETIMEOUTSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("AcceptanceTimeoutSeconds"))
val ADDITIONALPLAYERCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("AdditionalPlayerCount"))
val BACKFILLMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("BackfillMode"))
val CUSTOMEVENTDATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CustomEventData"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val FLEXMATCHMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("FlexMatchMode"))
val GAMEPROPERTIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("GameProperties"))
val GAMESESSIONDATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GameSessionData"))
val GAMESESSIONQUEUEARNS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("GameSessionQueueArns"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val NOTIFICATIONTARGET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("NotificationTarget"))
val REQUESTTIMEOUTSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("RequestTimeoutSeconds"))
val RULESETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RuleSetName"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Tags"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ACCEPTANCEREQUIRED_DESCRIPTOR)
field(ACCEPTANCETIMEOUTSECONDS_DESCRIPTOR)
field(ADDITIONALPLAYERCOUNT_DESCRIPTOR)
field(BACKFILLMODE_DESCRIPTOR)
field(CUSTOMEVENTDATA_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(FLEXMATCHMODE_DESCRIPTOR)
field(GAMEPROPERTIES_DESCRIPTOR)
field(GAMESESSIONDATA_DESCRIPTOR)
field(GAMESESSIONQUEUEARNS_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(NOTIFICATIONTARGET_DESCRIPTOR)
field(REQUESTTIMEOUTSECONDS_DESCRIPTOR)
field(RULESETNAME_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.acceptanceRequired?.let { field(ACCEPTANCEREQUIRED_DESCRIPTOR, it) }
input.acceptanceTimeoutSeconds?.let { field(ACCEPTANCETIMEOUTSECONDS_DESCRIPTOR, it) }
input.additionalPlayerCount?.let { field(ADDITIONALPLAYERCOUNT_DESCRIPTOR, it) }
input.backfillMode?.let { field(BACKFILLMODE_DESCRIPTOR, it.value) }
input.customEventData?.let { field(CUSTOMEVENTDATA_DESCRIPTOR, it) }
input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
input.flexMatchMode?.let { field(FLEXMATCHMODE_DESCRIPTOR, it.value) }
if (input.gameProperties != null) {
listField(GAMEPROPERTIES_DESCRIPTOR) {
for (el0 in input.gameProperties) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeGamePropertyDocument))
}
}
}
input.gameSessionData?.let { field(GAMESESSIONDATA_DESCRIPTOR, it) }
if (input.gameSessionQueueArns != null) {
listField(GAMESESSIONQUEUEARNS_DESCRIPTOR) {
for (el0 in input.gameSessionQueueArns) {
serializeString(el0)
}
}
}
input.name?.let { field(NAME_DESCRIPTOR, it) }
input.notificationTarget?.let { field(NOTIFICATIONTARGET_DESCRIPTOR, it) }
input.requestTimeoutSeconds?.let { field(REQUESTTIMEOUTSECONDS_DESCRIPTOR, it) }
input.ruleSetName?.let { field(RULESETNAME_DESCRIPTOR, it) }
if (input.tags != null) {
listField(TAGS_DESCRIPTOR) {
for (el0 in input.tags) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
}
}
}
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy