
commonMain.aws.sdk.kotlin.services.bedrockdataautomationruntime.serde.InvokeDataAutomationAsyncOperationSerializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrockdataautomationruntime.serde
import aws.sdk.kotlin.services.bedrockdataautomationruntime.model.Blueprint
import aws.sdk.kotlin.services.bedrockdataautomationruntime.model.DataAutomationConfiguration
import aws.sdk.kotlin.services.bedrockdataautomationruntime.model.EncryptionConfiguration
import aws.sdk.kotlin.services.bedrockdataautomationruntime.model.InputConfiguration
import aws.sdk.kotlin.services.bedrockdataautomationruntime.model.InvokeDataAutomationAsyncRequest
import aws.sdk.kotlin.services.bedrockdataautomationruntime.model.NotificationConfiguration
import aws.sdk.kotlin.services.bedrockdataautomationruntime.model.OutputConfiguration
import aws.smithy.kotlin.runtime.client.idempotencyTokenProvider
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 InvokeDataAutomationAsyncOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: InvokeDataAutomationAsyncRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeInvokeDataAutomationAsyncOperationBody(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 serializeInvokeDataAutomationAsyncOperationBody(context: ExecutionContext, input: InvokeDataAutomationAsyncRequest): ByteArray {
val serializer = JsonSerializer()
val BLUEPRINTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("blueprints"))
val CLIENTTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("clientToken"))
val DATAAUTOMATIONCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("dataAutomationConfiguration"))
val ENCRYPTIONCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("encryptionConfiguration"))
val INPUTCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("inputConfiguration"))
val NOTIFICATIONCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("notificationConfiguration"))
val OUTPUTCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("outputConfiguration"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(BLUEPRINTS_DESCRIPTOR)
field(CLIENTTOKEN_DESCRIPTOR)
field(DATAAUTOMATIONCONFIGURATION_DESCRIPTOR)
field(ENCRYPTIONCONFIGURATION_DESCRIPTOR)
field(INPUTCONFIGURATION_DESCRIPTOR)
field(NOTIFICATIONCONFIGURATION_DESCRIPTOR)
field(OUTPUTCONFIGURATION_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
if (input.blueprints != null) {
listField(BLUEPRINTS_DESCRIPTOR) {
for (el0 in input.blueprints) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeBlueprintDocument))
}
}
}
input.clientToken?.let { field(CLIENTTOKEN_DESCRIPTOR, it) } ?: field(CLIENTTOKEN_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
input.dataAutomationConfiguration?.let { field(DATAAUTOMATIONCONFIGURATION_DESCRIPTOR, it, ::serializeDataAutomationConfigurationDocument) }
input.encryptionConfiguration?.let { field(ENCRYPTIONCONFIGURATION_DESCRIPTOR, it, ::serializeEncryptionConfigurationDocument) }
input.inputConfiguration?.let { field(INPUTCONFIGURATION_DESCRIPTOR, it, ::serializeInputConfigurationDocument) }
input.notificationConfiguration?.let { field(NOTIFICATIONCONFIGURATION_DESCRIPTOR, it, ::serializeNotificationConfigurationDocument) }
input.outputConfiguration?.let { field(OUTPUTCONFIGURATION_DESCRIPTOR, it, ::serializeOutputConfigurationDocument) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy