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

commonMain.aws.sdk.kotlin.services.bedrock.serde.FoundationModelSummaryDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.bedrock.serde

import aws.sdk.kotlin.services.bedrock.model.FoundationModelSummary
import aws.sdk.kotlin.services.bedrock.model.InferenceType
import aws.sdk.kotlin.services.bedrock.model.ModelCustomization
import aws.sdk.kotlin.services.bedrock.model.ModelModality
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 deserializeFoundationModelSummaryDocument(deserializer: Deserializer): FoundationModelSummary {
    val builder = FoundationModelSummary.Builder()
    val CUSTOMIZATIONSSUPPORTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("customizationsSupported"))
    val INFERENCETYPESSUPPORTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("inferenceTypesSupported"))
    val INPUTMODALITIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("inputModalities"))
    val MODELARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("modelArn"))
    val MODELID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("modelId"))
    val MODELLIFECYCLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("modelLifecycle"))
    val MODELNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("modelName"))
    val OUTPUTMODALITIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("outputModalities"))
    val PROVIDERNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("providerName"))
    val RESPONSESTREAMINGSUPPORTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("responseStreamingSupported"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CUSTOMIZATIONSSUPPORTED_DESCRIPTOR)
        field(INFERENCETYPESSUPPORTED_DESCRIPTOR)
        field(INPUTMODALITIES_DESCRIPTOR)
        field(MODELARN_DESCRIPTOR)
        field(MODELID_DESCRIPTOR)
        field(MODELLIFECYCLE_DESCRIPTOR)
        field(MODELNAME_DESCRIPTOR)
        field(OUTPUTMODALITIES_DESCRIPTOR)
        field(PROVIDERNAME_DESCRIPTOR)
        field(RESPONSESTREAMINGSUPPORTED_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CUSTOMIZATIONSSUPPORTED_DESCRIPTOR.index -> builder.customizationsSupported =
                    deserializer.deserializeList(CUSTOMIZATIONSSUPPORTED_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { ModelCustomization.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                INFERENCETYPESSUPPORTED_DESCRIPTOR.index -> builder.inferenceTypesSupported =
                    deserializer.deserializeList(INFERENCETYPESSUPPORTED_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { InferenceType.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                INPUTMODALITIES_DESCRIPTOR.index -> builder.inputModalities =
                    deserializer.deserializeList(INPUTMODALITIES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { ModelModality.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                MODELARN_DESCRIPTOR.index -> builder.modelArn = deserializeString()
                MODELID_DESCRIPTOR.index -> builder.modelId = deserializeString()
                MODELLIFECYCLE_DESCRIPTOR.index -> builder.modelLifecycle = deserializeFoundationModelLifecycleDocument(deserializer)
                MODELNAME_DESCRIPTOR.index -> builder.modelName = deserializeString()
                OUTPUTMODALITIES_DESCRIPTOR.index -> builder.outputModalities =
                    deserializer.deserializeList(OUTPUTMODALITIES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { ModelModality.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                PROVIDERNAME_DESCRIPTOR.index -> builder.providerName = deserializeString()
                RESPONSESTREAMINGSUPPORTED_DESCRIPTOR.index -> builder.responseStreamingSupported = deserializeBoolean()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy