
commonMain.aws.sdk.kotlin.services.opensearch.serde.StartServiceSoftwareUpdateOperationSerializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.opensearch.serde
import aws.sdk.kotlin.services.opensearch.model.ScheduleAt
import aws.sdk.kotlin.services.opensearch.model.StartServiceSoftwareUpdateRequest
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
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.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 StartServiceSoftwareUpdateOperationSerializer: HttpSerialize {
override suspend fun serialize(context: ExecutionContext, input: StartServiceSoftwareUpdateRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/2021-01-01/opensearch/serviceSoftwareUpdate/start"
}
val payload = serializeStartServiceSoftwareUpdateOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/json")
}
return builder
}
}
private fun serializeStartServiceSoftwareUpdateOperationBody(context: ExecutionContext, input: StartServiceSoftwareUpdateRequest): ByteArray {
val serializer = JsonSerializer()
val DESIREDSTARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("DesiredStartTime"))
val DOMAINNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DomainName"))
val SCHEDULEAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ScheduleAt"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(DESIREDSTARTTIME_DESCRIPTOR)
field(DOMAINNAME_DESCRIPTOR)
field(SCHEDULEAT_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.desiredStartTime?.let { field(DESIREDSTARTTIME_DESCRIPTOR, it) }
input.domainName?.let { field(DOMAINNAME_DESCRIPTOR, it) }
input.scheduleAt?.let { field(SCHEDULEAT_DESCRIPTOR, it.value) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy