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

commonMain.aws.sdk.kotlin.services.codepipeline.serde.WebhookDefinitionDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.codepipeline.serde

import aws.sdk.kotlin.services.codepipeline.model.WebhookAuthenticationType
import aws.sdk.kotlin.services.codepipeline.model.WebhookDefinition
import aws.sdk.kotlin.services.codepipeline.model.WebhookFilterRule
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 kotlin.collections.mutableListOf

internal fun deserializeWebhookDefinitionDocument(deserializer: Deserializer): WebhookDefinition {
    val builder = WebhookDefinition.Builder()
    val AUTHENTICATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("authentication"))
    val AUTHENTICATIONCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("authenticationConfiguration"))
    val FILTERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("filters"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val TARGETACTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("targetAction"))
    val TARGETPIPELINE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("targetPipeline"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(AUTHENTICATION_DESCRIPTOR)
        field(AUTHENTICATIONCONFIGURATION_DESCRIPTOR)
        field(FILTERS_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(TARGETACTION_DESCRIPTOR)
        field(TARGETPIPELINE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                AUTHENTICATION_DESCRIPTOR.index -> builder.authentication = deserializeString().let { WebhookAuthenticationType.fromValue(it) }
                AUTHENTICATIONCONFIGURATION_DESCRIPTOR.index -> builder.authenticationConfiguration = deserializeWebhookAuthConfigurationDocument(deserializer)
                FILTERS_DESCRIPTOR.index -> builder.filters =
                    deserializer.deserializeList(FILTERS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeWebhookFilterRuleDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                TARGETACTION_DESCRIPTOR.index -> builder.targetAction = deserializeString()
                TARGETPIPELINE_DESCRIPTOR.index -> builder.targetPipeline = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy