
commonMain.aws.sdk.kotlin.services.honeycode.serde.InvokeScreenAutomationOperationSerializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.honeycode.serde
import aws.sdk.kotlin.services.honeycode.model.InvokeScreenAutomationRequest
import aws.sdk.kotlin.services.honeycode.model.VariableValue
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
import aws.smithy.kotlin.runtime.text.encoding.PercentEncoding
internal class InvokeScreenAutomationOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: InvokeScreenAutomationRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
requireNotNull(input.workbookId) { "workbookId is bound to the URI and must not be null" }
requireNotNull(input.appId) { "appId is bound to the URI and must not be null" }
requireNotNull(input.screenId) { "screenId is bound to the URI and must not be null" }
requireNotNull(input.screenAutomationId) { "screenAutomationId is bound to the URI and must not be null" }
path.encodedSegments {
add(PercentEncoding.Path.encode("workbooks"))
add(PercentEncoding.SmithyLabel.encode("${input.workbookId}"))
add(PercentEncoding.Path.encode("apps"))
add(PercentEncoding.SmithyLabel.encode("${input.appId}"))
add(PercentEncoding.Path.encode("screens"))
add(PercentEncoding.SmithyLabel.encode("${input.screenId}"))
add(PercentEncoding.Path.encode("automations"))
add(PercentEncoding.SmithyLabel.encode("${input.screenAutomationId}"))
}
}
val payload = serializeInvokeScreenAutomationOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/json")
}
return builder
}
}
private fun serializeInvokeScreenAutomationOperationBody(context: ExecutionContext, input: InvokeScreenAutomationRequest): ByteArray {
val serializer = JsonSerializer()
val CLIENTREQUESTTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("clientRequestToken"))
val ROWID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("rowId"))
val VARIABLES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("variables"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CLIENTREQUESTTOKEN_DESCRIPTOR)
field(ROWID_DESCRIPTOR)
field(VARIABLES_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.clientRequestToken?.let { field(CLIENTREQUESTTOKEN_DESCRIPTOR, it) }
input.rowId?.let { field(ROWID_DESCRIPTOR, it) }
if (input.variables != null) {
mapField(VARIABLES_DESCRIPTOR) {
input.variables.forEach { (key, value) -> entry(key, asSdkSerializable(value, ::serializeVariableValueDocument)) }
}
}
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy