commonMain.aws.sdk.kotlin.services.snowball.serde.UpdateClusterOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snowball-jvm Show documentation
Show all versions of snowball-jvm Show documentation
The AWS SDK for Kotlin client for Snowball
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.snowball.serde
import aws.sdk.kotlin.services.snowball.model.JobResource
import aws.sdk.kotlin.services.snowball.model.Notification
import aws.sdk.kotlin.services.snowball.model.OnDeviceServiceConfiguration
import aws.sdk.kotlin.services.snowball.model.ShippingOption
import aws.sdk.kotlin.services.snowball.model.UpdateClusterRequest
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 UpdateClusterOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: UpdateClusterRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeUpdateClusterOperationBody(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 serializeUpdateClusterOperationBody(context: ExecutionContext, input: UpdateClusterRequest): ByteArray {
val serializer = JsonSerializer()
val ADDRESSID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AddressId"))
val CLUSTERID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ClusterId"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val FORWARDINGADDRESSID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ForwardingAddressId"))
val NOTIFICATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Notification"))
val ONDEVICESERVICECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("OnDeviceServiceConfiguration"))
val RESOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Resources"))
val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RoleARN"))
val SHIPPINGOPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ShippingOption"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ADDRESSID_DESCRIPTOR)
field(CLUSTERID_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(FORWARDINGADDRESSID_DESCRIPTOR)
field(NOTIFICATION_DESCRIPTOR)
field(ONDEVICESERVICECONFIGURATION_DESCRIPTOR)
field(RESOURCES_DESCRIPTOR)
field(ROLEARN_DESCRIPTOR)
field(SHIPPINGOPTION_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.addressId?.let { field(ADDRESSID_DESCRIPTOR, it) }
input.clusterId?.let { field(CLUSTERID_DESCRIPTOR, it) }
input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
input.forwardingAddressId?.let { field(FORWARDINGADDRESSID_DESCRIPTOR, it) }
input.notification?.let { field(NOTIFICATION_DESCRIPTOR, it, ::serializeNotificationDocument) }
input.onDeviceServiceConfiguration?.let { field(ONDEVICESERVICECONFIGURATION_DESCRIPTOR, it, ::serializeOnDeviceServiceConfigurationDocument) }
input.resources?.let { field(RESOURCES_DESCRIPTOR, it, ::serializeJobResourceDocument) }
input.roleArn?.let { field(ROLEARN_DESCRIPTOR, it) }
input.shippingOption?.let { field(SHIPPINGOPTION_DESCRIPTOR, it.value) }
}
return serializer.toByteArray()
}