commonMain.aws.sdk.kotlin.services.bedrock.serde.CreateModelCustomizationJobOperationSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bedrock-jvm Show documentation
Show all versions of bedrock-jvm Show documentation
The AWS SDK for Kotlin client for Bedrock
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrock.serde
import aws.sdk.kotlin.services.bedrock.model.CreateModelCustomizationJobRequest
import aws.sdk.kotlin.services.bedrock.model.OutputDataConfig
import aws.sdk.kotlin.services.bedrock.model.Tag
import aws.sdk.kotlin.services.bedrock.model.TrainingDataConfig
import aws.sdk.kotlin.services.bedrock.model.ValidationDataConfig
import aws.sdk.kotlin.services.bedrock.model.VpcConfig
import aws.smithy.kotlin.runtime.client.idempotencyTokenProvider
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerialize
import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder
import aws.smithy.kotlin.runtime.http.request.url
import aws.smithy.kotlin.runtime.operation.ExecutionContext
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.json.JsonSerializer
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
internal class CreateModelCustomizationJobOperationSerializer: HttpSerialize {
override suspend fun serialize(context: ExecutionContext, input: CreateModelCustomizationJobRequest): HttpRequestBuilder {
val builder = HttpRequestBuilder()
builder.method = HttpMethod.POST
builder.url {
path.encoded = "/model-customization-jobs"
}
val payload = serializeCreateModelCustomizationJobOperationBody(context, input)
builder.body = HttpBody.fromBytes(payload)
if (builder.body !is HttpBody.Empty) {
builder.headers.setMissing("Content-Type", "application/json")
}
return builder
}
}
private fun serializeCreateModelCustomizationJobOperationBody(context: ExecutionContext, input: CreateModelCustomizationJobRequest): ByteArray {
val serializer = JsonSerializer()
val BASEMODELIDENTIFIER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("baseModelIdentifier"))
val CLIENTREQUESTTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("clientRequestToken"))
val CUSTOMMODELKMSKEYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("customModelKmsKeyId"))
val CUSTOMMODELNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("customModelName"))
val CUSTOMMODELTAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("customModelTags"))
val HYPERPARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("hyperParameters"))
val JOBNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("jobName"))
val JOBTAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("jobTags"))
val OUTPUTDATACONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("outputDataConfig"))
val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("roleArn"))
val TRAININGDATACONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("trainingDataConfig"))
val VALIDATIONDATACONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("validationDataConfig"))
val VPCCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("vpcConfig"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(BASEMODELIDENTIFIER_DESCRIPTOR)
field(CLIENTREQUESTTOKEN_DESCRIPTOR)
field(CUSTOMMODELKMSKEYID_DESCRIPTOR)
field(CUSTOMMODELNAME_DESCRIPTOR)
field(CUSTOMMODELTAGS_DESCRIPTOR)
field(HYPERPARAMETERS_DESCRIPTOR)
field(JOBNAME_DESCRIPTOR)
field(JOBTAGS_DESCRIPTOR)
field(OUTPUTDATACONFIG_DESCRIPTOR)
field(ROLEARN_DESCRIPTOR)
field(TRAININGDATACONFIG_DESCRIPTOR)
field(VALIDATIONDATACONFIG_DESCRIPTOR)
field(VPCCONFIG_DESCRIPTOR)
}
serializer.serializeStruct(OBJ_DESCRIPTOR) {
input.baseModelIdentifier?.let { field(BASEMODELIDENTIFIER_DESCRIPTOR, it) }
input.clientRequestToken?.let { field(CLIENTREQUESTTOKEN_DESCRIPTOR, it) } ?: field(CLIENTREQUESTTOKEN_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
input.customModelKmsKeyId?.let { field(CUSTOMMODELKMSKEYID_DESCRIPTOR, it) }
input.customModelName?.let { field(CUSTOMMODELNAME_DESCRIPTOR, it) }
if (input.customModelTags != null) {
listField(CUSTOMMODELTAGS_DESCRIPTOR) {
for (el0 in input.customModelTags) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
}
}
}
if (input.hyperParameters != null) {
mapField(HYPERPARAMETERS_DESCRIPTOR) {
input.hyperParameters.forEach { (key, value) -> entry(key, value) }
}
}
input.jobName?.let { field(JOBNAME_DESCRIPTOR, it) }
if (input.jobTags != null) {
listField(JOBTAGS_DESCRIPTOR) {
for (el0 in input.jobTags) {
serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
}
}
}
input.outputDataConfig?.let { field(OUTPUTDATACONFIG_DESCRIPTOR, it, ::serializeOutputDataConfigDocument) }
input.roleArn?.let { field(ROLEARN_DESCRIPTOR, it) }
input.trainingDataConfig?.let { field(TRAININGDATACONFIG_DESCRIPTOR, it, ::serializeTrainingDataConfigDocument) }
input.validationDataConfig?.let { field(VALIDATIONDATACONFIG_DESCRIPTOR, it, ::serializeValidationDataConfigDocument) }
input.vpcConfig?.let { field(VPCCONFIG_DESCRIPTOR, it, ::serializeVpcConfigDocument) }
}
return serializer.toByteArray()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy