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

commonMain.aws.sdk.kotlin.services.codebuild.serde.UpdateFleetOperationSerializer.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.FleetOverflowBehavior
import aws.sdk.kotlin.services.codebuild.model.ProxyConfiguration
import aws.sdk.kotlin.services.codebuild.model.ScalingConfigurationInput
import aws.sdk.kotlin.services.codebuild.model.Tag
import aws.sdk.kotlin.services.codebuild.model.UpdateFleetRequest
import aws.sdk.kotlin.services.codebuild.model.VpcConfig
import aws.smithy.kotlin.runtime.http.HttpBody
import aws.smithy.kotlin.runtime.http.HttpMethod
import aws.smithy.kotlin.runtime.http.operation.HttpSerializer
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 UpdateFleetOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateFleetRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

        builder.url {
            path.encoded = "/"
        }

        val payload = serializeUpdateFleetOperationBody(context, input)
        builder.body = HttpBody.fromBytes(payload)
        if (builder.body !is HttpBody.Empty) {
            builder.headers.setMissing("Content-Type", "application/x-amz-json-1.1")
        }
        return builder
    }
}

private fun serializeUpdateFleetOperationBody(context: ExecutionContext, input: UpdateFleetRequest): ByteArray {
    val serializer = JsonSerializer()
    val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("arn"))
    val BASECAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("baseCapacity"))
    val COMPUTETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("computeType"))
    val ENVIRONMENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("environmentType"))
    val FLEETSERVICEROLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("fleetServiceRole"))
    val IMAGEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("imageId"))
    val OVERFLOWBEHAVIOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("overflowBehavior"))
    val PROXYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("proxyConfiguration"))
    val SCALINGCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("scalingConfiguration"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("tags"))
    val VPCCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("vpcConfig"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ARN_DESCRIPTOR)
        field(BASECAPACITY_DESCRIPTOR)
        field(COMPUTETYPE_DESCRIPTOR)
        field(ENVIRONMENTTYPE_DESCRIPTOR)
        field(FLEETSERVICEROLE_DESCRIPTOR)
        field(IMAGEID_DESCRIPTOR)
        field(OVERFLOWBEHAVIOR_DESCRIPTOR)
        field(PROXYCONFIGURATION_DESCRIPTOR)
        field(SCALINGCONFIGURATION_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(VPCCONFIG_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.arn?.let { field(ARN_DESCRIPTOR, it) }
        input.baseCapacity?.let { field(BASECAPACITY_DESCRIPTOR, it) }
        input.computeType?.let { field(COMPUTETYPE_DESCRIPTOR, it.value) }
        input.environmentType?.let { field(ENVIRONMENTTYPE_DESCRIPTOR, it.value) }
        input.fleetServiceRole?.let { field(FLEETSERVICEROLE_DESCRIPTOR, it) }
        input.imageId?.let { field(IMAGEID_DESCRIPTOR, it) }
        input.overflowBehavior?.let { field(OVERFLOWBEHAVIOR_DESCRIPTOR, it.value) }
        input.proxyConfiguration?.let { field(PROXYCONFIGURATION_DESCRIPTOR, it, ::serializeProxyConfigurationDocument) }
        input.scalingConfiguration?.let { field(SCALINGCONFIGURATION_DESCRIPTOR, it, ::serializeScalingConfigurationInputDocument) }
        if (input.tags != null) {
            listField(TAGS_DESCRIPTOR) {
                for (el0 in input.tags) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeTagDocument))
                }
            }
        }
        input.vpcConfig?.let { field(VPCCONFIG_DESCRIPTOR, it, ::serializeVpcConfigDocument) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy