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

commonMain.aws.sdk.kotlin.services.secretsmanager.serde.GetRandomPasswordOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.secretsmanager.serde

import aws.sdk.kotlin.services.secretsmanager.model.GetRandomPasswordRequest
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 GetRandomPasswordOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: GetRandomPasswordRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeGetRandomPasswordOperationBody(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 serializeGetRandomPasswordOperationBody(context: ExecutionContext, input: GetRandomPasswordRequest): ByteArray {
    val serializer = JsonSerializer()
    val EXCLUDECHARACTERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ExcludeCharacters"))
    val EXCLUDELOWERCASE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("ExcludeLowercase"))
    val EXCLUDENUMBERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("ExcludeNumbers"))
    val EXCLUDEPUNCTUATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("ExcludePunctuation"))
    val EXCLUDEUPPERCASE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("ExcludeUppercase"))
    val INCLUDESPACE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IncludeSpace"))
    val PASSWORDLENGTH_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("PasswordLength"))
    val REQUIREEACHINCLUDEDTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("RequireEachIncludedType"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(EXCLUDECHARACTERS_DESCRIPTOR)
        field(EXCLUDELOWERCASE_DESCRIPTOR)
        field(EXCLUDENUMBERS_DESCRIPTOR)
        field(EXCLUDEPUNCTUATION_DESCRIPTOR)
        field(EXCLUDEUPPERCASE_DESCRIPTOR)
        field(INCLUDESPACE_DESCRIPTOR)
        field(PASSWORDLENGTH_DESCRIPTOR)
        field(REQUIREEACHINCLUDEDTYPE_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.excludeCharacters?.let { field(EXCLUDECHARACTERS_DESCRIPTOR, it) }
        input.excludeLowercase?.let { field(EXCLUDELOWERCASE_DESCRIPTOR, it) }
        input.excludeNumbers?.let { field(EXCLUDENUMBERS_DESCRIPTOR, it) }
        input.excludePunctuation?.let { field(EXCLUDEPUNCTUATION_DESCRIPTOR, it) }
        input.excludeUppercase?.let { field(EXCLUDEUPPERCASE_DESCRIPTOR, it) }
        input.includeSpace?.let { field(INCLUDESPACE_DESCRIPTOR, it) }
        input.passwordLength?.let { field(PASSWORDLENGTH_DESCRIPTOR, it) }
        input.requireEachIncludedType?.let { field(REQUIREEACHINCLUDEDTYPE_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy