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

commonMain.aws.sdk.kotlin.services.outposts.serde.UpdateSiteRackPhysicalPropertiesOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.outposts.serde

import aws.sdk.kotlin.services.outposts.model.FiberOpticCableType
import aws.sdk.kotlin.services.outposts.model.MaximumSupportedWeightLbs
import aws.sdk.kotlin.services.outposts.model.OpticalStandard
import aws.sdk.kotlin.services.outposts.model.PowerConnector
import aws.sdk.kotlin.services.outposts.model.PowerDrawKva
import aws.sdk.kotlin.services.outposts.model.PowerFeedDrop
import aws.sdk.kotlin.services.outposts.model.PowerPhase
import aws.sdk.kotlin.services.outposts.model.UpdateSiteRackPhysicalPropertiesRequest
import aws.sdk.kotlin.services.outposts.model.UplinkCount
import aws.sdk.kotlin.services.outposts.model.UplinkGbps
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
import aws.smithy.kotlin.runtime.text.encoding.PercentEncoding


internal class UpdateSiteRackPhysicalPropertiesOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: UpdateSiteRackPhysicalPropertiesRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.PATCH

        builder.url {
            requireNotNull(input.siteId) { "siteId is bound to the URI and must not be null" }
            path.encodedSegments {
                add(PercentEncoding.Path.encode("sites"))
                add(PercentEncoding.SmithyLabel.encode(input.siteId))
                add(PercentEncoding.Path.encode("rackPhysicalProperties"))
            }
        }

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

private fun serializeUpdateSiteRackPhysicalPropertiesOperationBody(context: ExecutionContext, input: UpdateSiteRackPhysicalPropertiesRequest): ByteArray {
    val serializer = JsonSerializer()
    val FIBEROPTICCABLETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("FiberOpticCableType"))
    val MAXIMUMSUPPORTEDWEIGHTLBS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("MaximumSupportedWeightLbs"))
    val OPTICALSTANDARD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("OpticalStandard"))
    val POWERCONNECTOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PowerConnector"))
    val POWERDRAWKVA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PowerDrawKva"))
    val POWERFEEDDROP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PowerFeedDrop"))
    val POWERPHASE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PowerPhase"))
    val UPLINKCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("UplinkCount"))
    val UPLINKGBPS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("UplinkGbps"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(FIBEROPTICCABLETYPE_DESCRIPTOR)
        field(MAXIMUMSUPPORTEDWEIGHTLBS_DESCRIPTOR)
        field(OPTICALSTANDARD_DESCRIPTOR)
        field(POWERCONNECTOR_DESCRIPTOR)
        field(POWERDRAWKVA_DESCRIPTOR)
        field(POWERFEEDDROP_DESCRIPTOR)
        field(POWERPHASE_DESCRIPTOR)
        field(UPLINKCOUNT_DESCRIPTOR)
        field(UPLINKGBPS_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.fiberOpticCableType?.let { field(FIBEROPTICCABLETYPE_DESCRIPTOR, it.value) }
        input.maximumSupportedWeightLbs?.let { field(MAXIMUMSUPPORTEDWEIGHTLBS_DESCRIPTOR, it.value) }
        input.opticalStandard?.let { field(OPTICALSTANDARD_DESCRIPTOR, it.value) }
        input.powerConnector?.let { field(POWERCONNECTOR_DESCRIPTOR, it.value) }
        input.powerDrawKva?.let { field(POWERDRAWKVA_DESCRIPTOR, it.value) }
        input.powerFeedDrop?.let { field(POWERFEEDDROP_DESCRIPTOR, it.value) }
        input.powerPhase?.let { field(POWERPHASE_DESCRIPTOR, it.value) }
        input.uplinkCount?.let { field(UPLINKCOUNT_DESCRIPTOR, it.value) }
        input.uplinkGbps?.let { field(UPLINKGBPS_DESCRIPTOR, it.value) }
    }
    return serializer.toByteArray()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy