All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.mediapackage.serde.CreateOriginEndpointOperationSerializer.kt Maven / Gradle / Ivy

The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.mediapackage.serde

import aws.sdk.kotlin.services.mediapackage.model.Authorization
import aws.sdk.kotlin.services.mediapackage.model.CmafPackageCreateOrUpdateParameters
import aws.sdk.kotlin.services.mediapackage.model.CreateOriginEndpointRequest
import aws.sdk.kotlin.services.mediapackage.model.DashPackage
import aws.sdk.kotlin.services.mediapackage.model.HlsPackage
import aws.sdk.kotlin.services.mediapackage.model.MssPackage
import aws.sdk.kotlin.services.mediapackage.model.Origination
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 CreateOriginEndpointOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateOriginEndpointRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

        builder.url {
            path.encoded = "/origin_endpoints"
        }

        val payload = serializeCreateOriginEndpointOperationBody(context, input)
        builder.body = HttpBody.fromBytes(payload)
        if (builder.body !is HttpBody.Empty) {
            builder.headers.setMissing("Content-Type", "application/json")
        }
        return builder
    }
}

private fun serializeCreateOriginEndpointOperationBody(context: ExecutionContext, input: CreateOriginEndpointRequest): ByteArray {
    val serializer = JsonSerializer()
    val AUTHORIZATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("authorization"))
    val CHANNELID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("channelId"))
    val CMAFPACKAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("cmafPackage"))
    val DASHPACKAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("dashPackage"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
    val HLSPACKAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("hlsPackage"))
    val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("id"))
    val MANIFESTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("manifestName"))
    val MSSPACKAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("mssPackage"))
    val ORIGINATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("origination"))
    val STARTOVERWINDOWSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("startoverWindowSeconds"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("tags"))
    val TIMEDELAYSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("timeDelaySeconds"))
    val WHITELIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("whitelist"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(AUTHORIZATION_DESCRIPTOR)
        field(CHANNELID_DESCRIPTOR)
        field(CMAFPACKAGE_DESCRIPTOR)
        field(DASHPACKAGE_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(HLSPACKAGE_DESCRIPTOR)
        field(ID_DESCRIPTOR)
        field(MANIFESTNAME_DESCRIPTOR)
        field(MSSPACKAGE_DESCRIPTOR)
        field(ORIGINATION_DESCRIPTOR)
        field(STARTOVERWINDOWSECONDS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(TIMEDELAYSECONDS_DESCRIPTOR)
        field(WHITELIST_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.authorization?.let { field(AUTHORIZATION_DESCRIPTOR, it, ::serializeAuthorizationDocument) }
        input.channelId?.let { field(CHANNELID_DESCRIPTOR, it) }
        input.cmafPackage?.let { field(CMAFPACKAGE_DESCRIPTOR, it, ::serializeCmafPackageCreateOrUpdateParametersDocument) }
        input.dashPackage?.let { field(DASHPACKAGE_DESCRIPTOR, it, ::serializeDashPackageDocument) }
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        input.hlsPackage?.let { field(HLSPACKAGE_DESCRIPTOR, it, ::serializeHlsPackageDocument) }
        input.id?.let { field(ID_DESCRIPTOR, it) }
        input.manifestName?.let { field(MANIFESTNAME_DESCRIPTOR, it) }
        input.mssPackage?.let { field(MSSPACKAGE_DESCRIPTOR, it, ::serializeMssPackageDocument) }
        input.origination?.let { field(ORIGINATION_DESCRIPTOR, it.value) }
        input.startoverWindowSeconds?.let { field(STARTOVERWINDOWSECONDS_DESCRIPTOR, it) }
        if (input.tags != null) {
            mapField(TAGS_DESCRIPTOR) {
                input.tags.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.timeDelaySeconds?.let { field(TIMEDELAYSECONDS_DESCRIPTOR, it) }
        if (input.whitelist != null) {
            listField(WHITELIST_DESCRIPTOR) {
                for (el0 in input.whitelist) {
                    serializeString(el0)
                }
            }
        }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy