import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectInt32 as __expectInt32 , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectString as __expectString , parseEpochTimestamp as __parseEpochTimestamp , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , HeaderBag as __HeaderBag , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { CreateEnvironmentEC2CommandInput , CreateEnvironmentEC2CommandOutput , } from "../commands/CreateEnvironmentEC2Command" ; import { CreateEnvironmentMembershipCommandInput , CreateEnvironmentMembershipCommandOutput , } from "../commands/CreateEnvironmentMembershipCommand" ; import { DeleteEnvironmentCommandInput , DeleteEnvironmentCommandOutput } from "../commands/DeleteEnvironmentCommand" ; import { DeleteEnvironmentMembershipCommandInput , DeleteEnvironmentMembershipCommandOutput , } from "../commands/DeleteEnvironmentMembershipCommand" ; import { DescribeEnvironmentMembershipsCommandInput , DescribeEnvironmentMembershipsCommandOutput , } from "../commands/DescribeEnvironmentMembershipsCommand" ; import { DescribeEnvironmentsCommandInput , DescribeEnvironmentsCommandOutput , } from "../commands/DescribeEnvironmentsCommand" ; import { DescribeEnvironmentStatusCommandInput , DescribeEnvironmentStatusCommandOutput , } from "../commands/DescribeEnvironmentStatusCommand" ; import { ListEnvironmentsCommandInput , ListEnvironmentsCommandOutput } from "../commands/ListEnvironmentsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateEnvironmentCommandInput , UpdateEnvironmentCommandOutput } from "../commands/UpdateEnvironmentCommand" ; import { UpdateEnvironmentMembershipCommandInput , UpdateEnvironmentMembershipCommandOutput , } from "../commands/UpdateEnvironmentMembershipCommand" ; import { BadRequestException , ConcurrentAccessException , ConflictException , CreateEnvironmentEC2Request , CreateEnvironmentEC2Result , CreateEnvironmentMembershipRequest , CreateEnvironmentMembershipResult , DeleteEnvironmentMembershipRequest , DeleteEnvironmentMembershipResult , DeleteEnvironmentRequest , DeleteEnvironmentResult , DescribeEnvironmentMembershipsRequest , DescribeEnvironmentMembershipsResult , DescribeEnvironmentsRequest , DescribeEnvironmentsResult , DescribeEnvironmentStatusRequest , DescribeEnvironmentStatusResult , Environment , EnvironmentLifecycle , EnvironmentMember , ForbiddenException , InternalServerErrorException , LimitExceededException , ListEnvironmentsRequest , ListEnvironmentsResult , ListTagsForResourceRequest , ListTagsForResourceResponse , NotFoundException , Permissions , Tag , TagResourceRequest , TagResourceResponse , TooManyRequestsException , UntagResourceRequest , UntagResourceResponse , UpdateEnvironmentMembershipRequest , UpdateEnvironmentMembershipResult , UpdateEnvironmentRequest , UpdateEnvironmentResult , } from "../models/models_0" ; export const serializeAws_json1_1CreateEnvironmentEC2Command = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.CreateEnvironmentEC2" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateEnvironmentEC2Request ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1CreateEnvironmentMembershipCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.CreateEnvironmentMembership" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateEnvironmentMembershipRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteEnvironmentCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.DeleteEnvironment" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteEnvironmentRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteEnvironmentMembershipCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.DeleteEnvironmentMembership" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteEnvironmentMembershipRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeEnvironmentMembershipsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.DescribeEnvironmentMemberships" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeEnvironmentMembershipsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeEnvironmentsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.DescribeEnvironments" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeEnvironmentsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeEnvironmentStatusCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.DescribeEnvironmentStatus" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeEnvironmentStatusRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListEnvironmentsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.ListEnvironments" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListEnvironmentsRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.ListTagsForResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListTagsForResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.TagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1TagResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.UntagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UntagResourceRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateEnvironmentCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.UpdateEnvironment" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateEnvironmentRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateEnvironmentMembershipCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCloud9WorkspaceManagementService.UpdateEnvironmentMembership" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UpdateEnvironmentMembershipRequest ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const deserializeAws_json1_1CreateEnvironmentEC2Command = async ( output , context ) : Promise < CreateEnvironmentEC2CommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateEnvironmentEC2CommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateEnvironmentEC2Result ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateEnvironmentEC2CommandError = async ( output , context ) : Promise < CreateEnvironmentEC2CommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1CreateEnvironmentMembershipCommand = async ( output , context ) : Promise < CreateEnvironmentMembershipCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateEnvironmentMembershipCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1CreateEnvironmentMembershipResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateEnvironmentMembershipCommandError = async ( output , context ) : Promise < CreateEnvironmentMembershipCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1DeleteEnvironmentCommand = async ( output , context ) : Promise < DeleteEnvironmentCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteEnvironmentCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteEnvironmentResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteEnvironmentCommandError = 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 "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1DeleteEnvironmentMembershipCommand = async ( output , context ) : Promise < DeleteEnvironmentMembershipCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteEnvironmentMembershipCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteEnvironmentMembershipResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteEnvironmentMembershipCommandError = async ( output , context ) : Promise < DeleteEnvironmentMembershipCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1DescribeEnvironmentMembershipsCommand = async ( output , context ) : Promise < DescribeEnvironmentMembershipsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeEnvironmentMembershipsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeEnvironmentMembershipsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeEnvironmentMembershipsCommandError = async ( output , context ) : Promise < DescribeEnvironmentMembershipsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1DescribeEnvironmentsCommand = async ( output , context ) : Promise < DescribeEnvironmentsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeEnvironmentsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeEnvironmentsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeEnvironmentsCommandError = async ( output , context ) : Promise < DescribeEnvironmentsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1DescribeEnvironmentStatusCommand = async ( output , context ) : Promise < DescribeEnvironmentStatusCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeEnvironmentStatusCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DescribeEnvironmentStatusResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeEnvironmentStatusCommandError = async ( output , context ) : Promise < DescribeEnvironmentStatusCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1ListEnvironmentsCommand = async ( output , context ) : Promise < ListEnvironmentsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListEnvironmentsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListEnvironmentsResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListEnvironmentsCommandError = 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 "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListTagsForResourceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListTagsForResourceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListTagsForResourceCommandError = 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 "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( 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_json1_1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1TagResourceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1TagResourceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1TagResourceCommandError = 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 "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentAccessException" : case "com.amazonaws.cloud9#ConcurrentAccessException" : response = { ... ( await deserializeAws_json1_1ConcurrentAccessExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( 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_json1_1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UntagResourceCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UntagResourceResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UntagResourceCommandError = 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 "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConcurrentAccessException" : case "com.amazonaws.cloud9#ConcurrentAccessException" : response = { ... ( await deserializeAws_json1_1ConcurrentAccessExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( 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_json1_1UpdateEnvironmentCommand = async ( output , context ) : Promise < UpdateEnvironmentCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateEnvironmentCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateEnvironmentResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateEnvironmentCommandError = 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 "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1UpdateEnvironmentMembershipCommand = async ( output , context ) : Promise < UpdateEnvironmentMembershipCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateEnvironmentMembershipCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1UpdateEnvironmentMembershipResult ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateEnvironmentMembershipCommandError = async ( output , context ) : Promise < UpdateEnvironmentMembershipCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequestException" : case "com.amazonaws.cloud9#BadRequestException" : response = { ... ( await deserializeAws_json1_1BadRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.cloud9#ConflictException" : response = { ... ( await deserializeAws_json1_1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ForbiddenException" : case "com.amazonaws.cloud9#ForbiddenException" : response = { ... ( await deserializeAws_json1_1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.cloud9#InternalServerErrorException" : response = { ... ( await deserializeAws_json1_1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cloud9#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.cloud9#NotFoundException" : response = { ... ( await deserializeAws_json1_1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cloud9#TooManyRequestsException" : response = { ... ( await deserializeAws_json1_1TooManyRequestsExceptionResponse ( 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_json1_1BadRequestExceptionResponse = async ( parsedOutput , context ) : Promise < BadRequestException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1BadRequestException ( body , context ) ; const contents = { name : "BadRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ConcurrentAccessExceptionResponse = async ( parsedOutput , context ) : Promise < ConcurrentAccessException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ConcurrentAccessException ( body , context ) ; const contents = { name : "ConcurrentAccessException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ConflictException ( body , context ) ; const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ForbiddenExceptionResponse = async ( parsedOutput , context ) : Promise < ForbiddenException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ForbiddenException ( body , context ) ; const contents = { name : "ForbiddenException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InternalServerErrorExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerErrorException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InternalServerErrorException ( body , context ) ; const contents = { name : "InternalServerErrorException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1LimitExceededExceptionResponse = async ( parsedOutput , context ) : Promise < LimitExceededException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1LimitExceededException ( body , context ) ; const contents = { name : "LimitExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1NotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < NotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1NotFoundException ( body , context ) ; const contents = { name : "NotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1TooManyRequestsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyRequestsException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1TooManyRequestsException ( body , context ) ; const contents = { name : "TooManyRequestsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const serializeAws_json1_1BoundedEnvironmentIdList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1CreateEnvironmentEC2Request = ( input , context ) : any => { return { ... ( input . automaticStopTimeMinutes !== undefined && input . automaticStopTimeMinutes !== null && { automaticStopTimeMinutes : input . automaticStopTimeMinutes } ) , ... ( input . clientRequestToken !== undefined && input . clientRequestToken !== null && { clientRequestToken : input . clientRequestToken } ) , ... ( input . connectionType !== undefined && input . connectionType !== null && { connectionType : input . connectionType } ) , ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . dryRun !== undefined && input . dryRun !== null && { dryRun : input . dryRun } ) , ... ( input . imageId !== undefined && input . imageId !== null && { imageId : input . imageId } ) , ... ( input . instanceType !== undefined && input . instanceType !== null && { instanceType : input . instanceType } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , ... ( input . ownerArn !== undefined && input . ownerArn !== null && { ownerArn : input . ownerArn } ) , ... ( input . subnetId !== undefined && input . subnetId !== null && { subnetId : input . subnetId } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_json1_1TagList ( input . tags , context ) } ) , } ; } ; const serializeAws_json1_1CreateEnvironmentMembershipRequest = ( input , context ) : any => { return { ... ( input . environmentId !== undefined && input . environmentId !== null && { environmentId : input . environmentId } ) , ... ( input . permissions !== undefined && input . permissions !== null && { permissions : input . permissions } ) , ... ( input . userArn !== undefined && input . userArn !== null && { userArn : input . userArn } ) , } ; } ; const serializeAws_json1_1DeleteEnvironmentMembershipRequest = ( input , context ) : any => { return { ... ( input . environmentId !== undefined && input . environmentId !== null && { environmentId : input . environmentId } ) , ... ( input . userArn !== undefined && input . userArn !== null && { userArn : input . userArn } ) , } ; } ; const serializeAws_json1_1DeleteEnvironmentRequest = ( input , context ) : any => { return { ... ( input . environmentId !== undefined && input . environmentId !== null && { environmentId : input . environmentId } ) , } ; } ; const serializeAws_json1_1DescribeEnvironmentMembershipsRequest = ( input , context ) : any => { return { ... ( input . environmentId !== undefined && input . environmentId !== null && { environmentId : input . environmentId } ) , ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , ... ( input . permissions !== undefined && input . permissions !== null && { permissions : serializeAws_json1_1PermissionsList ( input . permissions , context ) } ) , ... ( input . userArn !== undefined && input . userArn !== null && { userArn : input . userArn } ) , } ; } ; const serializeAws_json1_1DescribeEnvironmentsRequest = ( input , context ) : any => { return { ... ( input . environmentIds !== undefined && input . environmentIds !== null && { environmentIds : serializeAws_json1_1BoundedEnvironmentIdList ( input . environmentIds , context ) , } ) , } ; } ; const serializeAws_json1_1DescribeEnvironmentStatusRequest = ( input , context ) : any => { return { ... ( input . environmentId !== undefined && input . environmentId !== null && { environmentId : input . environmentId } ) , } ; } ; const serializeAws_json1_1ListEnvironmentsRequest = ( input , context ) : any => { return { ... ( input . maxResults !== undefined && input . maxResults !== null && { maxResults : input . maxResults } ) , ... ( input . nextToken !== undefined && input . nextToken !== null && { nextToken : input . nextToken } ) , } ; } ; const serializeAws_json1_1ListTagsForResourceRequest = ( input , context ) : any => { return { ... ( input . ResourceARN !== undefined && input . ResourceARN !== null && { ResourceARN : input . ResourceARN } ) , } ; } ; const serializeAws_json1_1PermissionsList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1Tag = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_json1_1TagKeyList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1TagList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1Tag ( entry , context ) ; } ) ; } ; const serializeAws_json1_1TagResourceRequest = ( input , context ) : any => { return { ... ( input . ResourceARN !== undefined && input . ResourceARN !== null && { ResourceARN : input . ResourceARN } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1TagList ( input . Tags , context ) } ) , } ; } ; const serializeAws_json1_1UntagResourceRequest = ( input , context ) : any => { return { ... ( input . ResourceARN !== undefined && input . ResourceARN !== null && { ResourceARN : input . ResourceARN } ) , ... ( input . TagKeys !== undefined && input . TagKeys !== null && { TagKeys : serializeAws_json1_1TagKeyList ( input . TagKeys , context ) } ) , } ; } ; const serializeAws_json1_1UpdateEnvironmentMembershipRequest = ( input , context ) : any => { return { ... ( input . environmentId !== undefined && input . environmentId !== null && { environmentId : input . environmentId } ) , ... ( input . permissions !== undefined && input . permissions !== null && { permissions : input . permissions } ) , ... ( input . userArn !== undefined && input . userArn !== null && { userArn : input . userArn } ) , } ; } ; const serializeAws_json1_1UpdateEnvironmentRequest = ( input , context ) : any => { return { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . environmentId !== undefined && input . environmentId !== null && { environmentId : input . environmentId } ) , ... ( input . managedCredentialsAction !== undefined && input . managedCredentialsAction !== null && { managedCredentialsAction : input . managedCredentialsAction } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , } ; } ; const deserializeAws_json1_1BadRequestException = ( output , context ) : BadRequestException => { return { className : __expectString ( output . className ) , code : __expectInt32 ( output . code ) , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ConcurrentAccessException = ( output , context ) : ConcurrentAccessException => { return { className : __expectString ( output . className ) , code : __expectInt32 ( output . code ) , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ConflictException = ( output , context ) : ConflictException => { return { className : __expectString ( output . className ) , code : __expectInt32 ( output . code ) , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1CreateEnvironmentEC2Result = ( output , context ) : CreateEnvironmentEC2Result => { return { environmentId : __expectString ( output . environmentId ) , } as any ; } ; const deserializeAws_json1_1CreateEnvironmentMembershipResult = ( output , context ) : CreateEnvironmentMembershipResult => { return { membership : output . membership !== undefined && output . membership !== null ? deserializeAws_json1_1EnvironmentMember ( output . membership , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DeleteEnvironmentMembershipResult = ( output , context ) : DeleteEnvironmentMembershipResult => { return { } as any ; } ; const deserializeAws_json1_1DeleteEnvironmentResult = ( output , context ) : DeleteEnvironmentResult => { return { } as any ; } ; const deserializeAws_json1_1DescribeEnvironmentMembershipsResult = ( output , context ) : DescribeEnvironmentMembershipsResult => { return { memberships : output . memberships !== undefined && output . memberships !== null ? deserializeAws_json1_1EnvironmentMembersList ( output . memberships , context ) : undefined , nextToken : __expectString ( output . nextToken ) , } as any ; } ; const deserializeAws_json1_1DescribeEnvironmentsResult = ( output , context ) : DescribeEnvironmentsResult => { return { environments : output . environments !== undefined && output . environments !== null ? deserializeAws_json1_1EnvironmentList ( output . environments , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DescribeEnvironmentStatusResult = ( output , context ) : DescribeEnvironmentStatusResult => { return { message : __expectString ( output . message ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_json1_1Environment = ( output , context ) : Environment => { return { arn : __expectString ( output . arn ) , connectionType : __expectString ( output . connectionType ) , description : __expectString ( output . description ) , id : __expectString ( output . id ) , lifecycle : output . lifecycle !== undefined && output . lifecycle !== null ? deserializeAws_json1_1EnvironmentLifecycle ( output . lifecycle , context ) : undefined , managedCredentialsStatus : __expectString ( output . managedCredentialsStatus ) , name : __expectString ( output . name ) , ownerArn : __expectString ( output . ownerArn ) , type : __expectString ( output . type ) , } as any ; } ; const deserializeAws_json1_1EnvironmentIdList = ( 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_json1_1EnvironmentLifecycle = ( output , context ) : EnvironmentLifecycle => { return { failureResource : __expectString ( output . failureResource ) , reason : __expectString ( output . reason ) , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_json1_1EnvironmentList = ( output , context ) : Environment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Environment ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1EnvironmentMember = ( output , context ) : EnvironmentMember => { return { environmentId : __expectString ( output . environmentId ) , lastAccess : output . lastAccess !== undefined && output . lastAccess !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastAccess ) ) ) : undefined , permissions : __expectString ( output . permissions ) , userArn : __expectString ( output . userArn ) , userId : __expectString ( output . userId ) , } as any ; } ; const deserializeAws_json1_1EnvironmentMembersList = ( output , context ) : EnvironmentMember [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1EnvironmentMember ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ForbiddenException = ( output , context ) : ForbiddenException => { return { className : __expectString ( output . className ) , code : __expectInt32 ( output . code ) , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InternalServerErrorException = ( output , context ) : InternalServerErrorException => { return { className : __expectString ( output . className ) , code : __expectInt32 ( output . code ) , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1LimitExceededException = ( output , context ) : LimitExceededException => { return { className : __expectString ( output . className ) , code : __expectInt32 ( output . code ) , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ListEnvironmentsResult = ( output , context ) : ListEnvironmentsResult => { return { environmentIds : output . environmentIds !== undefined && output . environmentIds !== null ? deserializeAws_json1_1EnvironmentIdList ( output . environmentIds , context ) : undefined , nextToken : __expectString ( output . nextToken ) , } as any ; } ; const deserializeAws_json1_1ListTagsForResourceResponse = ( output , context ) : ListTagsForResourceResponse => { return { Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_json1_1TagList ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_json1_1NotFoundException = ( output , context ) : NotFoundException => { return { className : __expectString ( output . className ) , code : __expectInt32 ( output . code ) , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1Tag = ( output , context ) : Tag => { return { Key : __expectString ( output . Key ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_json1_1TagList = ( output , context ) : Tag [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1Tag ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1TagResourceResponse = ( output , context ) : TagResourceResponse => { return { } as any ; } ; const deserializeAws_json1_1TooManyRequestsException = ( output , context ) : TooManyRequestsException => { return { className : __expectString ( output . className ) , code : __expectInt32 ( output . code ) , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1UntagResourceResponse = ( output , context ) : UntagResourceResponse => { return { } as any ; } ; const deserializeAws_json1_1UpdateEnvironmentMembershipResult = ( output , context ) : UpdateEnvironmentMembershipResult => { return { membership : output . membership !== undefined && output . membership !== null ? deserializeAws_json1_1EnvironmentMember ( output . membership , context ) : undefined , } as any ; } ; const deserializeAws_json1_1UpdateEnvironmentResult = ( output , context ) : UpdateEnvironmentResult => { return { } 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 buildHttpRpcRequest = async ( context , headers , path , resolvedHostname , body ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const contents = { protocol , hostname , port , method : "POST" , path : basePath . endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) + path : basePath + path , headers , } ; if ( resolvedHostname !== undefined ) { contents . hostname = resolvedHostname ; } if ( body !== undefined ) { contents . body = body ; } return new __HttpRequest ( contents ) ; } ; 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 "" ; } ;