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

commonMain.aws.sdk.kotlin.services.codebuild.serde.StartBuildOperationSerializer.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.BuildStatusConfig
import aws.sdk.kotlin.services.codebuild.model.ComputeType
import aws.sdk.kotlin.services.codebuild.model.EnvironmentType
import aws.sdk.kotlin.services.codebuild.model.EnvironmentVariable
import aws.sdk.kotlin.services.codebuild.model.GitSubmodulesConfig
import aws.sdk.kotlin.services.codebuild.model.ImagePullCredentialsType
import aws.sdk.kotlin.services.codebuild.model.LogsConfig
import aws.sdk.kotlin.services.codebuild.model.ProjectArtifacts
import aws.sdk.kotlin.services.codebuild.model.ProjectCache
import aws.sdk.kotlin.services.codebuild.model.ProjectFleet
import aws.sdk.kotlin.services.codebuild.model.ProjectSource
import aws.sdk.kotlin.services.codebuild.model.ProjectSourceVersion
import aws.sdk.kotlin.services.codebuild.model.RegistryCredential
import aws.sdk.kotlin.services.codebuild.model.SourceAuth
import aws.sdk.kotlin.services.codebuild.model.SourceType
import aws.sdk.kotlin.services.codebuild.model.StartBuildRequest
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 StartBuildOperationSerializer: HttpSerializer.NonStreaming {
    override fun serialize(context: ExecutionContext, input: StartBuildRequest): HttpRequestBuilder {
        val builder = HttpRequestBuilder()
        builder.method = HttpMethod.POST

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

        val payload = serializeStartBuildOperationBody(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 serializeStartBuildOperationBody(context: ExecutionContext, input: StartBuildRequest): ByteArray {
    val serializer = JsonSerializer()
    val ARTIFACTSOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("artifactsOverride"))
    val AUTORETRYLIMITOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("autoRetryLimitOverride"))
    val BUILDSTATUSCONFIGOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("buildStatusConfigOverride"))
    val BUILDSPECOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("buildspecOverride"))
    val CACHEOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("cacheOverride"))
    val CERTIFICATEOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("certificateOverride"))
    val COMPUTETYPEOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("computeTypeOverride"))
    val DEBUGSESSIONENABLED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("debugSessionEnabled"))
    val ENCRYPTIONKEYOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("encryptionKeyOverride"))
    val ENVIRONMENTTYPEOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("environmentTypeOverride"))
    val ENVIRONMENTVARIABLESOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("environmentVariablesOverride"))
    val FLEETOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("fleetOverride"))
    val GITCLONEDEPTHOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("gitCloneDepthOverride"))
    val GITSUBMODULESCONFIGOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("gitSubmodulesConfigOverride"))
    val IDEMPOTENCYTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("idempotencyToken"))
    val IMAGEOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("imageOverride"))
    val IMAGEPULLCREDENTIALSTYPEOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("imagePullCredentialsTypeOverride"))
    val INSECURESSLOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("insecureSslOverride"))
    val LOGSCONFIGOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("logsConfigOverride"))
    val PRIVILEGEDMODEOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("privilegedModeOverride"))
    val PROJECTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("projectName"))
    val QUEUEDTIMEOUTINMINUTESOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("queuedTimeoutInMinutesOverride"))
    val REGISTRYCREDENTIALOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("registryCredentialOverride"))
    val REPORTBUILDSTATUSOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("reportBuildStatusOverride"))
    val SECONDARYARTIFACTSOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("secondaryArtifactsOverride"))
    val SECONDARYSOURCESOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("secondarySourcesOverride"))
    val SECONDARYSOURCESVERSIONOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("secondarySourcesVersionOverride"))
    val SERVICEROLEOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("serviceRoleOverride"))
    val SOURCEAUTHOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("sourceAuthOverride"))
    val SOURCELOCATIONOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("sourceLocationOverride"))
    val SOURCETYPEOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("sourceTypeOverride"))
    val SOURCEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("sourceVersion"))
    val TIMEOUTINMINUTESOVERRIDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("timeoutInMinutesOverride"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ARTIFACTSOVERRIDE_DESCRIPTOR)
        field(AUTORETRYLIMITOVERRIDE_DESCRIPTOR)
        field(BUILDSTATUSCONFIGOVERRIDE_DESCRIPTOR)
        field(BUILDSPECOVERRIDE_DESCRIPTOR)
        field(CACHEOVERRIDE_DESCRIPTOR)
        field(CERTIFICATEOVERRIDE_DESCRIPTOR)
        field(COMPUTETYPEOVERRIDE_DESCRIPTOR)
        field(DEBUGSESSIONENABLED_DESCRIPTOR)
        field(ENCRYPTIONKEYOVERRIDE_DESCRIPTOR)
        field(ENVIRONMENTTYPEOVERRIDE_DESCRIPTOR)
        field(ENVIRONMENTVARIABLESOVERRIDE_DESCRIPTOR)
        field(FLEETOVERRIDE_DESCRIPTOR)
        field(GITCLONEDEPTHOVERRIDE_DESCRIPTOR)
        field(GITSUBMODULESCONFIGOVERRIDE_DESCRIPTOR)
        field(IDEMPOTENCYTOKEN_DESCRIPTOR)
        field(IMAGEOVERRIDE_DESCRIPTOR)
        field(IMAGEPULLCREDENTIALSTYPEOVERRIDE_DESCRIPTOR)
        field(INSECURESSLOVERRIDE_DESCRIPTOR)
        field(LOGSCONFIGOVERRIDE_DESCRIPTOR)
        field(PRIVILEGEDMODEOVERRIDE_DESCRIPTOR)
        field(PROJECTNAME_DESCRIPTOR)
        field(QUEUEDTIMEOUTINMINUTESOVERRIDE_DESCRIPTOR)
        field(REGISTRYCREDENTIALOVERRIDE_DESCRIPTOR)
        field(REPORTBUILDSTATUSOVERRIDE_DESCRIPTOR)
        field(SECONDARYARTIFACTSOVERRIDE_DESCRIPTOR)
        field(SECONDARYSOURCESOVERRIDE_DESCRIPTOR)
        field(SECONDARYSOURCESVERSIONOVERRIDE_DESCRIPTOR)
        field(SERVICEROLEOVERRIDE_DESCRIPTOR)
        field(SOURCEAUTHOVERRIDE_DESCRIPTOR)
        field(SOURCELOCATIONOVERRIDE_DESCRIPTOR)
        field(SOURCETYPEOVERRIDE_DESCRIPTOR)
        field(SOURCEVERSION_DESCRIPTOR)
        field(TIMEOUTINMINUTESOVERRIDE_DESCRIPTOR)
    }

    serializer.serializeStruct(OBJ_DESCRIPTOR) {
        input.artifactsOverride?.let { field(ARTIFACTSOVERRIDE_DESCRIPTOR, it, ::serializeProjectArtifactsDocument) }
        input.autoRetryLimitOverride?.let { field(AUTORETRYLIMITOVERRIDE_DESCRIPTOR, it) }
        input.buildStatusConfigOverride?.let { field(BUILDSTATUSCONFIGOVERRIDE_DESCRIPTOR, it, ::serializeBuildStatusConfigDocument) }
        input.buildspecOverride?.let { field(BUILDSPECOVERRIDE_DESCRIPTOR, it) }
        input.cacheOverride?.let { field(CACHEOVERRIDE_DESCRIPTOR, it, ::serializeProjectCacheDocument) }
        input.certificateOverride?.let { field(CERTIFICATEOVERRIDE_DESCRIPTOR, it) }
        input.computeTypeOverride?.let { field(COMPUTETYPEOVERRIDE_DESCRIPTOR, it.value) }
        input.debugSessionEnabled?.let { field(DEBUGSESSIONENABLED_DESCRIPTOR, it) }
        input.encryptionKeyOverride?.let { field(ENCRYPTIONKEYOVERRIDE_DESCRIPTOR, it) }
        input.environmentTypeOverride?.let { field(ENVIRONMENTTYPEOVERRIDE_DESCRIPTOR, it.value) }
        if (input.environmentVariablesOverride != null) {
            listField(ENVIRONMENTVARIABLESOVERRIDE_DESCRIPTOR) {
                for (el0 in input.environmentVariablesOverride) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeEnvironmentVariableDocument))
                }
            }
        }
        input.fleetOverride?.let { field(FLEETOVERRIDE_DESCRIPTOR, it, ::serializeProjectFleetDocument) }
        input.gitCloneDepthOverride?.let { field(GITCLONEDEPTHOVERRIDE_DESCRIPTOR, it) }
        input.gitSubmodulesConfigOverride?.let { field(GITSUBMODULESCONFIGOVERRIDE_DESCRIPTOR, it, ::serializeGitSubmodulesConfigDocument) }
        input.idempotencyToken?.let { field(IDEMPOTENCYTOKEN_DESCRIPTOR, it) }
        input.imageOverride?.let { field(IMAGEOVERRIDE_DESCRIPTOR, it) }
        input.imagePullCredentialsTypeOverride?.let { field(IMAGEPULLCREDENTIALSTYPEOVERRIDE_DESCRIPTOR, it.value) }
        input.insecureSslOverride?.let { field(INSECURESSLOVERRIDE_DESCRIPTOR, it) }
        input.logsConfigOverride?.let { field(LOGSCONFIGOVERRIDE_DESCRIPTOR, it, ::serializeLogsConfigDocument) }
        input.privilegedModeOverride?.let { field(PRIVILEGEDMODEOVERRIDE_DESCRIPTOR, it) }
        input.projectName?.let { field(PROJECTNAME_DESCRIPTOR, it) }
        input.queuedTimeoutInMinutesOverride?.let { field(QUEUEDTIMEOUTINMINUTESOVERRIDE_DESCRIPTOR, it) }
        input.registryCredentialOverride?.let { field(REGISTRYCREDENTIALOVERRIDE_DESCRIPTOR, it, ::serializeRegistryCredentialDocument) }
        input.reportBuildStatusOverride?.let { field(REPORTBUILDSTATUSOVERRIDE_DESCRIPTOR, it) }
        if (input.secondaryArtifactsOverride != null) {
            listField(SECONDARYARTIFACTSOVERRIDE_DESCRIPTOR) {
                for (el0 in input.secondaryArtifactsOverride) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeProjectArtifactsDocument))
                }
            }
        }
        if (input.secondarySourcesOverride != null) {
            listField(SECONDARYSOURCESOVERRIDE_DESCRIPTOR) {
                for (el0 in input.secondarySourcesOverride) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeProjectSourceDocument))
                }
            }
        }
        if (input.secondarySourcesVersionOverride != null) {
            listField(SECONDARYSOURCESVERSIONOVERRIDE_DESCRIPTOR) {
                for (el0 in input.secondarySourcesVersionOverride) {
                    serializeSdkSerializable(asSdkSerializable(el0, ::serializeProjectSourceVersionDocument))
                }
            }
        }
        input.serviceRoleOverride?.let { field(SERVICEROLEOVERRIDE_DESCRIPTOR, it) }
        input.sourceAuthOverride?.let { field(SOURCEAUTHOVERRIDE_DESCRIPTOR, it, ::serializeSourceAuthDocument) }
        input.sourceLocationOverride?.let { field(SOURCELOCATIONOVERRIDE_DESCRIPTOR, it) }
        input.sourceTypeOverride?.let { field(SOURCETYPEOVERRIDE_DESCRIPTOR, it.value) }
        input.sourceVersion?.let { field(SOURCEVERSION_DESCRIPTOR, it) }
        input.timeoutInMinutesOverride?.let { field(TIMEOUTINMINUTESOVERRIDE_DESCRIPTOR, it) }
    }
    return serializer.toByteArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy