commonMain.aws.sdk.kotlin.services.codedeploy.serde.CreateDeploymentOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codedeploy-jvm Show documentation
Show all versions of codedeploy-jvm Show documentation
The AWS SDK for Kotlin client for CodeDeploy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.codedeploy.serde
import aws.sdk.kotlin.services.codedeploy.model.AlarmConfiguration
import aws.sdk.kotlin.services.codedeploy.model.AutoRollbackConfiguration
import aws.sdk.kotlin.services.codedeploy.model.CreateDeploymentRequest
import aws.sdk.kotlin.services.codedeploy.model.FileExistsBehavior
import aws.sdk.kotlin.services.codedeploy.model.RevisionLocation
import aws.sdk.kotlin.services.codedeploy.model.TargetInstances
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 CreateDeploymentOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateDeploymentRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeCreateDeploymentOperationBody(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 serializeCreateDeploymentOperationBody(context: ExecutionContext, input: CreateDeploymentRequest): ByteArray {
val serializer = JsonSerializer()
val APPLICATIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("applicationName"))
val AUTOROLLBACKCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("autoRollbackConfiguration"))
val DEPLOYMENTCONFIGNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("deploymentConfigName"))
val DEPLOYMENTGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("deploymentGroupName"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val FILEEXISTSBEHAVIOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("fileExistsBehavior"))
val IGNOREAPPLICATIONSTOPFAILURES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("ignoreApplicationStopFailures"))
val OVERRIDEALARMCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("overrideAlarmConfiguration"))
val REVISION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("revision"))
val TARGETINSTANCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("targetInstances"))
val UPDATEOUTDATEDINSTANCESONLY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("updateOutdatedInstancesOnly"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(APPLICATIONNAME_DESCRIPTOR)
field(AUTOROLLBACKCONFIGURATION_DESCRIPTOR)
field(DEPLOYMENTCONFIGNAME_DESCRIPTOR)
field(DEPLOYMENTGROUPNAME_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(FILEEXISTSBEHAVIOR_DESCRIPTOR)
field(IGNOREAPPLICATIONSTOPFAILURES_DESCRIPTOR)
field(OVERRIDEALARMCONFIGURATION_DESCRIPTOR)
field(REVISION_DESCRIPTOR)
field(TARGETINSTANCES_DESCRIPTOR)
field(UPDATEOUTDATEDINSTANCESONLY_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.applicationName?.let { field(APPLICATIONNAME_DESCRIPTOR, it) }
input.autoRollbackConfiguration?.let { field(AUTOROLLBACKCONFIGURATION_DESCRIPTOR, it, ::serializeAutoRollbackConfigurationDocument) }
input.deploymentConfigName?.let { field(DEPLOYMENTCONFIGNAME_DESCRIPTOR, it) }
input.deploymentGroupName?.let { field(DEPLOYMENTGROUPNAME_DESCRIPTOR, it) }
input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
input.fileExistsBehavior?.let { field(FILEEXISTSBEHAVIOR_DESCRIPTOR, it.value) }
input.ignoreApplicationStopFailures?.let { field(IGNOREAPPLICATIONSTOPFAILURES_DESCRIPTOR, it) }
input.overrideAlarmConfiguration?.let { field(OVERRIDEALARMCONFIGURATION_DESCRIPTOR, it, ::serializeAlarmConfigurationDocument) }
input.revision?.let { field(REVISION_DESCRIPTOR, it, ::serializeRevisionLocationDocument) }
input.targetInstances?.let { field(TARGETINSTANCES_DESCRIPTOR, it, ::serializeTargetInstancesDocument) }
input.updateOutdatedInstancesOnly?.let { field(UPDATEOUTDATEDINSTANCESONLY_DESCRIPTOR, it) }
}
return serializer.toByteArray()
}