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

commonMain.aws.sdk.kotlin.services.codebuild.serde.ProjectEnvironmentDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.codebuild.serde

import aws.sdk.kotlin.services.codebuild.model.ComputeType
import aws.sdk.kotlin.services.codebuild.model.EnvironmentType
import aws.sdk.kotlin.services.codebuild.model.EnvironmentVariable
import aws.sdk.kotlin.services.codebuild.model.ImagePullCredentialsType
import aws.sdk.kotlin.services.codebuild.model.ProjectEnvironment
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 deserializeProjectEnvironmentDocument(deserializer: Deserializer): ProjectEnvironment {
    val builder = ProjectEnvironment.Builder()
    val CERTIFICATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("certificate"))
    val COMPUTETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("computeType"))
    val ENVIRONMENTVARIABLES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("environmentVariables"))
    val FLEET_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("fleet"))
    val IMAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("image"))
    val IMAGEPULLCREDENTIALSTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("imagePullCredentialsType"))
    val PRIVILEGEDMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("privilegedMode"))
    val REGISTRYCREDENTIAL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("registryCredential"))
    val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("type"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CERTIFICATE_DESCRIPTOR)
        field(COMPUTETYPE_DESCRIPTOR)
        field(ENVIRONMENTVARIABLES_DESCRIPTOR)
        field(FLEET_DESCRIPTOR)
        field(IMAGE_DESCRIPTOR)
        field(IMAGEPULLCREDENTIALSTYPE_DESCRIPTOR)
        field(PRIVILEGEDMODE_DESCRIPTOR)
        field(REGISTRYCREDENTIAL_DESCRIPTOR)
        field(TYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CERTIFICATE_DESCRIPTOR.index -> builder.certificate = deserializeString()
                COMPUTETYPE_DESCRIPTOR.index -> builder.computeType = deserializeString().let { ComputeType.fromValue(it) }
                ENVIRONMENTVARIABLES_DESCRIPTOR.index -> builder.environmentVariables =
                    deserializer.deserializeList(ENVIRONMENTVARIABLES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeEnvironmentVariableDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                FLEET_DESCRIPTOR.index -> builder.fleet = deserializeProjectFleetDocument(deserializer)
                IMAGE_DESCRIPTOR.index -> builder.image = deserializeString()
                IMAGEPULLCREDENTIALSTYPE_DESCRIPTOR.index -> builder.imagePullCredentialsType = deserializeString().let { ImagePullCredentialsType.fromValue(it) }
                PRIVILEGEDMODE_DESCRIPTOR.index -> builder.privilegedMode = deserializeBoolean()
                REGISTRYCREDENTIAL_DESCRIPTOR.index -> builder.registryCredential = deserializeRegistryCredentialDocument(deserializer)
                TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { EnvironmentType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy