commonMain.aws.sdk.kotlin.services.glue.serde.UpdateJobFromSourceControlOperationSerializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.glue.serde
import aws.sdk.kotlin.services.glue.model.SourceControlAuthStrategy
import aws.sdk.kotlin.services.glue.model.SourceControlProvider
import aws.sdk.kotlin.services.glue.model.UpdateJobFromSourceControlRequest
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 UpdateJobFromSourceControlOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: UpdateJobFromSourceControlRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeUpdateJobFromSourceControlOperationBody(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 serializeUpdateJobFromSourceControlOperationBody(context: ExecutionContext, input: UpdateJobFromSourceControlRequest): ByteArray {
val serializer = JsonSerializer()
val AUTHSTRATEGY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("AuthStrategy"))
val AUTHTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AuthToken"))
val BRANCHNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("BranchName"))
val COMMITID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CommitId"))
val FOLDER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Folder"))
val JOBNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("JobName"))
val PROVIDER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Provider"))
val REPOSITORYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RepositoryName"))
val REPOSITORYOWNER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RepositoryOwner"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AUTHSTRATEGY_DESCRIPTOR)
field(AUTHTOKEN_DESCRIPTOR)
field(BRANCHNAME_DESCRIPTOR)
field(COMMITID_DESCRIPTOR)
field(FOLDER_DESCRIPTOR)
field(JOBNAME_DESCRIPTOR)
field(PROVIDER_DESCRIPTOR)
field(REPOSITORYNAME_DESCRIPTOR)
field(REPOSITORYOWNER_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.authStrategy?.let { field(AUTHSTRATEGY_DESCRIPTOR, it.value) }
input.authToken?.let { field(AUTHTOKEN_DESCRIPTOR, it) }
input.branchName?.let { field(BRANCHNAME_DESCRIPTOR, it) }
input.commitId?.let { field(COMMITID_DESCRIPTOR, it) }
input.folder?.let { field(FOLDER_DESCRIPTOR, it) }
input.jobName?.let { field(JOBNAME_DESCRIPTOR, it) }
input.provider?.let { field(PROVIDER_DESCRIPTOR, it.value) }
input.repositoryName?.let { field(REPOSITORYNAME_DESCRIPTOR, it) }
input.repositoryOwner?.let { field(REPOSITORYOWNER_DESCRIPTOR, it) }
}
return serializer.toByteArray()
}