commonMain.aws.sdk.kotlin.services.lexmodelbuildingservice.serde.PutBotOperationSerializer.kt Maven / Gradle / Ivy
The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.lexmodelbuildingservice.serde
import aws.sdk.kotlin.services.lexmodelbuildingservice.model.Intent
import aws.sdk.kotlin.services.lexmodelbuildingservice.model.Locale
import aws.sdk.kotlin.services.lexmodelbuildingservice.model.ProcessBehavior
import aws.sdk.kotlin.services.lexmodelbuildingservice.model.Prompt
import aws.sdk.kotlin.services.lexmodelbuildingservice.model.PutBotRequest
import aws.sdk.kotlin.services.lexmodelbuildingservice.model.Statement
import aws.sdk.kotlin.services.lexmodelbuildingservice.model.Tag
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 PutBotOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: PutBotRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.PUT
builder.url {
requireNotNull(input.name) { "name is bound to the URI and must not be null" }
path.encodedSegments {
add(PercentEncoding.Path.encode("bots"))
add(PercentEncoding.SmithyLabel.encode(input.name))
add(PercentEncoding.Path.encode("versions"))
add(PercentEncoding.Path.encode("\$LATEST"))
}
}
val payload = serializePutBotOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/json")
}
return builder
}
}
private fun serializePutBotOperationBody(context: ExecutionContext, input: PutBotRequest): ByteArray {
val serializer = JsonSerializer()
val ABORTSTATEMENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("abortStatement"))
val CHECKSUM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("checksum"))
val CHILDDIRECTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("childDirected"))
val CLARIFICATIONPROMPT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("clarificationPrompt"))
val CREATEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("createVersion"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val DETECTSENTIMENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("detectSentiment"))
val ENABLEMODELIMPROVEMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("enableModelImprovements"))
val IDLESESSIONTTLINSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("idleSessionTTLInSeconds"))
val INTENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("intents"))
val LOCALE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("locale"))
val NLUINTENTCONFIDENCETHRESHOLD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("nluIntentConfidenceThreshold"))
val PROCESSBEHAVIOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("processBehavior"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("tags"))
val VOICEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("voiceId"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ABORTSTATEMENT_DESCRIPTOR)
field(CHECKSUM_DESCRIPTOR)
field(CHILDDIRECTED_DESCRIPTOR)
field(CLARIFICATIONPROMPT_DESCRIPTOR)
field(CREATEVERSION_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(DETECTSENTIMENT_DESCRIPTOR)
field(ENABLEMODELIMPROVEMENTS_DESCRIPTOR)
field(IDLESESSIONTTLINSECONDS_DESCRIPTOR)
field(INTENTS_DESCRIPTOR)
field(LOCALE_DESCRIPTOR)
field(NLUINTENTCONFIDENCETHRESHOLD_DESCRIPTOR)
field(PROCESSBEHAVIOR_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(VOICEID_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.abortStatement?.let { field(ABORTSTATEMENT_DESCRIPTOR, it, ::serializeStatementDocument) }
input.checksum?.let { field(CHECKSUM_DESCRIPTOR, it) }
input.childDirected?.let { field(CHILDDIRECTED_DESCRIPTOR, it) }
input.clarificationPrompt?.let { field(CLARIFICATIONPROMPT_DESCRIPTOR, it, ::serializePromptDocument) }
input.createVersion?.let { field(CREATEVERSION_DESCRIPTOR, it) }
input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
input.detectSentiment?.let { field(DETECTSENTIMENT_DESCRIPTOR, it) }
input.enableModelImprovements?.let { field(ENABLEMODELIMPROVEMENTS_DESCRIPTOR, it) }
input.idleSessionTtlInSeconds?.let { field(IDLESESSIONTTLINSECONDS_DESCRIPTOR, it) }
if (input.intents != null) {
listField(INTENTS_DESCRIPTOR) {
for (el0 in input.intents) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeIntentDocument))
}
}
}
input.locale?.let { field(LOCALE_DESCRIPTOR, it.value) }
input.nluIntentConfidenceThreshold?.let { field(NLUINTENTCONFIDENCETHRESHOLD_DESCRIPTOR, it) }
input.processBehavior?.let { field(PROCESSBEHAVIOR_DESCRIPTOR, it.value) }
if (input.tags != null) {
listField(TAGS_DESCRIPTOR) {
for (el0 in input.tags) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
}
}
}
input.voiceId?.let { field(VOICEID_DESCRIPTOR, it) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy