import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse , isValidHostname as __isValidHostname , } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , parseEpochTimestamp as __parseEpochTimestamp , serializeFloat as __serializeFloat , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { CreateCliTokenCommandInput , CreateCliTokenCommandOutput } from "../commands/CreateCliTokenCommand" ; import { CreateEnvironmentCommandInput , CreateEnvironmentCommandOutput } from "../commands/CreateEnvironmentCommand" ; import { CreateWebLoginTokenCommandInput , CreateWebLoginTokenCommandOutput , } from "../commands/CreateWebLoginTokenCommand" ; import { DeleteEnvironmentCommandInput , DeleteEnvironmentCommandOutput } from "../commands/DeleteEnvironmentCommand" ; import { GetEnvironmentCommandInput , GetEnvironmentCommandOutput } from "../commands/GetEnvironmentCommand" ; import { ListEnvironmentsCommandInput , ListEnvironmentsCommandOutput } from "../commands/ListEnvironmentsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { PublishMetricsCommandInput , PublishMetricsCommandOutput } from "../commands/PublishMetricsCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateEnvironmentCommandInput , UpdateEnvironmentCommandOutput } from "../commands/UpdateEnvironmentCommand" ; import { AccessDeniedException , Dimension , Environment , InternalServerException , LastUpdate , LoggingConfiguration , LoggingConfigurationInput , MetricDatum , ModuleLoggingConfiguration , ModuleLoggingConfigurationInput , NetworkConfiguration , ResourceNotFoundException , StatisticSet , UpdateError , UpdateNetworkConfigurationInput , ValidationException , } from "../models/models_0" ; export const serializeAws_restJson1CreateCliTokenCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/clitoken/{Name}" ; if ( input . Name !== undefined ) { const labelValue = input . Name ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Name." ) ; } resolvedPath = resolvedPath . replace ( "{Name}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Name." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "env." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateEnvironmentCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/environments/{Name}" ; if ( input . Name !== undefined ) { const labelValue = input . Name ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Name." ) ; } resolvedPath = resolvedPath . replace ( "{Name}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Name." ) ; } let body ; body = JSON . stringify ( { ... ( input . AirflowConfigurationOptions !== undefined && input . AirflowConfigurationOptions !== null && { AirflowConfigurationOptions : serializeAws_restJson1AirflowConfigurationOptions ( input . AirflowConfigurationOptions , context ) , } ) , ... ( input . AirflowVersion !== undefined && input . AirflowVersion !== null && { AirflowVersion : input . AirflowVersion } ) , ... ( input . DagS3Path !== undefined && input . DagS3Path !== null && { DagS3Path : input . DagS3Path } ) , ... ( input . EnvironmentClass !== undefined && input . EnvironmentClass !== null && { EnvironmentClass : input . EnvironmentClass } ) , ... ( input . ExecutionRoleArn !== undefined && input . ExecutionRoleArn !== null && { ExecutionRoleArn : input . ExecutionRoleArn } ) , ... ( input . KmsKey !== undefined && input . KmsKey !== null && { KmsKey : input . KmsKey } ) , ... ( input . LoggingConfiguration !== undefined && input . LoggingConfiguration !== null && { LoggingConfiguration : serializeAws_restJson1LoggingConfigurationInput ( input . LoggingConfiguration , context ) , } ) , ... ( input . MaxWorkers !== undefined && input . MaxWorkers !== null && { MaxWorkers : input . MaxWorkers } ) , ... ( input . MinWorkers !== undefined && input . MinWorkers !== null && { MinWorkers : input . MinWorkers } ) , ... ( input . NetworkConfiguration !== undefined && input . NetworkConfiguration !== null && { NetworkConfiguration : serializeAws_restJson1NetworkConfiguration ( input . NetworkConfiguration , context ) , } ) , ... ( input . PluginsS3ObjectVersion !== undefined && input . PluginsS3ObjectVersion !== null && { PluginsS3ObjectVersion : input . PluginsS3ObjectVersion } ) , ... ( input . PluginsS3Path !== undefined && input . PluginsS3Path !== null && { PluginsS3Path : input . PluginsS3Path } ) , ... ( input . RequirementsS3ObjectVersion !== undefined && input . RequirementsS3ObjectVersion !== null && { RequirementsS3ObjectVersion : input . RequirementsS3ObjectVersion } ) , ... ( input . RequirementsS3Path !== undefined && input . RequirementsS3Path !== null && { RequirementsS3Path : input . RequirementsS3Path } ) , ... ( input . Schedulers !== undefined && input . Schedulers !== null && { Schedulers : input . Schedulers } ) , ... ( input . SourceBucketArn !== undefined && input . SourceBucketArn !== null && { SourceBucketArn : input . SourceBucketArn } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , ... ( input . WebserverAccessMode !== undefined && input . WebserverAccessMode !== null && { WebserverAccessMode : input . WebserverAccessMode } ) , ... ( input . WeeklyMaintenanceWindowStart !== undefined && input . WeeklyMaintenanceWindowStart !== null && { WeeklyMaintenanceWindowStart : input . WeeklyMaintenanceWindowStart , } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateWebLoginTokenCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/webtoken/{Name}" ; if ( input . Name !== undefined ) { const labelValue = input . Name ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Name." ) ; } resolvedPath = resolvedPath . replace ( "{Name}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Name." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "env." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteEnvironmentCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/environments/{Name}" ; if ( input . Name !== undefined ) { const labelValue = input . Name ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Name." ) ; } resolvedPath = resolvedPath . replace ( "{Name}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Name." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetEnvironmentCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/environments/{Name}" ; if ( input . Name !== undefined ) { const labelValue = input . Name ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Name." ) ; } resolvedPath = resolvedPath . replace ( "{Name}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Name." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListEnvironmentsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/environments" ; const query = { ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . MaxResults !== undefined && { MaxResults : input . MaxResults . toString ( ) } ) , } ; let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PublishMetricsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/metrics/environments/{EnvironmentName}" ; if ( input . EnvironmentName !== undefined ) { const labelValue = input . EnvironmentName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: EnvironmentName." ) ; } resolvedPath = resolvedPath . replace ( "{EnvironmentName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: EnvironmentName." ) ; } let body ; body = JSON . stringify ( { ... ( input . MetricData !== undefined && input . MetricData !== null && { MetricData : serializeAws_restJson1MetricData ( input . MetricData , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "ops." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } const query = { ... ( input . tagKeys !== undefined && { tagKeys : ( input . tagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateEnvironmentCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/environments/{Name}" ; if ( input . Name !== undefined ) { const labelValue = input . Name ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Name." ) ; } resolvedPath = resolvedPath . replace ( "{Name}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Name." ) ; } let body ; body = JSON . stringify ( { ... ( input . AirflowConfigurationOptions !== undefined && input . AirflowConfigurationOptions !== null && { AirflowConfigurationOptions : serializeAws_restJson1AirflowConfigurationOptions ( input . AirflowConfigurationOptions , context ) , } ) , ... ( input . AirflowVersion !== undefined && input . AirflowVersion !== null && { AirflowVersion : input . AirflowVersion } ) , ... ( input . DagS3Path !== undefined && input . DagS3Path !== null && { DagS3Path : input . DagS3Path } ) , ... ( input . EnvironmentClass !== undefined && input . EnvironmentClass !== null && { EnvironmentClass : input . EnvironmentClass } ) , ... ( input . ExecutionRoleArn !== undefined && input . ExecutionRoleArn !== null && { ExecutionRoleArn : input . ExecutionRoleArn } ) , ... ( input . LoggingConfiguration !== undefined && input . LoggingConfiguration !== null && { LoggingConfiguration : serializeAws_restJson1LoggingConfigurationInput ( input . LoggingConfiguration , context ) , } ) , ... ( input . MaxWorkers !== undefined && input . MaxWorkers !== null && { MaxWorkers : input . MaxWorkers } ) , ... ( input . MinWorkers !== undefined && input . MinWorkers !== null && { MinWorkers : input . MinWorkers } ) , ... ( input . NetworkConfiguration !== undefined && input . NetworkConfiguration !== null && { NetworkConfiguration : serializeAws_restJson1UpdateNetworkConfigurationInput ( input . NetworkConfiguration , context ) , } ) , ... ( input . PluginsS3ObjectVersion !== undefined && input . PluginsS3ObjectVersion !== null && { PluginsS3ObjectVersion : input . PluginsS3ObjectVersion } ) , ... ( input . PluginsS3Path !== undefined && input . PluginsS3Path !== null && { PluginsS3Path : input . PluginsS3Path } ) , ... ( input . RequirementsS3ObjectVersion !== undefined && input . RequirementsS3ObjectVersion !== null && { RequirementsS3ObjectVersion : input . RequirementsS3ObjectVersion } ) , ... ( input . RequirementsS3Path !== undefined && input . RequirementsS3Path !== null && { RequirementsS3Path : input . RequirementsS3Path } ) , ... ( input . Schedulers !== undefined && input . Schedulers !== null && { Schedulers : input . Schedulers } ) , ... ( input . SourceBucketArn !== undefined && input . SourceBucketArn !== null && { SourceBucketArn : input . SourceBucketArn } ) , ... ( input . WebserverAccessMode !== undefined && input . WebserverAccessMode !== null && { WebserverAccessMode : input . WebserverAccessMode } ) , ... ( input . WeeklyMaintenanceWindowStart !== undefined && input . WeeklyMaintenanceWindowStart !== null && { WeeklyMaintenanceWindowStart : input . WeeklyMaintenanceWindowStart , } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "api." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CreateCliTokenCommand = async ( output , context ) : Promise < CreateCliTokenCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateCliTokenCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CliToken : undefined , WebServerHostname : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CliToken !== undefined && data . CliToken !== null ) { contents . CliToken = __expectString ( data . CliToken ) ; } if ( data . WebServerHostname !== undefined && data . WebServerHostname !== null ) { contents . WebServerHostname = __expectString ( data . WebServerHostname ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateCliTokenCommandError = async ( output , context ) : Promise < CreateCliTokenCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ResourceNotFoundException" : case "com.amazonaws.mwaa#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateEnvironmentCommand = async ( output , context ) : Promise < CreateEnvironmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateEnvironmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateEnvironmentCommandError = async ( output , context ) : Promise < CreateEnvironmentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1CreateWebLoginTokenCommand = async ( output , context ) : Promise < CreateWebLoginTokenCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateWebLoginTokenCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , WebServerHostname : undefined , WebToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . WebServerHostname !== undefined && data . WebServerHostname !== null ) { contents . WebServerHostname = __expectString ( data . WebServerHostname ) ; } if ( data . WebToken !== undefined && data . WebToken !== null ) { contents . WebToken = __expectString ( data . WebToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateWebLoginTokenCommandError = async ( output , context ) : Promise < CreateWebLoginTokenCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.mwaa#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mwaa#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteEnvironmentCommand = async ( output , context ) : Promise < DeleteEnvironmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteEnvironmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteEnvironmentCommandError = async ( output , context ) : Promise < DeleteEnvironmentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mwaa#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1GetEnvironmentCommand = async ( output , context ) : Promise < GetEnvironmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetEnvironmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Environment : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Environment !== undefined && data . Environment !== null ) { contents . Environment = deserializeAws_restJson1Environment ( data . Environment , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetEnvironmentCommandError = async ( output , context ) : Promise < GetEnvironmentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mwaa#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListEnvironmentsCommand = async ( output , context ) : Promise < ListEnvironmentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListEnvironmentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Environments : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Environments !== undefined && data . Environments !== null ) { contents . Environments = deserializeAws_restJson1EnvironmentList ( data . Environments , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListEnvironmentsCommandError = async ( output , context ) : Promise < ListEnvironmentsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mwaa#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PublishMetricsCommand = async ( output , context ) : Promise < PublishMetricsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PublishMetricsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PublishMetricsCommandError = async ( output , context ) : Promise < PublishMetricsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mwaa#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mwaa#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UpdateEnvironmentCommand = async ( output , context ) : Promise < UpdateEnvironmentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateEnvironmentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Arn !== undefined && data . Arn !== null ) { contents . Arn = __expectString ( data . Arn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateEnvironmentCommandError = async ( output , context ) : Promise < UpdateEnvironmentCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.mwaa#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.mwaa#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.mwaa#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_restJson1AccessDeniedExceptionResponse = async ( parsedOutput , context ) : Promise < AccessDeniedException > => { const contents = { name : "AccessDeniedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const serializeAws_restJson1AirflowConfigurationOptions = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1Dimension = ( input , context ) : any => { return { ... ( input . Name !== undefined && input . Name !== null && { Name : input . Name } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_restJson1Dimensions = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Dimension ( entry , context ) ; } ) ; } ; const serializeAws_restJson1LoggingConfigurationInput = ( input , context ) : any => { return { ... ( input . DagProcessingLogs !== undefined && input . DagProcessingLogs !== null && { DagProcessingLogs : serializeAws_restJson1ModuleLoggingConfigurationInput ( input . DagProcessingLogs , context ) , } ) , ... ( input . SchedulerLogs !== undefined && input . SchedulerLogs !== null && { SchedulerLogs : serializeAws_restJson1ModuleLoggingConfigurationInput ( input . SchedulerLogs , context ) , } ) , ... ( input . TaskLogs !== undefined && input . TaskLogs !== null && { TaskLogs : serializeAws_restJson1ModuleLoggingConfigurationInput ( input . TaskLogs , context ) , } ) , ... ( input . WebserverLogs !== undefined && input . WebserverLogs !== null && { WebserverLogs : serializeAws_restJson1ModuleLoggingConfigurationInput ( input . WebserverLogs , context ) , } ) , ... ( input . WorkerLogs !== undefined && input . WorkerLogs !== null && { WorkerLogs : serializeAws_restJson1ModuleLoggingConfigurationInput ( input . WorkerLogs , context ) , } ) , } ; } ; const serializeAws_restJson1MetricData = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1MetricDatum ( entry , context ) ; } ) ; } ; const serializeAws_restJson1MetricDatum = ( input , context ) : any => { return { ... ( input . Dimensions !== undefined && input . Dimensions !== null && { Dimensions : serializeAws_restJson1Dimensions ( input . Dimensions , context ) } ) , ... ( input . MetricName !== undefined && input . MetricName !== null && { MetricName : input . MetricName } ) , ... ( input . StatisticValues !== undefined && input . StatisticValues !== null && { StatisticValues : serializeAws_restJson1StatisticSet ( input . StatisticValues , context ) , } ) , ... ( input . Timestamp !== undefined && input . Timestamp !== null && { Timestamp : Math . round ( input . Timestamp . getTime ( ) / 1000 ) } ) , ... ( input . Unit !== undefined && input . Unit !== null && { Unit : input . Unit } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : __serializeFloat ( input . Value ) } ) , } ; } ; const serializeAws_restJson1ModuleLoggingConfigurationInput = ( input , context ) : any => { return { ... ( input . Enabled !== undefined && input . Enabled !== null && { Enabled : input . Enabled } ) , ... ( input . LogLevel !== undefined && input . LogLevel !== null && { LogLevel : input . LogLevel } ) , } ; } ; const serializeAws_restJson1NetworkConfiguration = ( input , context ) : any => { return { ... ( input . SecurityGroupIds !== undefined && input . SecurityGroupIds !== null && { SecurityGroupIds : serializeAws_restJson1SecurityGroupList ( input . SecurityGroupIds , context ) , } ) , ... ( input . SubnetIds !== undefined && input . SubnetIds !== null && { SubnetIds : serializeAws_restJson1SubnetList ( input . SubnetIds , context ) } ) , } ; } ; const serializeAws_restJson1SecurityGroupList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1StatisticSet = ( input , context ) : any => { return { ... ( input . Maximum !== undefined && input . Maximum !== null && { Maximum : __serializeFloat ( input . Maximum ) } ) , ... ( input . Minimum !== undefined && input . Minimum !== null && { Minimum : __serializeFloat ( input . Minimum ) } ) , ... ( input . SampleCount !== undefined && input . SampleCount !== null && { SampleCount : input . SampleCount } ) , ... ( input . Sum !== undefined && input . Sum !== null && { Sum : __serializeFloat ( input . Sum ) } ) , } ; } ; const serializeAws_restJson1SubnetList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1TagMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1UpdateNetworkConfigurationInput = ( input , context ) : any => { return { ... ( input . SecurityGroupIds !== undefined && input . SecurityGroupIds !== null && { SecurityGroupIds : serializeAws_restJson1SecurityGroupList ( input . SecurityGroupIds , context ) , } ) , } ; } ; const deserializeAws_restJson1AirflowConfigurationOptions = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1Environment = ( output , context ) : Environment => { return { AirflowConfigurationOptions : output . AirflowConfigurationOptions !== undefined && output . AirflowConfigurationOptions !== null ? deserializeAws_restJson1AirflowConfigurationOptions ( output . AirflowConfigurationOptions , context ) : undefined , AirflowVersion : __expectString ( output . AirflowVersion ) , Arn : __expectString ( output . Arn ) , CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , DagS3Path : __expectString ( output . DagS3Path ) , EnvironmentClass : __expectString ( output . EnvironmentClass ) , ExecutionRoleArn : __expectString ( output . ExecutionRoleArn ) , KmsKey : __expectString ( output . KmsKey ) , LastUpdate : output . LastUpdate !== undefined && output . LastUpdate !== null ? deserializeAws_restJson1LastUpdate ( output . LastUpdate , context ) : undefined , LoggingConfiguration : output . LoggingConfiguration !== undefined && output . LoggingConfiguration !== null ? deserializeAws_restJson1LoggingConfiguration ( output . LoggingConfiguration , context ) : undefined , MaxWorkers : __expectInt32 ( output . MaxWorkers ) , MinWorkers : __expectInt32 ( output . MinWorkers ) , Name : __expectString ( output . Name ) , NetworkConfiguration : output . NetworkConfiguration !== undefined && output . NetworkConfiguration !== null ? deserializeAws_restJson1NetworkConfiguration ( output . NetworkConfiguration , context ) : undefined , PluginsS3ObjectVersion : __expectString ( output . PluginsS3ObjectVersion ) , PluginsS3Path : __expectString ( output . PluginsS3Path ) , RequirementsS3ObjectVersion : __expectString ( output . RequirementsS3ObjectVersion ) , RequirementsS3Path : __expectString ( output . RequirementsS3Path ) , Schedulers : __expectInt32 ( output . Schedulers ) , ServiceRoleArn : __expectString ( output . ServiceRoleArn ) , SourceBucketArn : __expectString ( output . SourceBucketArn ) , Status : __expectString ( output . Status ) , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1TagMap ( output . Tags , context ) : undefined , WebserverAccessMode : __expectString ( output . WebserverAccessMode ) , WebserverUrl : __expectString ( output . WebserverUrl ) , WeeklyMaintenanceWindowStart : __expectString ( output . WeeklyMaintenanceWindowStart ) , } as any ; } ; const deserializeAws_restJson1EnvironmentList = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1LastUpdate = ( output , context ) : LastUpdate => { return { CreatedAt : output . CreatedAt !== undefined && output . CreatedAt !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreatedAt ) ) ) : undefined , Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1UpdateError ( output . Error , context ) : undefined , Source : __expectString ( output . Source ) , Status : __expectString ( output . Status ) , } as any ; } ; const deserializeAws_restJson1LoggingConfiguration = ( output , context ) : LoggingConfiguration => { return { DagProcessingLogs : output . DagProcessingLogs !== undefined && output . DagProcessingLogs !== null ? deserializeAws_restJson1ModuleLoggingConfiguration ( output . DagProcessingLogs , context ) : undefined , SchedulerLogs : output . SchedulerLogs !== undefined && output . SchedulerLogs !== null ? deserializeAws_restJson1ModuleLoggingConfiguration ( output . SchedulerLogs , context ) : undefined , TaskLogs : output . TaskLogs !== undefined && output . TaskLogs !== null ? deserializeAws_restJson1ModuleLoggingConfiguration ( output . TaskLogs , context ) : undefined , WebserverLogs : output . WebserverLogs !== undefined && output . WebserverLogs !== null ? deserializeAws_restJson1ModuleLoggingConfiguration ( output . WebserverLogs , context ) : undefined , WorkerLogs : output . WorkerLogs !== undefined && output . WorkerLogs !== null ? deserializeAws_restJson1ModuleLoggingConfiguration ( output . WorkerLogs , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ModuleLoggingConfiguration = ( output , context ) : ModuleLoggingConfiguration => { return { CloudWatchLogGroupArn : __expectString ( output . CloudWatchLogGroupArn ) , Enabled : __expectBoolean ( output . Enabled ) , LogLevel : __expectString ( output . LogLevel ) , } as any ; } ; const deserializeAws_restJson1NetworkConfiguration = ( output , context ) : NetworkConfiguration => { return { SecurityGroupIds : output . SecurityGroupIds !== undefined && output . SecurityGroupIds !== null ? deserializeAws_restJson1SecurityGroupList ( output . SecurityGroupIds , context ) : undefined , SubnetIds : output . SubnetIds !== undefined && output . SubnetIds !== null ? deserializeAws_restJson1SubnetList ( output . SubnetIds , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SecurityGroupList = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1SubnetList = ( output , context ) : string [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1TagMap = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1UpdateError = ( output , context ) : UpdateError => { return { ErrorCode : __expectString ( output . ErrorCode ) , ErrorMessage : __expectString ( output . ErrorMessage ) , } as any ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const isSerializableHeaderValue = ( value ) : boolean => value !== undefined && value !== null && value !== "" && ( ! Object . getOwnPropertyNames ( value ) . includes ( "length" ) || value . length != 0 ) && ( ! Object . getOwnPropertyNames ( value ) . includes ( "size" ) || value . size != 0 ) ; const parseBody = ( streamBody , context ) : any => collectBodyString ( streamBody , context ) . then ( ( encoded ) => { if ( encoded . length ) { return JSON . parse ( encoded ) ; } return { } ; } ) ; /**
 * Load an error code for the aws.rest-json-1.1 protocol.
 */ const loadRestJsonErrorCode = ( output , data ) : string => { const findKey = ( object , key ) => Object . keys ( object ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ; const sanitizeErrorCode = ( rawValue ) : string => { let cleanValue = rawValue ; if ( cleanValue . indexOf ( ":" ) >= 0 ) { cleanValue = cleanValue . split ( ":" ) [ 0 ] ; } if ( cleanValue . indexOf ( "#" ) >= 0 ) { cleanValue = cleanValue . split ( "#" ) [ 1 ] ; } return cleanValue ; } ; const headerKey = findKey ( output . headers , "x-amzn-errortype" ) ; if ( headerKey !== undefined ) { return sanitizeErrorCode ( output . headers [ headerKey ] ) ; } if ( data . code !== undefined ) { return sanitizeErrorCode ( data . code ) ; } if ( data [ "__type" ] !== undefined ) { return sanitizeErrorCode ( data [ "__type" ] ) ; } return "" ; } ;