commonMain.aws.sdk.kotlin.services.proton.serde.CreateServiceTemplateVersionOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proton-jvm Show documentation
Show all versions of proton-jvm Show documentation
The AWS SDK for Kotlin client for Proton
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.proton.serde
import aws.sdk.kotlin.services.proton.model.CompatibleEnvironmentTemplateInput
import aws.sdk.kotlin.services.proton.model.CreateServiceTemplateVersionRequest
import aws.sdk.kotlin.services.proton.model.ServiceTemplateSupportedComponentSourceType
import aws.sdk.kotlin.services.proton.model.Tag
import aws.sdk.kotlin.services.proton.model.TemplateVersionSourceInput
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 CreateServiceTemplateVersionOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateServiceTemplateVersionRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeCreateServiceTemplateVersionOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/x-amz-json-1.0")
}
return builder
}
}
private fun serializeCreateServiceTemplateVersionOperationBody(context: ExecutionContext, input: CreateServiceTemplateVersionRequest): ByteArray {
val serializer = JsonSerializer()
val CLIENTTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("clientToken"))
val COMPATIBLEENVIRONMENTTEMPLATES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("compatibleEnvironmentTemplates"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val MAJORVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("majorVersion"))
val SOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("source"))
val SUPPORTEDCOMPONENTSOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("supportedComponentSources"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("tags"))
val TEMPLATENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("templateName"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CLIENTTOKEN_DESCRIPTOR)
field(COMPATIBLEENVIRONMENTTEMPLATES_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(MAJORVERSION_DESCRIPTOR)
field(SOURCE_DESCRIPTOR)
field(SUPPORTEDCOMPONENTSOURCES_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(TEMPLATENAME_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.clientToken?.let { field(CLIENTTOKEN_DESCRIPTOR, it) } ?: field(CLIENTTOKEN_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
listField(COMPATIBLEENVIRONMENTTEMPLATES_DESCRIPTOR) {
for (el0 in input.compatibleEnvironmentTemplates) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeCompatibleEnvironmentTemplateInputDocument))
}
}
input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
input.majorVersion?.let { field(MAJORVERSION_DESCRIPTOR, it) }
input.source?.let { field(SOURCE_DESCRIPTOR, it, ::serializeTemplateVersionSourceInputDocument) }
if (input.supportedComponentSources != null) {
listField(SUPPORTEDCOMPONENTSOURCES_DESCRIPTOR) {
for (el0 in input.supportedComponentSources) {
serializeString(el0.value)
}
}
}
if (input.tags != null) {
listField(TAGS_DESCRIPTOR) {
for (el0 in input.tags) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
}
}
}
field(TEMPLATENAME_DESCRIPTOR, input.templateName)
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy