commonMain.aws.sdk.kotlin.services.elastictranscoder.serde.CreateJobOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elastictranscoder-jvm Show documentation
Show all versions of elastictranscoder-jvm Show documentation
The AWS SDK for Kotlin client for Elastic Transcoder
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.elastictranscoder.serde
import aws.sdk.kotlin.services.elastictranscoder.model.CreateJobOutput
import aws.sdk.kotlin.services.elastictranscoder.model.CreateJobPlaylist
import aws.sdk.kotlin.services.elastictranscoder.model.CreateJobRequest
import aws.sdk.kotlin.services.elastictranscoder.model.JobInput
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 CreateJobOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateJobRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/2012-09-25/jobs"
}
val payload = serializeCreateJobOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/json")
}
return builder
}
}
private fun serializeCreateJobOperationBody(context: ExecutionContext, input: CreateJobRequest): ByteArray {
val serializer = JsonSerializer()
val INPUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Input"))
val INPUTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Inputs"))
val OUTPUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Output"))
val OUTPUTKEYPREFIX_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OutputKeyPrefix"))
val OUTPUTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Outputs"))
val PIPELINEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PipelineId"))
val PLAYLISTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Playlists"))
val USERMETADATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("UserMetadata"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(INPUT_DESCRIPTOR)
field(INPUTS_DESCRIPTOR)
field(OUTPUT_DESCRIPTOR)
field(OUTPUTKEYPREFIX_DESCRIPTOR)
field(OUTPUTS_DESCRIPTOR)
field(PIPELINEID_DESCRIPTOR)
field(PLAYLISTS_DESCRIPTOR)
field(USERMETADATA_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.input?.let { field(INPUT_DESCRIPTOR, it, ::serializeJobInputDocument) }
if (input.inputs != null) {
listField(INPUTS_DESCRIPTOR) {
for (el0 in input.inputs) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeJobInputDocument))
}
}
}
input.output?.let { field(OUTPUT_DESCRIPTOR, it, ::serializeCreateJobOutputDocument) }
input.outputKeyPrefix?.let { field(OUTPUTKEYPREFIX_DESCRIPTOR, it) }
if (input.outputs != null) {
listField(OUTPUTS_DESCRIPTOR) {
for (el0 in input.outputs) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeCreateJobOutputDocument))
}
}
}
input.pipelineId?.let { field(PIPELINEID_DESCRIPTOR, it) }
if (input.playlists != null) {
listField(PLAYLISTS_DESCRIPTOR) {
for (el0 in input.playlists) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeCreateJobPlaylistDocument))
}
}
}
if (input.userMetadata != null) {
mapField(USERMETADATA_DESCRIPTOR) {
input.userMetadata.forEach { (key, value) ->
entry(key, value)
}
}
}
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy