commonMain.aws.sdk.kotlin.services.glue.serde.CreateCrawlerOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glue-jvm Show documentation
Show all versions of glue-jvm Show documentation
The AWS SDK for Kotlin client for Glue
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.glue.serde
import aws.sdk.kotlin.services.glue.model.CrawlerTargets
import aws.sdk.kotlin.services.glue.model.CreateCrawlerRequest
import aws.sdk.kotlin.services.glue.model.LakeFormationConfiguration
import aws.sdk.kotlin.services.glue.model.LineageConfiguration
import aws.sdk.kotlin.services.glue.model.RecrawlPolicy
import aws.sdk.kotlin.services.glue.model.SchemaChangePolicy
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 CreateCrawlerOperationSerializer: HttpSerializer.NonStreaming {
override fun serialize(context: ExecutionContext, input: CreateCrawlerRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/"
}
val payload = serializeCreateCrawlerOperationBody(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 serializeCreateCrawlerOperationBody(context: ExecutionContext, input: CreateCrawlerRequest): ByteArray {
val serializer = JsonSerializer()
val CLASSIFIERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Classifiers"))
val CONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Configuration"))
val CRAWLERSECURITYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CrawlerSecurityConfiguration"))
val DATABASENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DatabaseName"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val LAKEFORMATIONCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("LakeFormationConfiguration"))
val LINEAGECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("LineageConfiguration"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val RECRAWLPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("RecrawlPolicy"))
val ROLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Role"))
val SCHEDULE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Schedule"))
val SCHEMACHANGEPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("SchemaChangePolicy"))
val TABLEPREFIX_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("TablePrefix"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tags"))
val TARGETS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Targets"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CLASSIFIERS_DESCRIPTOR)
field(CONFIGURATION_DESCRIPTOR)
field(CRAWLERSECURITYCONFIGURATION_DESCRIPTOR)
field(DATABASENAME_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(LAKEFORMATIONCONFIGURATION_DESCRIPTOR)
field(LINEAGECONFIGURATION_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(RECRAWLPOLICY_DESCRIPTOR)
field(ROLE_DESCRIPTOR)
field(SCHEDULE_DESCRIPTOR)
field(SCHEMACHANGEPOLICY_DESCRIPTOR)
field(TABLEPREFIX_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(TARGETS_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
if (input.classifiers != null) {
listField(CLASSIFIERS_DESCRIPTOR) {
for (el0 in input.classifiers) {
serializeString(el0)
}
}
}
input.configuration?.let { field(CONFIGURATION_DESCRIPTOR, it) }
input.crawlerSecurityConfiguration?.let { field(CRAWLERSECURITYCONFIGURATION_DESCRIPTOR, it) }
input.databaseName?.let { field(DATABASENAME_DESCRIPTOR, it) }
input.description?.let { field(DESCRIPTION_DESCRIPTOR, it) }
input.lakeFormationConfiguration?.let { field(LAKEFORMATIONCONFIGURATION_DESCRIPTOR, it, ::serializeLakeFormationConfigurationDocument) }
input.lineageConfiguration?.let { field(LINEAGECONFIGURATION_DESCRIPTOR, it, ::serializeLineageConfigurationDocument) }
input.name?.let { field(NAME_DESCRIPTOR, it) }
input.recrawlPolicy?.let { field(RECRAWLPOLICY_DESCRIPTOR, it, ::serializeRecrawlPolicyDocument) }
input.role?.let { field(ROLE_DESCRIPTOR, it) }
input.schedule?.let { field(SCHEDULE_DESCRIPTOR, it) }
input.schemaChangePolicy?.let { field(SCHEMACHANGEPOLICY_DESCRIPTOR, it, ::serializeSchemaChangePolicyDocument) }
input.tablePrefix?.let { field(TABLEPREFIX_DESCRIPTOR, it) }
if (input.tags != null) {
mapField(TAGS_DESCRIPTOR) {
input.tags.forEach { (key, value) ->
entry(key, value)
}
}
}
input.targets?.let { field(TARGETS_DESCRIPTOR, it, ::serializeCrawlerTargetsDocument) }
}
return serializer.toByteArray()
}