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

commonMain.aws.sdk.kotlin.services.iotfleetwise.serde.CreateCampaignOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.iotfleetwise.serde

import aws.sdk.kotlin.services.iotfleetwise.model.CollectionScheme
import aws.sdk.kotlin.services.iotfleetwise.model.Compression
import aws.sdk.kotlin.services.iotfleetwise.model.CreateCampaignRequest
import aws.sdk.kotlin.services.iotfleetwise.model.DataDestinationConfig
import aws.sdk.kotlin.services.iotfleetwise.model.DiagnosticsMode
import aws.sdk.kotlin.services.iotfleetwise.model.SignalInformation
import aws.sdk.kotlin.services.iotfleetwise.model.SpoolingMode
import aws.sdk.kotlin.services.iotfleetwise.model.Tag
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
import aws.smithy.kotlin.runtime.time.Instant
import aws.smithy.kotlin.runtime.time.TimestampFormat


internal class CreateCampaignOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateCampaignRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

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

private fun serializeCreateCampaignOperationBody(context: ExecutionContext, input: CreateCampaignRequest): ByteArray {
    val serializer = JsonSerializer()
    val COLLECTIONSCHEME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("collectionScheme"))
    val COMPRESSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("compression"))
    val DATADESTINATIONCONFIGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("dataDestinationConfigs"))
    val DATAEXTRADIMENSIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("dataExtraDimensions"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
    val DIAGNOSTICSMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("diagnosticsMode"))
    val EXPIRYTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("expiryTime"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val POSTTRIGGERCOLLECTIONDURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("postTriggerCollectionDuration"))
    val PRIORITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("priority"))
    val SIGNALCATALOGARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("signalCatalogArn"))
    val SIGNALSTOCOLLECT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("signalsToCollect"))
    val SPOOLINGMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("spoolingMode"))
    val STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("startTime"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("tags"))
    val TARGETARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("targetArn"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(COLLECTIONSCHEME_DESCRIPTOR)
        field(COMPRESSION_DESCRIPTOR)
        field(DATADESTINATIONCONFIGS_DESCRIPTOR)
        field(DATAEXTRADIMENSIONS_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(DIAGNOSTICSMODE_DESCRIPTOR)
        field(EXPIRYTIME_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(POSTTRIGGERCOLLECTIONDURATION_DESCRIPTOR)
        field(PRIORITY_DESCRIPTOR)
        field(SIGNALCATALOGARN_DESCRIPTOR)
        field(SIGNALSTOCOLLECT_DESCRIPTOR)
        field(SPOOLINGMODE_DESCRIPTOR)
        field(STARTTIME_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(TARGETARN_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.collectionScheme?.let { field(COLLECTIONSCHEME_DESCRIPTOR, it, ::serializeCollectionSchemeDocument) }
        input.compression?.let { field(COMPRESSION_DESCRIPTOR, it.value) }
        if (input.dataDestinationConfigs != null) {
            listField(DATADESTINATIONCONFIGS_DESCRIPTOR) {
                for (el0 in input.dataDestinationConfigs) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeDataDestinationConfigDocument))
                }
            }
        }
        if (input.dataExtraDimensions != null) {
            listField(DATAEXTRADIMENSIONS_DESCRIPTOR) {
                for (el0 in input.dataExtraDimensions) {
                    serializeString(el0)
                }
            }
        }
        input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
        input.diagnosticsMode?.let { field(DIAGNOSTICSMODE_DESCRIPTOR, it.value) }
        input.expiryTime?.let { field(EXPIRYTIME_DESCRIPTOR, it, TimestampFormat.EPOCH_SECONDS) }
        field(NAME_DESCRIPTOR, input.name)
        input.postTriggerCollectionDuration?.let { field(POSTTRIGGERCOLLECTIONDURATION_DESCRIPTOR, it) }
        input.priority?.let { field(PRIORITY_DESCRIPTOR, it) }
        field(SIGNALCATALOGARN_DESCRIPTOR, input.signalCatalogArn)
        if (input.signalsToCollect != null) {
            listField(SIGNALSTOCOLLECT_DESCRIPTOR) {
                for (el0 in input.signalsToCollect) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeSignalInformationDocument))
                }
            }
        }
        input.spoolingMode?.let { field(SPOOLINGMODE_DESCRIPTOR, it.value) }
        input.startTime?.let { field(STARTTIME_DESCRIPTOR, it, TimestampFormat.EPOCH_SECONDS) }
        if (input.tags != null) {
            listField(TAGS_DESCRIPTOR) {
                for (el0 in input.tags) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
                }
            }
        }
        field(TARGETARN_DESCRIPTOR, input.targetArn)
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy