commonMain.aws.sdk.kotlin.services.autoscaling.serde.PutLifecycleHookOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autoscaling-jvm Show documentation
Show all versions of autoscaling-jvm Show documentation
The AWS SDK for Kotlin client for Auto Scaling
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.autoscaling.serde
import aws.sdk.kotlin.services.autoscaling.model.PutLifecycleHookRequest
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.formurl.FormUrlSerialName
import aws.smithy.kotlin.runtime.serde.formurl.FormUrlSerializer
import aws.smithy.kotlin.runtime.serde.formurl.QueryLiteral
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
internal class PutLifecycleHookOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: PutLifecycleHookRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializePutLifecycleHookOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/x-www-form-urlencoded")
}
return builder
}
}
private fun serializePutLifecycleHookOperationBody(context: ExecutionContext, input: PutLifecycleHookRequest): ByteArray {
val serializer = FormUrlSerializer()
val AUTOSCALINGGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("AutoScalingGroupName"))
val DEFAULTRESULT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("DefaultResult"))
val HEARTBEATTIMEOUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, FormUrlSerialName("HeartbeatTimeout"))
val LIFECYCLEHOOKNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("LifecycleHookName"))
val LIFECYCLETRANSITION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("LifecycleTransition"))
val NOTIFICATIONMETADATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("NotificationMetadata"))
val NOTIFICATIONTARGETARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("NotificationTargetARN"))
val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, FormUrlSerialName("RoleARN"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
trait(FormUrlSerialName("PutLifecycleHookType"))
trait(QueryLiteral("Action", "PutLifecycleHook"))
trait(QueryLiteral("Version", "2011-01-01"))
field(AUTOSCALINGGROUPNAME_DESCRIPTOR)
field(DEFAULTRESULT_DESCRIPTOR)
field(HEARTBEATTIMEOUT_DESCRIPTOR)
field(LIFECYCLEHOOKNAME_DESCRIPTOR)
field(LIFECYCLETRANSITION_DESCRIPTOR)
field(NOTIFICATIONMETADATA_DESCRIPTOR)
field(NOTIFICATIONTARGETARN_DESCRIPTOR)
field(ROLEARN_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.autoScalingGroupName?.let { field(AUTOSCALINGGROUPNAME_DESCRIPTOR, it) }
input.defaultResult?.let { field(DEFAULTRESULT_DESCRIPTOR, it) }
input.heartbeatTimeout?.let { field(HEARTBEATTIMEOUT_DESCRIPTOR, it) }
input.lifecycleHookName?.let { field(LIFECYCLEHOOKNAME_DESCRIPTOR, it) }
input.lifecycleTransition?.let { field(LIFECYCLETRANSITION_DESCRIPTOR, it) }
input.notificationMetadata?.let { field(NOTIFICATIONMETADATA_DESCRIPTOR, it) }
input.notificationTargetArn?.let { field(NOTIFICATIONTARGETARN_DESCRIPTOR, it) }
input.roleArn?.let { field(ROLEARN_DESCRIPTOR, it) }
}
return serializer.toByteArray()
}