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

commonMain.aws.sdk.kotlin.services.codegurureviewer.serde.CodeReviewDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.codegurureviewer.serde

import aws.sdk.kotlin.services.codegurureviewer.model.AnalysisType
import aws.sdk.kotlin.services.codegurureviewer.model.CodeReview
import aws.sdk.kotlin.services.codegurureviewer.model.ConfigFileState
import aws.sdk.kotlin.services.codegurureviewer.model.JobState
import aws.sdk.kotlin.services.codegurureviewer.model.ProviderType
import aws.sdk.kotlin.services.codegurureviewer.model.Type
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
import aws.smithy.kotlin.runtime.time.Instant
import aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf

internal fun deserializeCodeReviewDocument(deserializer: Deserializer): CodeReview {
    val builder = CodeReview.Builder()
    val ANALYSISTYPES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AnalysisTypes"))
    val ASSOCIATIONARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AssociationArn"))
    val CODEREVIEWARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CodeReviewArn"))
    val CONFIGFILESTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ConfigFileState"))
    val CREATEDTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreatedTimeStamp"))
    val LASTUPDATEDTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastUpdatedTimeStamp"))
    val METRICS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Metrics"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val OWNER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Owner"))
    val PROVIDERTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ProviderType"))
    val PULLREQUESTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PullRequestId"))
    val REPOSITORYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RepositoryName"))
    val SOURCECODETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("SourceCodeType"))
    val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("State"))
    val STATEREASON_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StateReason"))
    val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Type"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ANALYSISTYPES_DESCRIPTOR)
        field(ASSOCIATIONARN_DESCRIPTOR)
        field(CODEREVIEWARN_DESCRIPTOR)
        field(CONFIGFILESTATE_DESCRIPTOR)
        field(CREATEDTIMESTAMP_DESCRIPTOR)
        field(LASTUPDATEDTIMESTAMP_DESCRIPTOR)
        field(METRICS_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(OWNER_DESCRIPTOR)
        field(PROVIDERTYPE_DESCRIPTOR)
        field(PULLREQUESTID_DESCRIPTOR)
        field(REPOSITORYNAME_DESCRIPTOR)
        field(SOURCECODETYPE_DESCRIPTOR)
        field(STATE_DESCRIPTOR)
        field(STATEREASON_DESCRIPTOR)
        field(TYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ANALYSISTYPES_DESCRIPTOR.index -> builder.analysisTypes =
                    deserializer.deserializeList(ANALYSISTYPES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { AnalysisType.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ASSOCIATIONARN_DESCRIPTOR.index -> builder.associationArn = deserializeString()
                CODEREVIEWARN_DESCRIPTOR.index -> builder.codeReviewArn = deserializeString()
                CONFIGFILESTATE_DESCRIPTOR.index -> builder.configFileState = deserializeString().let { ConfigFileState.fromValue(it) }
                CREATEDTIMESTAMP_DESCRIPTOR.index -> builder.createdTimeStamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                LASTUPDATEDTIMESTAMP_DESCRIPTOR.index -> builder.lastUpdatedTimeStamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                METRICS_DESCRIPTOR.index -> builder.metrics = deserializeMetricsDocument(deserializer)
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                OWNER_DESCRIPTOR.index -> builder.owner = deserializeString()
                PROVIDERTYPE_DESCRIPTOR.index -> builder.providerType = deserializeString().let { ProviderType.fromValue(it) }
                PULLREQUESTID_DESCRIPTOR.index -> builder.pullRequestId = deserializeString()
                REPOSITORYNAME_DESCRIPTOR.index -> builder.repositoryName = deserializeString()
                SOURCECODETYPE_DESCRIPTOR.index -> builder.sourceCodeType = deserializeSourceCodeTypeDocument(deserializer)
                STATE_DESCRIPTOR.index -> builder.state = deserializeString().let { JobState.fromValue(it) }
                STATEREASON_DESCRIPTOR.index -> builder.stateReason = deserializeString()
                TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { Type.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy