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

commonMain.aws.sdk.kotlin.services.transfer.serde.DescribedCertificateDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.transfer.serde

import aws.sdk.kotlin.services.transfer.model.CertificateStatusType
import aws.sdk.kotlin.services.transfer.model.CertificateType
import aws.sdk.kotlin.services.transfer.model.CertificateUsageType
import aws.sdk.kotlin.services.transfer.model.DescribedCertificate
import aws.sdk.kotlin.services.transfer.model.Tag
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 deserializeDescribedCertificateDocument(deserializer: Deserializer): DescribedCertificate {
    val builder = DescribedCertificate.Builder()
    val ACTIVEDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("ActiveDate"))
    val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Arn"))
    val CERTIFICATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Certificate"))
    val CERTIFICATECHAIN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CertificateChain"))
    val CERTIFICATEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CertificateId"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val INACTIVEDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("InactiveDate"))
    val NOTAFTERDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("NotAfterDate"))
    val NOTBEFOREDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("NotBeforeDate"))
    val SERIAL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Serial"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Tags"))
    val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Type"))
    val USAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Usage"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACTIVEDATE_DESCRIPTOR)
        field(ARN_DESCRIPTOR)
        field(CERTIFICATE_DESCRIPTOR)
        field(CERTIFICATECHAIN_DESCRIPTOR)
        field(CERTIFICATEID_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(INACTIVEDATE_DESCRIPTOR)
        field(NOTAFTERDATE_DESCRIPTOR)
        field(NOTBEFOREDATE_DESCRIPTOR)
        field(SERIAL_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(TYPE_DESCRIPTOR)
        field(USAGE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACTIVEDATE_DESCRIPTOR.index -> builder.activeDate = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                ARN_DESCRIPTOR.index -> builder.arn = deserializeString()
                CERTIFICATE_DESCRIPTOR.index -> builder.certificate = deserializeString()
                CERTIFICATECHAIN_DESCRIPTOR.index -> builder.certificateChain = deserializeString()
                CERTIFICATEID_DESCRIPTOR.index -> builder.certificateId = deserializeString()
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                INACTIVEDATE_DESCRIPTOR.index -> builder.inactiveDate = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                NOTAFTERDATE_DESCRIPTOR.index -> builder.notAfterDate = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                NOTBEFOREDATE_DESCRIPTOR.index -> builder.notBeforeDate = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                SERIAL_DESCRIPTOR.index -> builder.serial = deserializeString()
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { CertificateStatusType.fromValue(it) }
                TAGS_DESCRIPTOR.index -> builder.tags =
                    deserializer.deserializeList(TAGS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeTagDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { CertificateType.fromValue(it) }
                USAGE_DESCRIPTOR.index -> builder.usage = deserializeString().let { CertificateUsageType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy