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

commonMain.aws.sdk.kotlin.services.configservice.serde.OrganizationConfigRuleDocumentDeserializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.configservice.serde

import aws.sdk.kotlin.services.configservice.model.OrganizationConfigRule
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 kotlin.collections.mutableListOf

internal fun deserializeOrganizationConfigRuleDocument(deserializer: Deserializer): OrganizationConfigRule {
    val builder = OrganizationConfigRule.Builder()
    val EXCLUDEDACCOUNTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ExcludedAccounts"))
    val LASTUPDATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastUpdateTime"))
    val ORGANIZATIONCONFIGRULEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OrganizationConfigRuleArn"))
    val ORGANIZATIONCONFIGRULENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OrganizationConfigRuleName"))
    val ORGANIZATIONCUSTOMPOLICYRULEMETADATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("OrganizationCustomPolicyRuleMetadata"))
    val ORGANIZATIONCUSTOMRULEMETADATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("OrganizationCustomRuleMetadata"))
    val ORGANIZATIONMANAGEDRULEMETADATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("OrganizationManagedRuleMetadata"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(EXCLUDEDACCOUNTS_DESCRIPTOR)
        field(LASTUPDATETIME_DESCRIPTOR)
        field(ORGANIZATIONCONFIGRULEARN_DESCRIPTOR)
        field(ORGANIZATIONCONFIGRULENAME_DESCRIPTOR)
        field(ORGANIZATIONCUSTOMPOLICYRULEMETADATA_DESCRIPTOR)
        field(ORGANIZATIONCUSTOMRULEMETADATA_DESCRIPTOR)
        field(ORGANIZATIONMANAGEDRULEMETADATA_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                EXCLUDEDACCOUNTS_DESCRIPTOR.index -> builder.excludedAccounts =
                    deserializer.deserializeList(EXCLUDEDACCOUNTS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                LASTUPDATETIME_DESCRIPTOR.index -> builder.lastUpdateTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                ORGANIZATIONCONFIGRULEARN_DESCRIPTOR.index -> builder.organizationConfigRuleArn = deserializeString()
                ORGANIZATIONCONFIGRULENAME_DESCRIPTOR.index -> builder.organizationConfigRuleName = deserializeString()
                ORGANIZATIONCUSTOMPOLICYRULEMETADATA_DESCRIPTOR.index -> builder.organizationCustomPolicyRuleMetadata = deserializeOrganizationCustomPolicyRuleMetadataNoPolicyDocument(deserializer)
                ORGANIZATIONCUSTOMRULEMETADATA_DESCRIPTOR.index -> builder.organizationCustomRuleMetadata = deserializeOrganizationCustomRuleMetadataDocument(deserializer)
                ORGANIZATIONMANAGEDRULEMETADATA_DESCRIPTOR.index -> builder.organizationManagedRuleMetadata = deserializeOrganizationManagedRuleMetadataDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy