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

commonMain.aws.sdk.kotlin.services.appsync.serde.CreateGraphqlApiOperationSerializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.appsync.serde

import aws.sdk.kotlin.services.appsync.model.AdditionalAuthenticationProvider
import aws.sdk.kotlin.services.appsync.model.AuthenticationType
import aws.sdk.kotlin.services.appsync.model.CreateGraphqlApiRequest
import aws.sdk.kotlin.services.appsync.model.EnhancedMetricsConfig
import aws.sdk.kotlin.services.appsync.model.GraphQlApiIntrospectionConfig
import aws.sdk.kotlin.services.appsync.model.GraphQlApiType
import aws.sdk.kotlin.services.appsync.model.GraphQlApiVisibility
import aws.sdk.kotlin.services.appsync.model.LambdaAuthorizerConfig
import aws.sdk.kotlin.services.appsync.model.LogConfig
import aws.sdk.kotlin.services.appsync.model.OpenIdConnectConfig
import aws.sdk.kotlin.services.appsync.model.UserPoolConfig
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 CreateGraphqlApiOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: CreateGraphqlApiRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

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

private fun serializeCreateGraphqlApiOperationBody(context: ExecutionContext, input: CreateGraphqlApiRequest): ByteArray {
    val serializer = JsonSerializer()
    val ADDITIONALAUTHENTICATIONPROVIDERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("additionalAuthenticationProviders"))
    val APITYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("apiType"))
    val AUTHENTICATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("authenticationType"))
    val ENHANCEDMETRICSCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("enhancedMetricsConfig"))
    val INTROSPECTIONCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("introspectionConfig"))
    val LAMBDAAUTHORIZERCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("lambdaAuthorizerConfig"))
    val LOGCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("logConfig"))
    val MERGEDAPIEXECUTIONROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("mergedApiExecutionRoleArn"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val OPENIDCONNECTCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("openIDConnectConfig"))
    val OWNERCONTACT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ownerContact"))
    val QUERYDEPTHLIMIT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("queryDepthLimit"))
    val RESOLVERCOUNTLIMIT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("resolverCountLimit"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("tags"))
    val USERPOOLCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("userPoolConfig"))
    val VISIBILITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("visibility"))
    val XRAYENABLED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("xrayEnabled"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ADDITIONALAUTHENTICATIONPROVIDERS_DESCRIPTOR)
        field(APITYPE_DESCRIPTOR)
        field(AUTHENTICATIONTYPE_DESCRIPTOR)
        field(ENHANCEDMETRICSCONFIG_DESCRIPTOR)
        field(INTROSPECTIONCONFIG_DESCRIPTOR)
        field(LAMBDAAUTHORIZERCONFIG_DESCRIPTOR)
        field(LOGCONFIG_DESCRIPTOR)
        field(MERGEDAPIEXECUTIONROLEARN_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(OPENIDCONNECTCONFIG_DESCRIPTOR)
        field(OWNERCONTACT_DESCRIPTOR)
        field(QUERYDEPTHLIMIT_DESCRIPTOR)
        field(RESOLVERCOUNTLIMIT_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(USERPOOLCONFIG_DESCRIPTOR)
        field(VISIBILITY_DESCRIPTOR)
        field(XRAYENABLED_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        if (input.additionalAuthenticationProviders != null) {
            listField(ADDITIONALAUTHENTICATIONPROVIDERS_DESCRIPTOR) {
                for (el0 in input.additionalAuthenticationProviders) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeAdditionalAuthenticationProviderDocument))
                }
            }
        }
        input.apiType?.let { field(APITYPE_DESCRIPTOR, it.value) }
        input.authenticationType?.let { field(AUTHENTICATIONTYPE_DESCRIPTOR, it.value) }
        input.enhancedMetricsConfig?.let { field(ENHANCEDMETRICSCONFIG_DESCRIPTOR, it, ::serializeEnhancedMetricsConfigDocument) }
        input.introspectionConfig?.let { field(INTROSPECTIONCONFIG_DESCRIPTOR, it.value) }
        input.lambdaAuthorizerConfig?.let { field(LAMBDAAUTHORIZERCONFIG_DESCRIPTOR, it, ::serializeLambdaAuthorizerConfigDocument) }
        input.logConfig?.let { field(LOGCONFIG_DESCRIPTOR, it, ::serializeLogConfigDocument) }
        input.mergedApiExecutionRoleArn?.let { field(MERGEDAPIEXECUTIONROLEARN_DESCRIPTOR, it) }
        input.name?.let { field(NAME_DESCRIPTOR, it) }
        input.openIdConnectConfig?.let { field(OPENIDCONNECTCONFIG_DESCRIPTOR, it, ::serializeOpenIdConnectConfigDocument) }
        input.ownerContact?.let { field(OWNERCONTACT_DESCRIPTOR, it) }
        input.queryDepthLimit?.let { field(QUERYDEPTHLIMIT_DESCRIPTOR, it) }
        input.resolverCountLimit?.let { field(RESOLVERCOUNTLIMIT_DESCRIPTOR, it) }
        if (input.tags != null) {
            mapField(TAGS_DESCRIPTOR) {
                input.tags.forEach { (key, value) ->
                    entry(key, value)
                }
            }
        }
        input.userPoolConfig?.let { field(USERPOOLCONFIG_DESCRIPTOR, it, ::serializeUserPoolConfigDocument) }
        input.visibility?.let { field(VISIBILITY_DESCRIPTOR, it.value) }
        input.xrayEnabled?.let { field(XRAYENABLED_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy