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

commonMain.aws.sdk.kotlin.services.codeartifact.serde.PackageVersionDescriptionDocumentDeserializer.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.codeartifact.serde

import aws.sdk.kotlin.services.codeartifact.model.LicenseInfo
import aws.sdk.kotlin.services.codeartifact.model.PackageFormat
import aws.sdk.kotlin.services.codeartifact.model.PackageVersionDescription
import aws.sdk.kotlin.services.codeartifact.model.PackageVersionStatus
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 deserializePackageVersionDescriptionDocument(deserializer: Deserializer): PackageVersionDescription {
    val builder = PackageVersionDescription.Builder()
    val DISPLAYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("displayName"))
    val FORMAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("format"))
    val HOMEPAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("homePage"))
    val LICENSES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("licenses"))
    val NAMESPACE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("namespace"))
    val ORIGIN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("origin"))
    val PACKAGENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("packageName"))
    val PUBLISHEDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("publishedTime"))
    val REVISION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("revision"))
    val SOURCECODEREPOSITORY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("sourceCodeRepository"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("status"))
    val SUMMARY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("summary"))
    val VERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("version"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DISPLAYNAME_DESCRIPTOR)
        field(FORMAT_DESCRIPTOR)
        field(HOMEPAGE_DESCRIPTOR)
        field(LICENSES_DESCRIPTOR)
        field(NAMESPACE_DESCRIPTOR)
        field(ORIGIN_DESCRIPTOR)
        field(PACKAGENAME_DESCRIPTOR)
        field(PUBLISHEDTIME_DESCRIPTOR)
        field(REVISION_DESCRIPTOR)
        field(SOURCECODEREPOSITORY_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(SUMMARY_DESCRIPTOR)
        field(VERSION_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                DISPLAYNAME_DESCRIPTOR.index -> builder.displayName = deserializeString()
                FORMAT_DESCRIPTOR.index -> builder.format = deserializeString().let { PackageFormat.fromValue(it) }
                HOMEPAGE_DESCRIPTOR.index -> builder.homePage = deserializeString()
                LICENSES_DESCRIPTOR.index -> builder.licenses =
                    deserializer.deserializeList(LICENSES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLicenseInfoDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                NAMESPACE_DESCRIPTOR.index -> builder.namespace = deserializeString()
                ORIGIN_DESCRIPTOR.index -> builder.origin = deserializePackageVersionOriginDocument(deserializer)
                PACKAGENAME_DESCRIPTOR.index -> builder.packageName = deserializeString()
                PUBLISHEDTIME_DESCRIPTOR.index -> builder.publishedTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                REVISION_DESCRIPTOR.index -> builder.revision = deserializeString()
                SOURCECODEREPOSITORY_DESCRIPTOR.index -> builder.sourceCodeRepository = deserializeString()
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { PackageVersionStatus.fromValue(it) }
                SUMMARY_DESCRIPTOR.index -> builder.summary = deserializeString()
                VERSION_DESCRIPTOR.index -> builder.version = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy