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

commonMain.aws.sdk.kotlin.services.appstream.transform.CreateStreamingURLOperationSerializer.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.CreateStreamingUrlRequest
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.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 CreateStreamingURLOperationSerializer: HttpSerialize {
    override suspend fun serialize(context: ExecutionContext, input: CreateStreamingUrlRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

        builder.url {
            path = "/"
        }

        val payload = serializeCreateStreamingURLOperationBody(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 serializeCreateStreamingURLOperationBody(context: ExecutionContext, input: CreateStreamingUrlRequest): ByteArray {
    val serializer = JsonSerializer()
    val APPLICATIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ApplicationId"))
    val FLEETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FleetName"))
    val SESSIONCONTEXT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SessionContext"))
    val STACKNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StackName"))
    val USERID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("UserId"))
    val VALIDITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("Validity"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(APPLICATIONID_DESCRIPTOR)
        field(FLEETNAME_DESCRIPTOR)
        field(SESSIONCONTEXT_DESCRIPTOR)
        field(STACKNAME_DESCRIPTOR)
        field(USERID_DESCRIPTOR)
        field(VALIDITY_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.applicationId?.let { field(APPLICATIONID_DESCRIPTOR, it) }
        input.fleetName?.let { field(FLEETNAME_DESCRIPTOR, it) }
        input.sessionContext?.let { field(SESSIONCONTEXT_DESCRIPTOR, it) }
        input.stackName?.let { field(STACKNAME_DESCRIPTOR, it) }
        input.userId?.let { field(USERID_DESCRIPTOR, it) }
        input.validity?.let { field(VALIDITY_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy