All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
commonMain.aws.sdk.kotlin.services.glue.serde.CreateSessionOperationSerializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.glue.serde
import aws.sdk.kotlin.services.glue.model.ConnectionsList
import aws.sdk.kotlin.services.glue.model.CreateSessionRequest
import aws.sdk.kotlin.services.glue.model.SessionCommand
import aws.sdk.kotlin.services.glue.model.WorkerType
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 CreateSessionOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateSessionRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeCreateSessionOperationBody(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 serializeCreateSessionOperationBody(context: ExecutionContext, input: CreateSessionRequest): ByteArray {
val serializer = JsonSerializer()
val COMMAND_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Command"))
val CONNECTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Connections"))
val DEFAULTARGUMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("DefaultArguments"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val GLUEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GlueVersion"))
val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Id"))
val IDLETIMEOUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("IdleTimeout"))
val MAXCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("MaxCapacity"))
val NUMBEROFWORKERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("NumberOfWorkers"))
val REQUESTORIGIN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RequestOrigin"))
val ROLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Role"))
val SECURITYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SecurityConfiguration"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tags"))
val TIMEOUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Timeout"))
val WORKERTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("WorkerType"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(COMMAND_DESCRIPTOR)
field(CONNECTIONS_DESCRIPTOR)
field(DEFAULTARGUMENTS_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(GLUEVERSION_DESCRIPTOR)
field(ID_DESCRIPTOR)
field(IDLETIMEOUT_DESCRIPTOR)
field(MAXCAPACITY_DESCRIPTOR)
field(NUMBEROFWORKERS_DESCRIPTOR)
field(REQUESTORIGIN_DESCRIPTOR)
field(ROLE_DESCRIPTOR)
field(SECURITYCONFIGURATION_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(TIMEOUT_DESCRIPTOR)
field(WORKERTYPE_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.command?.let { field(COMMAND_DESCRIPTOR, it, ::serializeSessionCommandDocument) }
input.connections?.let { field(CONNECTIONS_DESCRIPTOR, it, ::serializeConnectionsListDocument) }
if (input.defaultArguments != null) {
mapField(DEFAULTARGUMENTS_DESCRIPTOR) {
input.defaultArguments.forEach { (key, value) ->
entry(key, value)
}
}
}
input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
input.glueVersion?.let { field(GLUEVERSION_DESCRIPTOR, it) }
input.id?.let { field(ID_DESCRIPTOR, it) }
input.idleTimeout?.let { field(IDLETIMEOUT_DESCRIPTOR, it) }
input.maxCapacity?.let { field(MAXCAPACITY_DESCRIPTOR, it) }
input.numberOfWorkers?.let { field(NUMBEROFWORKERS_DESCRIPTOR, it) }
input.requestOrigin?.let { field(REQUESTORIGIN_DESCRIPTOR, it) }
input.role?.let { field(ROLE_DESCRIPTOR, it) }
input.securityConfiguration?.let { field(SECURITYCONFIGURATION_DESCRIPTOR, it) }
if (input.tags != null) {
mapField(TAGS_DESCRIPTOR) {
input.tags.forEach { (key, value) ->
entry(key, value)
}
}
}
input.timeout?.let { field(TIMEOUT_DESCRIPTOR, it) }
input.workerType?.let { field(WORKERTYPE_DESCRIPTOR, it.value) }
}
return serializer.toByteArray()
}