
commonMain.aws.sdk.kotlin.services.mgn.transform.UpdateLaunchConfigurationOperationSerializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.mgn.transform
import aws.sdk.kotlin.services.mgn.model.BootMode
import aws.sdk.kotlin.services.mgn.model.LaunchDisposition
import aws.sdk.kotlin.services.mgn.model.Licensing
import aws.sdk.kotlin.services.mgn.model.PostLaunchActions
import aws.sdk.kotlin.services.mgn.model.TargetInstanceTypeRightSizingMethod
import aws.sdk.kotlin.services.mgn.model.UpdateLaunchConfigurationRequest
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 UpdateLaunchConfigurationOperationSerializer: HttpSerialize {
override suspend fun serialize(context: ExecutionContext, input: UpdateLaunchConfigurationRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path = "/UpdateLaunchConfiguration"
}
val payload = serializeUpdateLaunchConfigurationOperationBody(context, input)
builder.body = ByteArrayContent(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/json")
}
return builder
}
}
private fun serializeUpdateLaunchConfigurationOperationBody(context: ExecutionContext, input: UpdateLaunchConfigurationRequest): ByteArray {
val serializer = JsonSerializer()
val BOOTMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("bootMode"))
val COPYPRIVATEIP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("copyPrivateIp"))
val COPYTAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("copyTags"))
val LAUNCHDISPOSITION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("launchDisposition"))
val LICENSING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("licensing"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
val POSTLAUNCHACTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("postLaunchActions"))
val SOURCESERVERID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("sourceServerID"))
val TARGETINSTANCETYPERIGHTSIZINGMETHOD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("targetInstanceTypeRightSizingMethod"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(BOOTMODE_DESCRIPTOR)
field(COPYPRIVATEIP_DESCRIPTOR)
field(COPYTAGS_DESCRIPTOR)
field(LAUNCHDISPOSITION_DESCRIPTOR)
field(LICENSING_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(POSTLAUNCHACTIONS_DESCRIPTOR)
field(SOURCESERVERID_DESCRIPTOR)
field(TARGETINSTANCETYPERIGHTSIZINGMETHOD_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.bootMode?.let { field(BOOTMODE_DESCRIPTOR, it.value) }
input.copyPrivateIp?.let { field(COPYPRIVATEIP_DESCRIPTOR, it) }
input.copyTags?.let { field(COPYTAGS_DESCRIPTOR, it) }
input.launchDisposition?.let { field(LAUNCHDISPOSITION_DESCRIPTOR, it.value) }
input.licensing?.let { field(LICENSING_DESCRIPTOR, it, ::serializeLicensingDocument) }
input.name?.let { field(NAME_DESCRIPTOR, it) }
input.postLaunchActions?.let { field(POSTLAUNCHACTIONS_DESCRIPTOR, it, ::serializePostLaunchActionsDocument) }
input.sourceServerId?.let { field(SOURCESERVERID_DESCRIPTOR, it) }
input.targetInstanceTypeRightSizingMethod?.let { field(TARGETINSTANCETYPERIGHTSIZINGMETHOD_DESCRIPTOR, it.value) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy