commonMain.aws.sdk.kotlin.services.configservice.serde.StartResourceEvaluationOperationSerializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.configservice.serde
import aws.sdk.kotlin.services.configservice.model.EvaluationContext
import aws.sdk.kotlin.services.configservice.model.EvaluationMode
import aws.sdk.kotlin.services.configservice.model.ResourceDetails
import aws.sdk.kotlin.services.configservice.model.StartResourceEvaluationRequest
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerialize
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 StartResourceEvaluationOperationSerializer: HttpSerialize {
override suspend fun serialize(context: ExecutionContext, input: StartResourceEvaluationRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path = "/"
}
val payload = serializeStartResourceEvaluationOperationBody(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 serializeStartResourceEvaluationOperationBody(context: ExecutionContext, input: StartResourceEvaluationRequest): ByteArray {
val serializer = JsonSerializer()
val CLIENTTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ClientToken"))
val EVALUATIONCONTEXT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("EvaluationContext"))
val EVALUATIONMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("EvaluationMode"))
val EVALUATIONTIMEOUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("EvaluationTimeout"))
val RESOURCEDETAILS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ResourceDetails"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CLIENTTOKEN_DESCRIPTOR)
field(EVALUATIONCONTEXT_DESCRIPTOR)
field(EVALUATIONMODE_DESCRIPTOR)
field(EVALUATIONTIMEOUT_DESCRIPTOR)
field(RESOURCEDETAILS_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.clientToken?.let { field(CLIENTTOKEN_DESCRIPTOR, it) }
input.evaluationContext?.let { field(EVALUATIONCONTEXT_DESCRIPTOR, it, ::serializeEvaluationContextDocument) }
input.evaluationMode?.let { field(EVALUATIONMODE_DESCRIPTOR, it.value) }
input.evaluationTimeout?.let { field(EVALUATIONTIMEOUT_DESCRIPTOR, it) }
input.resourceDetails?.let { field(RESOURCEDETAILS_DESCRIPTOR, it, ::serializeResourceDetailsDocument) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy