commonMain.aws.sdk.kotlin.services.codebuild.serde.WebhookDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codebuild-jvm Show documentation
Show all versions of codebuild-jvm Show documentation
The AWS SDK for Kotlin client for CodeBuild
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.codebuild.serde
import aws.sdk.kotlin.services.codebuild.model.Webhook
import aws.sdk.kotlin.services.codebuild.model.WebhookBuildType
import aws.sdk.kotlin.services.codebuild.model.WebhookFilter
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 deserializeWebhookDocument(deserializer: Deserializer): Webhook {
val builder = Webhook.Builder()
val BRANCHFILTER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("branchFilter"))
val BUILDTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("buildType"))
val FILTERGROUPS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("filterGroups"))
val FILTERGROUPS_C0_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List)
val LASTMODIFIEDSECRET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("lastModifiedSecret"))
val MANUALCREATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("manualCreation"))
val PAYLOADURL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("payloadUrl"))
val SCOPECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("scopeConfiguration"))
val SECRET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("secret"))
val URL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("url"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(BRANCHFILTER_DESCRIPTOR)
field(BUILDTYPE_DESCRIPTOR)
field(FILTERGROUPS_DESCRIPTOR)
field(LASTMODIFIEDSECRET_DESCRIPTOR)
field(MANUALCREATION_DESCRIPTOR)
field(PAYLOADURL_DESCRIPTOR)
field(SCOPECONFIGURATION_DESCRIPTOR)
field(SECRET_DESCRIPTOR)
field(URL_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
BRANCHFILTER_DESCRIPTOR.index -> builder.branchFilter = deserializeString()
BUILDTYPE_DESCRIPTOR.index -> builder.buildType = deserializeString().let { WebhookBuildType.fromValue(it) }
FILTERGROUPS_DESCRIPTOR.index -> builder.filterGroups =
deserializer.deserializeList(FILTERGROUPS_DESCRIPTOR) {
val col0 = mutableListOf>()
while (hasNextElement()) {
val el0 = deserializer.deserializeList(FILTERGROUPS_C0_DESCRIPTOR) {
val col1 = mutableListOf()
while (hasNextElement()) {
val el1 = if (nextHasValue()) { deserializeWebhookFilterDocument(deserializer) } else { deserializeNull(); continue }
col1.add(el1)
}
col1
}
col0.add(el0)
}
col0
}
LASTMODIFIEDSECRET_DESCRIPTOR.index -> builder.lastModifiedSecret = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
MANUALCREATION_DESCRIPTOR.index -> builder.manualCreation = deserializeBoolean()
PAYLOADURL_DESCRIPTOR.index -> builder.payloadUrl = deserializeString()
SCOPECONFIGURATION_DESCRIPTOR.index -> builder.scopeConfiguration = deserializeScopeConfigurationDocument(deserializer)
SECRET_DESCRIPTOR.index -> builder.secret = deserializeString()
URL_DESCRIPTOR.index -> builder.url = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}