All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.appsync.serde.DataSourceDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.appsync.serde

import aws.sdk.kotlin.services.appsync.model.DataSource
import aws.sdk.kotlin.services.appsync.model.DataSourceLevelMetricsConfig
import aws.sdk.kotlin.services.appsync.model.DataSourceType
import aws.smithy.kotlin.runtime.serde.Deserializer
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.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct

internal fun deserializeDataSourceDocument(deserializer: Deserializer): DataSource {
    val builder = DataSource.Builder()
    val DATASOURCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("dataSourceArn"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
    val DYNAMODBCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("dynamodbConfig"))
    val ELASTICSEARCHCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("elasticsearchConfig"))
    val EVENTBRIDGECONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("eventBridgeConfig"))
    val HTTPCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("httpConfig"))
    val LAMBDACONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("lambdaConfig"))
    val METRICSCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("metricsConfig"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val OPENSEARCHSERVICECONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("openSearchServiceConfig"))
    val RELATIONALDATABASECONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("relationalDatabaseConfig"))
    val SERVICEROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("serviceRoleArn"))
    val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("type"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DATASOURCEARN_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(DYNAMODBCONFIG_DESCRIPTOR)
        field(ELASTICSEARCHCONFIG_DESCRIPTOR)
        field(EVENTBRIDGECONFIG_DESCRIPTOR)
        field(HTTPCONFIG_DESCRIPTOR)
        field(LAMBDACONFIG_DESCRIPTOR)
        field(METRICSCONFIG_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(OPENSEARCHSERVICECONFIG_DESCRIPTOR)
        field(RELATIONALDATABASECONFIG_DESCRIPTOR)
        field(SERVICEROLEARN_DESCRIPTOR)
        field(TYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                DATASOURCEARN_DESCRIPTOR.index -> builder.dataSourceArn = deserializeString()
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                DYNAMODBCONFIG_DESCRIPTOR.index -> builder.dynamodbConfig = deserializeDynamodbDataSourceConfigDocument(deserializer)
                ELASTICSEARCHCONFIG_DESCRIPTOR.index -> builder.elasticsearchConfig = deserializeElasticsearchDataSourceConfigDocument(deserializer)
                EVENTBRIDGECONFIG_DESCRIPTOR.index -> builder.eventBridgeConfig = deserializeEventBridgeDataSourceConfigDocument(deserializer)
                HTTPCONFIG_DESCRIPTOR.index -> builder.httpConfig = deserializeHttpDataSourceConfigDocument(deserializer)
                LAMBDACONFIG_DESCRIPTOR.index -> builder.lambdaConfig = deserializeLambdaDataSourceConfigDocument(deserializer)
                METRICSCONFIG_DESCRIPTOR.index -> builder.metricsConfig = deserializeString().let { DataSourceLevelMetricsConfig.fromValue(it) }
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                OPENSEARCHSERVICECONFIG_DESCRIPTOR.index -> builder.openSearchServiceConfig = deserializeOpenSearchServiceDataSourceConfigDocument(deserializer)
                RELATIONALDATABASECONFIG_DESCRIPTOR.index -> builder.relationalDatabaseConfig = deserializeRelationalDatabaseDataSourceConfigDocument(deserializer)
                SERVICEROLEARN_DESCRIPTOR.index -> builder.serviceRoleArn = deserializeString()
                TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { DataSourceType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy