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

commonMain.aws.sdk.kotlin.services.appstream.transform.CreateApplicationOperationSerializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.99
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.appstream.transform

import aws.sdk.kotlin.services.appstream.model.CreateApplicationRequest
import aws.sdk.kotlin.services.appstream.model.PlatformType
import aws.sdk.kotlin.services.appstream.model.S3Location
import aws.smithy.kotlin.runtime.client.ExecutionContext
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.content.ByteArrayContent
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.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 CreateApplicationOperationSerializer: HttpSerialize {
    override suspend fun serialize(context: ExecutionContext, input: CreateApplicationRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

        builder.url {
            path = "/"
        }

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

private fun serializeCreateApplicationOperationBody(context: ExecutionContext, input: CreateApplicationRequest): ByteArray {
    val serializer = JsonSerializer()
    val APPBLOCKARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AppBlockArn"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val DISPLAYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DisplayName"))
    val ICONS3LOCATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("IconS3Location"))
    val INSTANCEFAMILIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("InstanceFamilies"))
    val LAUNCHPARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LaunchParameters"))
    val LAUNCHPATH_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LaunchPath"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val PLATFORMS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Platforms"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tags"))
    val WORKINGDIRECTORY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("WorkingDirectory"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(APPBLOCKARN_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(DISPLAYNAME_DESCRIPTOR)
        field(ICONS3LOCATION_DESCRIPTOR)
        field(INSTANCEFAMILIES_DESCRIPTOR)
        field(LAUNCHPARAMETERS_DESCRIPTOR)
        field(LAUNCHPATH_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(PLATFORMS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(WORKINGDIRECTORY_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.appBlockArn?.let { field(APPBLOCKARN_DESCRIPTOR, it) }
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        input.displayName?.let { field(DISPLAYNAME_DESCRIPTOR, it) }
        input.iconS3Location?.let { field(ICONS3LOCATION_DESCRIPTOR, it, ::serializeS3LocationDocument) }
        if (input.instanceFamilies != null) {
            listField(INSTANCEFAMILIES_DESCRIPTOR) {
                for (el0 in input.instanceFamilies) {
                    serializeString(el0)
                }
            }
        }
        input.launchParameters?.let { field(LAUNCHPARAMETERS_DESCRIPTOR, it) }
        input.launchPath?.let { field(LAUNCHPATH_DESCRIPTOR, it) }
        input.name?.let { field(NAME_DESCRIPTOR, it) }
        if (input.platforms != null) {
            listField(PLATFORMS_DESCRIPTOR) {
                for (el0 in input.platforms) {
                    serializeString(el0.value)
                }
            }
        }
        if (input.tags != null) {
            mapField(TAGS_DESCRIPTOR) {
                input.tags.forEach { (key, value) -> entry(key, value) }
            }
        }
        input.workingDirectory?.let { field(WORKINGDIRECTORY_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy