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

commonMain.aws.sdk.kotlin.services.appstream.serde.CreateStackOperationSerializer.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.serde

import aws.sdk.kotlin.services.appstream.model.AccessEndpoint
import aws.sdk.kotlin.services.appstream.model.ApplicationSettings
import aws.sdk.kotlin.services.appstream.model.CreateStackRequest
import aws.sdk.kotlin.services.appstream.model.StorageConnector
import aws.sdk.kotlin.services.appstream.model.StreamingExperienceSettings
import aws.sdk.kotlin.services.appstream.model.UserSetting
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
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.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 CreateStackOperationSerializer: HttpSerialize {
    override suspend fun serialize(context: ExecutionContext, input: CreateStackRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeCreateStackOperationBody(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 serializeCreateStackOperationBody(context: ExecutionContext, input: CreateStackRequest): ByteArray {
    val serializer = JsonSerializer()
    val ACCESSENDPOINTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AccessEndpoints"))
    val APPLICATIONSETTINGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ApplicationSettings"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val DISPLAYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DisplayName"))
    val EMBEDHOSTDOMAINS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("EmbedHostDomains"))
    val FEEDBACKURL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FeedbackURL"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val REDIRECTURL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RedirectURL"))
    val STORAGECONNECTORS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("StorageConnectors"))
    val STREAMINGEXPERIENCESETTINGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("StreamingExperienceSettings"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tags"))
    val USERSETTINGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("UserSettings"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACCESSENDPOINTS_DESCRIPTOR)
        field(APPLICATIONSETTINGS_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(DISPLAYNAME_DESCRIPTOR)
        field(EMBEDHOSTDOMAINS_DESCRIPTOR)
        field(FEEDBACKURL_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(REDIRECTURL_DESCRIPTOR)
        field(STORAGECONNECTORS_DESCRIPTOR)
        field(STREAMINGEXPERIENCESETTINGS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(USERSETTINGS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        if (input.accessEndpoints != null) {
            listField(ACCESSENDPOINTS_DESCRIPTOR) {
                for (el0 in input.accessEndpoints) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeAccessEndpointDocument))
                }
            }
        }
        input.applicationSettings?.let { field(APPLICATIONSETTINGS_DESCRIPTOR, it, ::serializeApplicationSettingsDocument) }
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        input.displayName?.let { field(DISPLAYNAME_DESCRIPTOR, it) }
        if (input.embedHostDomains != null) {
            listField(EMBEDHOSTDOMAINS_DESCRIPTOR) {
                for (el0 in input.embedHostDomains) {
                    serializeString(el0)
                }
            }
        }
        input.feedbackUrl?.let { field(FEEDBACKURL_DESCRIPTOR, it) }
        input.name?.let { field(NAME_DESCRIPTOR, it) }
        input.redirectUrl?.let { field(REDIRECTURL_DESCRIPTOR, it) }
        if (input.storageConnectors != null) {
            listField(STORAGECONNECTORS_DESCRIPTOR) {
                for (el0 in input.storageConnectors) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeStorageConnectorDocument))
                }
            }
        }
        input.streamingExperienceSettings?.let { field(STREAMINGEXPERIENCESETTINGS_DESCRIPTOR, it, ::serializeStreamingExperienceSettingsDocument) }
        if (input.tags != null) {
            mapField(TAGS_DESCRIPTOR) {
                input.tags.forEach { (key, value) -> entry(key, value) }
            }
        }
        if (input.userSettings != null) {
            listField(USERSETTINGS_DESCRIPTOR) {
                for (el0 in input.userSettings) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeUserSettingDocument))
                }
            }
        }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy