
commonMain.aws.sdk.kotlin.services.cloudfront.serde.UpdateFieldLevelEncryptionConfigOperationSerializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.cloudfront.serde
import aws.sdk.kotlin.services.cloudfront.model.FieldLevelEncryptionConfig
import aws.sdk.kotlin.services.cloudfront.model.UpdateFieldLevelEncryptionConfigRequest
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.headers
import aws.smithy.kotlin.runtime.http.request.url
import aws.smithy.kotlin.runtime.operation.ExecutionContext
import aws.smithy.kotlin.runtime.text.encoding.PercentEncoding
internal class UpdateFieldLevelEncryptionConfigOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: UpdateFieldLevelEncryptionConfigRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.PUT
builder.url {
requireNotNull(input.id) { "id is bound to the URI and must not be null" }
path.encodedSegments {
add(PercentEncoding.Path.encode("2020-05-31"))
add(PercentEncoding.Path.encode("field-level-encryption"))
add(PercentEncoding.SmithyLabel.encode(input.id))
add(PercentEncoding.Path.encode("config"))
}
}
builder.headers {
if (input.ifMatch?.isNotEmpty() == true) append("If-Match", input.ifMatch)
}
if (input.fieldLevelEncryptionConfig != null) {
val payload = serializeFieldLevelEncryptionConfigPayloadWithXmlNameFieldLevelEncryptionConfig(input.fieldLevelEncryptionConfig)
builder.body = HttpBody.fromBytes(payload)
}
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/xml")
}
return builder
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy