import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , 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 { CreateIdentityPoolCommandInput , CreateIdentityPoolCommandOutput } from "../commands/CreateIdentityPoolCommand" ; import { DeleteIdentitiesCommandInput , DeleteIdentitiesCommandOutput } from "../commands/DeleteIdentitiesCommand" ; import { DeleteIdentityPoolCommandInput , DeleteIdentityPoolCommandOutput } from "../commands/DeleteIdentityPoolCommand" ; import { DescribeIdentityCommandInput , DescribeIdentityCommandOutput } from "../commands/DescribeIdentityCommand" ; import { DescribeIdentityPoolCommandInput , DescribeIdentityPoolCommandOutput , } from "../commands/DescribeIdentityPoolCommand" ; import { GetCredentialsForIdentityCommandInput , GetCredentialsForIdentityCommandOutput , } from "../commands/GetCredentialsForIdentityCommand" ; import { GetIdCommandInput , GetIdCommandOutput } from "../commands/GetIdCommand" ; import { GetIdentityPoolRolesCommandInput , GetIdentityPoolRolesCommandOutput , } from "../commands/GetIdentityPoolRolesCommand" ; import { GetOpenIdTokenCommandInput , GetOpenIdTokenCommandOutput } from "../commands/GetOpenIdTokenCommand" ; import { GetOpenIdTokenForDeveloperIdentityCommandInput , GetOpenIdTokenForDeveloperIdentityCommandOutput , } from "../commands/GetOpenIdTokenForDeveloperIdentityCommand" ; import { GetPrincipalTagAttributeMapCommandInput , GetPrincipalTagAttributeMapCommandOutput , } from "../commands/GetPrincipalTagAttributeMapCommand" ; import { ListIdentitiesCommandInput , ListIdentitiesCommandOutput } from "../commands/ListIdentitiesCommand" ; import { ListIdentityPoolsCommandInput , ListIdentityPoolsCommandOutput } from "../commands/ListIdentityPoolsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { LookupDeveloperIdentityCommandInput , LookupDeveloperIdentityCommandOutput , } from "../commands/LookupDeveloperIdentityCommand" ; import { MergeDeveloperIdentitiesCommandInput , MergeDeveloperIdentitiesCommandOutput , } from "../commands/MergeDeveloperIdentitiesCommand" ; import { SetIdentityPoolRolesCommandInput , SetIdentityPoolRolesCommandOutput , } from "../commands/SetIdentityPoolRolesCommand" ; import { SetPrincipalTagAttributeMapCommandInput , SetPrincipalTagAttributeMapCommandOutput , } from "../commands/SetPrincipalTagAttributeMapCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UnlinkDeveloperIdentityCommandInput , UnlinkDeveloperIdentityCommandOutput , } from "../commands/UnlinkDeveloperIdentityCommand" ; import { UnlinkIdentityCommandInput , UnlinkIdentityCommandOutput } from "../commands/UnlinkIdentityCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateIdentityPoolCommandInput , UpdateIdentityPoolCommandOutput } from "../commands/UpdateIdentityPoolCommand" ; import { CognitoIdentityProvider , ConcurrentModificationException , CreateIdentityPoolInput , Credentials , DeleteIdentitiesInput , DeleteIdentitiesResponse , DeleteIdentityPoolInput , DescribeIdentityInput , DescribeIdentityPoolInput , DeveloperUserAlreadyRegisteredException , ExternalServiceException , GetCredentialsForIdentityInput , GetCredentialsForIdentityResponse , GetIdentityPoolRolesInput , GetIdentityPoolRolesResponse , GetIdInput , GetIdResponse , GetOpenIdTokenForDeveloperIdentityInput , GetOpenIdTokenForDeveloperIdentityResponse , GetOpenIdTokenInput , GetOpenIdTokenResponse , GetPrincipalTagAttributeMapInput , GetPrincipalTagAttributeMapResponse , IdentityDescription , IdentityPool , IdentityPoolShortDescription , InternalErrorException , InvalidIdentityPoolConfigurationException , InvalidParameterException , LimitExceededException , ListIdentitiesInput , ListIdentitiesResponse , ListIdentityPoolsInput , ListIdentityPoolsResponse , ListTagsForResourceInput , ListTagsForResourceResponse , LookupDeveloperIdentityInput , LookupDeveloperIdentityResponse , MappingRule , MergeDeveloperIdentitiesInput , MergeDeveloperIdentitiesResponse , NotAuthorizedException , ResourceConflictException , ResourceNotFoundException , RoleMapping , RulesConfigurationType , SetIdentityPoolRolesInput , SetPrincipalTagAttributeMapInput , SetPrincipalTagAttributeMapResponse , TagResourceInput , TagResourceResponse , TooManyRequestsException , UnlinkDeveloperIdentityInput , UnlinkIdentityInput , UnprocessedIdentityId , UntagResourceInput , UntagResourceResponse , } from "../models/models_0" ; export const serializeAws_json1_1CreateIdentityPoolCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.CreateIdentityPool" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1CreateIdentityPoolInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteIdentitiesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.DeleteIdentities" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteIdentitiesInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DeleteIdentityPoolCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.DeleteIdentityPool" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DeleteIdentityPoolInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeIdentityCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.DescribeIdentity" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeIdentityInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1DescribeIdentityPoolCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.DescribeIdentityPool" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1DescribeIdentityPoolInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetCredentialsForIdentityCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.GetCredentialsForIdentity" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetCredentialsForIdentityInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetIdCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.GetId" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetIdInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetIdentityPoolRolesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.GetIdentityPoolRoles" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetIdentityPoolRolesInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetOpenIdTokenCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.GetOpenIdToken" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetOpenIdTokenInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.GetOpenIdTokenForDeveloperIdentity" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetOpenIdTokenForDeveloperIdentityInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1GetPrincipalTagAttributeMapCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.GetPrincipalTagAttributeMap" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1GetPrincipalTagAttributeMapInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListIdentitiesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.ListIdentities" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListIdentitiesInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1ListIdentityPoolsCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.ListIdentityPools" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListIdentityPoolsInput ( 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" : "AWSCognitoIdentityService.ListTagsForResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1ListTagsForResourceInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1LookupDeveloperIdentityCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.LookupDeveloperIdentity" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1LookupDeveloperIdentityInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1MergeDeveloperIdentitiesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.MergeDeveloperIdentities" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1MergeDeveloperIdentitiesInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1SetIdentityPoolRolesCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.SetIdentityPoolRoles" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1SetIdentityPoolRolesInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1SetPrincipalTagAttributeMapCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.SetPrincipalTagAttributeMap" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1SetPrincipalTagAttributeMapInput ( 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" : "AWSCognitoIdentityService.TagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1TagResourceInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UnlinkDeveloperIdentityCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.UnlinkDeveloperIdentity" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UnlinkDeveloperIdentityInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UnlinkIdentityCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.UnlinkIdentity" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UnlinkIdentityInput ( 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" : "AWSCognitoIdentityService.UntagResource" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1UntagResourceInput ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const serializeAws_json1_1UpdateIdentityPoolCommand = async ( input , context ) : Promise < __HttpRequest > => { const headers = { "content-type" : "application/x-amz-json-1.1" , "x-amz-target" : "AWSCognitoIdentityService.UpdateIdentityPool" , } ; let body ; body = JSON . stringify ( serializeAws_json1_1IdentityPool ( input , context ) ) ; return buildHttpRpcRequest ( context , headers , "/" , undefined , body ) ; } ; export const deserializeAws_json1_1CreateIdentityPoolCommand = async ( output , context ) : Promise < CreateIdentityPoolCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1CreateIdentityPoolCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1IdentityPool ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1CreateIdentityPoolCommandError = async ( output , context ) : Promise < CreateIdentityPoolCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cognitoidentity#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1DeleteIdentitiesCommand = async ( output , context ) : Promise < DeleteIdentitiesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteIdentitiesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1DeleteIdentitiesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteIdentitiesCommandError = async ( output , context ) : Promise < DeleteIdentitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1DeleteIdentityPoolCommand = async ( output , context ) : Promise < DeleteIdentityPoolCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DeleteIdentityPoolCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DeleteIdentityPoolCommandError = async ( output , context ) : Promise < DeleteIdentityPoolCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1DescribeIdentityCommand = async ( output , context ) : Promise < DescribeIdentityCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeIdentityCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1IdentityDescription ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeIdentityCommandError = async ( output , context ) : Promise < DescribeIdentityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1DescribeIdentityPoolCommand = async ( output , context ) : Promise < DescribeIdentityPoolCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1DescribeIdentityPoolCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1IdentityPool ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1DescribeIdentityPoolCommandError = async ( output , context ) : Promise < DescribeIdentityPoolCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1GetCredentialsForIdentityCommand = async ( output , context ) : Promise < GetCredentialsForIdentityCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetCredentialsForIdentityCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetCredentialsForIdentityResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetCredentialsForIdentityCommandError = async ( output , context ) : Promise < GetCredentialsForIdentityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ExternalServiceException" : case "com.amazonaws.cognitoidentity#ExternalServiceException" : response = { ... ( await deserializeAws_json1_1ExternalServiceExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidIdentityPoolConfigurationException" : case "com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException" : response = { ... ( await deserializeAws_json1_1InvalidIdentityPoolConfigurationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1GetIdCommand = async ( output , context ) : Promise < GetIdCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetIdCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetIdResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetIdCommandError = async ( output , context ) : Promise < GetIdCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ExternalServiceException" : case "com.amazonaws.cognitoidentity#ExternalServiceException" : response = { ... ( await deserializeAws_json1_1ExternalServiceExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cognitoidentity#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1GetIdentityPoolRolesCommand = async ( output , context ) : Promise < GetIdentityPoolRolesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetIdentityPoolRolesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetIdentityPoolRolesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetIdentityPoolRolesCommandError = async ( output , context ) : Promise < GetIdentityPoolRolesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1GetOpenIdTokenCommand = async ( output , context ) : Promise < GetOpenIdTokenCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetOpenIdTokenCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetOpenIdTokenResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetOpenIdTokenCommandError = async ( output , context ) : Promise < GetOpenIdTokenCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ExternalServiceException" : case "com.amazonaws.cognitoidentity#ExternalServiceException" : response = { ... ( await deserializeAws_json1_1ExternalServiceExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1GetOpenIdTokenForDeveloperIdentityCommand = async ( output , context ) : Promise < GetOpenIdTokenForDeveloperIdentityCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommandError = async ( output , context ) : Promise < GetOpenIdTokenForDeveloperIdentityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "DeveloperUserAlreadyRegisteredException" : case "com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException" : response = { ... ( await deserializeAws_json1_1DeveloperUserAlreadyRegisteredExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1GetPrincipalTagAttributeMapCommand = async ( output , context ) : Promise < GetPrincipalTagAttributeMapCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1GetPrincipalTagAttributeMapCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1GetPrincipalTagAttributeMapResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1GetPrincipalTagAttributeMapCommandError = async ( output , context ) : Promise < GetPrincipalTagAttributeMapCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1ListIdentitiesCommand = async ( output , context ) : Promise < ListIdentitiesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListIdentitiesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListIdentitiesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListIdentitiesCommandError = async ( output , context ) : Promise < ListIdentitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1ListIdentityPoolsCommand = async ( output , context ) : Promise < ListIdentityPoolsCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1ListIdentityPoolsCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1ListIdentityPoolsResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1ListIdentityPoolsCommandError = async ( output , context ) : Promise < ListIdentityPoolsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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 "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1LookupDeveloperIdentityCommand = async ( output , context ) : Promise < LookupDeveloperIdentityCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1LookupDeveloperIdentityCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1LookupDeveloperIdentityResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1LookupDeveloperIdentityCommandError = async ( output , context ) : Promise < LookupDeveloperIdentityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1MergeDeveloperIdentitiesCommand = async ( output , context ) : Promise < MergeDeveloperIdentitiesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1MergeDeveloperIdentitiesCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1MergeDeveloperIdentitiesResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1MergeDeveloperIdentitiesCommandError = async ( output , context ) : Promise < MergeDeveloperIdentitiesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1SetIdentityPoolRolesCommand = async ( output , context ) : Promise < SetIdentityPoolRolesCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1SetIdentityPoolRolesCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1SetIdentityPoolRolesCommandError = async ( output , context ) : Promise < SetIdentityPoolRolesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.cognitoidentity#ConcurrentModificationException" : response = { ... ( await deserializeAws_json1_1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1SetPrincipalTagAttributeMapCommand = async ( output , context ) : Promise < SetPrincipalTagAttributeMapCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1SetPrincipalTagAttributeMapCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1SetPrincipalTagAttributeMapResponse ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1SetPrincipalTagAttributeMapCommandError = async ( output , context ) : Promise < SetPrincipalTagAttributeMapCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_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 "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1UnlinkDeveloperIdentityCommand = async ( output , context ) : Promise < UnlinkDeveloperIdentityCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UnlinkDeveloperIdentityCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UnlinkDeveloperIdentityCommandError = async ( output , context ) : Promise < UnlinkDeveloperIdentityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1UnlinkIdentityCommand = async ( output , context ) : Promise < UnlinkIdentityCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UnlinkIdentityCommandError ( output , context ) ; } await collectBody ( output . body , context ) ; const response = { $metadata : deserializeMetadata ( output ) , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UnlinkIdentityCommandError = async ( output , context ) : Promise < UnlinkIdentityCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ExternalServiceException" : case "com.amazonaws.cognitoidentity#ExternalServiceException" : response = { ... ( await deserializeAws_json1_1ExternalServiceExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_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 "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1UpdateIdentityPoolCommand = async ( output , context ) : Promise < UpdateIdentityPoolCommandOutput > => { if ( output . statusCode >= 300 ) { return deserializeAws_json1_1UpdateIdentityPoolCommandError ( output , context ) ; } const data = await parseBody ( output . body , context ) ; let contents = { } ; contents = deserializeAws_json1_1IdentityPool ( data , context ) ; const response = { $metadata : deserializeMetadata ( output ) , ... contents , } ; return Promise . resolve ( response ) ; } ; const deserializeAws_json1_1UpdateIdentityPoolCommandError = async ( output , context ) : Promise < UpdateIdentityPoolCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ConcurrentModificationException" : case "com.amazonaws.cognitoidentity#ConcurrentModificationException" : response = { ... ( await deserializeAws_json1_1ConcurrentModificationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalErrorException" : case "com.amazonaws.cognitoidentity#InternalErrorException" : response = { ... ( await deserializeAws_json1_1InternalErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidParameterException" : case "com.amazonaws.cognitoidentity#InvalidParameterException" : response = { ... ( await deserializeAws_json1_1InvalidParameterExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "LimitExceededException" : case "com.amazonaws.cognitoidentity#LimitExceededException" : response = { ... ( await deserializeAws_json1_1LimitExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotAuthorizedException" : case "com.amazonaws.cognitoidentity#NotAuthorizedException" : response = { ... ( await deserializeAws_json1_1NotAuthorizedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.cognitoidentity#ResourceConflictException" : response = { ... ( await deserializeAws_json1_1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.cognitoidentity#ResourceNotFoundException" : response = { ... ( await deserializeAws_json1_1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.cognitoidentity#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_1ConcurrentModificationExceptionResponse = async ( parsedOutput , context ) : Promise < ConcurrentModificationException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ConcurrentModificationException ( body , context ) ; const contents = { name : "ConcurrentModificationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1DeveloperUserAlreadyRegisteredExceptionResponse = async ( parsedOutput , context ) : Promise < DeveloperUserAlreadyRegisteredException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1DeveloperUserAlreadyRegisteredException ( body , context ) ; const contents = { name : "DeveloperUserAlreadyRegisteredException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ExternalServiceExceptionResponse = async ( parsedOutput , context ) : Promise < ExternalServiceException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ExternalServiceException ( body , context ) ; const contents = { name : "ExternalServiceException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InternalErrorExceptionResponse = async ( parsedOutput , context ) : Promise < InternalErrorException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InternalErrorException ( body , context ) ; const contents = { name : "InternalErrorException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidIdentityPoolConfigurationExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidIdentityPoolConfigurationException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidIdentityPoolConfigurationException ( body , context ) ; const contents = { name : "InvalidIdentityPoolConfigurationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1InvalidParameterExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidParameterException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1InvalidParameterException ( body , context ) ; const contents = { name : "InvalidParameterException" , $fault : "client" , $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_1NotAuthorizedExceptionResponse = async ( parsedOutput , context ) : Promise < NotAuthorizedException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1NotAuthorizedException ( body , context ) ; const contents = { name : "NotAuthorizedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ResourceConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceConflictException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ResourceConflictException ( body , context ) ; const contents = { name : "ResourceConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ... deserialized , } ; return contents ; } ; const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const body = parsedOutput . body ; const deserialized = deserializeAws_json1_1ResourceNotFoundException ( body , context ) ; const contents = { name : "ResourceNotFoundException" , $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_1CognitoIdentityProvider = ( input , context ) : any => { return { ... ( input . ClientId !== undefined && input . ClientId !== null && { ClientId : input . ClientId } ) , ... ( input . ProviderName !== undefined && input . ProviderName !== null && { ProviderName : input . ProviderName } ) , ... ( input . ServerSideTokenCheck !== undefined && input . ServerSideTokenCheck !== null && { ServerSideTokenCheck : input . ServerSideTokenCheck } ) , } ; } ; const serializeAws_json1_1CognitoIdentityProviderList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1CognitoIdentityProvider ( entry , context ) ; } ) ; } ; const serializeAws_json1_1CreateIdentityPoolInput = ( input , context ) : any => { return { ... ( input . AllowClassicFlow !== undefined && input . AllowClassicFlow !== null && { AllowClassicFlow : input . AllowClassicFlow } ) , ... ( input . AllowUnauthenticatedIdentities !== undefined && input . AllowUnauthenticatedIdentities !== null && { AllowUnauthenticatedIdentities : input . AllowUnauthenticatedIdentities , } ) , ... ( input . CognitoIdentityProviders !== undefined && input . CognitoIdentityProviders !== null && { CognitoIdentityProviders : serializeAws_json1_1CognitoIdentityProviderList ( input . CognitoIdentityProviders , context ) , } ) , ... ( input . DeveloperProviderName !== undefined && input . DeveloperProviderName !== null && { DeveloperProviderName : input . DeveloperProviderName } ) , ... ( input . IdentityPoolName !== undefined && input . IdentityPoolName !== null && { IdentityPoolName : input . IdentityPoolName } ) , ... ( input . IdentityPoolTags !== undefined && input . IdentityPoolTags !== null && { IdentityPoolTags : serializeAws_json1_1IdentityPoolTagsType ( input . IdentityPoolTags , context ) , } ) , ... ( input . OpenIdConnectProviderARNs !== undefined && input . OpenIdConnectProviderARNs !== null && { OpenIdConnectProviderARNs : serializeAws_json1_1OIDCProviderList ( input . OpenIdConnectProviderARNs , context ) , } ) , ... ( input . SamlProviderARNs !== undefined && input . SamlProviderARNs !== null && { SamlProviderARNs : serializeAws_json1_1SAMLProviderList ( input . SamlProviderARNs , context ) , } ) , ... ( input . SupportedLoginProviders !== undefined && input . SupportedLoginProviders !== null && { SupportedLoginProviders : serializeAws_json1_1IdentityProviders ( input . SupportedLoginProviders , context ) , } ) , } ; } ; const serializeAws_json1_1DeleteIdentitiesInput = ( input , context ) : any => { return { ... ( input . IdentityIdsToDelete !== undefined && input . IdentityIdsToDelete !== null && { IdentityIdsToDelete : serializeAws_json1_1IdentityIdList ( input . IdentityIdsToDelete , context ) , } ) , } ; } ; const serializeAws_json1_1DeleteIdentityPoolInput = ( input , context ) : any => { return { ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , } ; } ; const serializeAws_json1_1DescribeIdentityInput = ( input , context ) : any => { return { ... ( input . IdentityId !== undefined && input . IdentityId !== null && { IdentityId : input . IdentityId } ) , } ; } ; const serializeAws_json1_1DescribeIdentityPoolInput = ( input , context ) : any => { return { ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , } ; } ; const serializeAws_json1_1GetCredentialsForIdentityInput = ( input , context ) : any => { return { ... ( input . CustomRoleArn !== undefined && input . CustomRoleArn !== null && { CustomRoleArn : input . CustomRoleArn } ) , ... ( input . IdentityId !== undefined && input . IdentityId !== null && { IdentityId : input . IdentityId } ) , ... ( input . Logins !== undefined && input . Logins !== null && { Logins : serializeAws_json1_1LoginsMap ( input . Logins , context ) } ) , } ; } ; const serializeAws_json1_1GetIdentityPoolRolesInput = ( input , context ) : any => { return { ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , } ; } ; const serializeAws_json1_1GetIdInput = ( input , context ) : any => { return { ... ( input . AccountId !== undefined && input . AccountId !== null && { AccountId : input . AccountId } ) , ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , ... ( input . Logins !== undefined && input . Logins !== null && { Logins : serializeAws_json1_1LoginsMap ( input . Logins , context ) } ) , } ; } ; const serializeAws_json1_1GetOpenIdTokenForDeveloperIdentityInput = ( input , context ) : any => { return { ... ( input . IdentityId !== undefined && input . IdentityId !== null && { IdentityId : input . IdentityId } ) , ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , ... ( input . Logins !== undefined && input . Logins !== null && { Logins : serializeAws_json1_1LoginsMap ( input . Logins , context ) } ) , ... ( input . PrincipalTags !== undefined && input . PrincipalTags !== null && { PrincipalTags : serializeAws_json1_1PrincipalTags ( input . PrincipalTags , context ) , } ) , ... ( input . TokenDuration !== undefined && input . TokenDuration !== null && { TokenDuration : input . TokenDuration } ) , } ; } ; const serializeAws_json1_1GetOpenIdTokenInput = ( input , context ) : any => { return { ... ( input . IdentityId !== undefined && input . IdentityId !== null && { IdentityId : input . IdentityId } ) , ... ( input . Logins !== undefined && input . Logins !== null && { Logins : serializeAws_json1_1LoginsMap ( input . Logins , context ) } ) , } ; } ; const serializeAws_json1_1GetPrincipalTagAttributeMapInput = ( input , context ) : any => { return { ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , ... ( input . IdentityProviderName !== undefined && input . IdentityProviderName !== null && { IdentityProviderName : input . IdentityProviderName } ) , } ; } ; const serializeAws_json1_1IdentityIdList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1IdentityPool = ( input , context ) : any => { return { ... ( input . AllowClassicFlow !== undefined && input . AllowClassicFlow !== null && { AllowClassicFlow : input . AllowClassicFlow } ) , ... ( input . AllowUnauthenticatedIdentities !== undefined && input . AllowUnauthenticatedIdentities !== null && { AllowUnauthenticatedIdentities : input . AllowUnauthenticatedIdentities , } ) , ... ( input . CognitoIdentityProviders !== undefined && input . CognitoIdentityProviders !== null && { CognitoIdentityProviders : serializeAws_json1_1CognitoIdentityProviderList ( input . CognitoIdentityProviders , context ) , } ) , ... ( input . DeveloperProviderName !== undefined && input . DeveloperProviderName !== null && { DeveloperProviderName : input . DeveloperProviderName } ) , ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , ... ( input . IdentityPoolName !== undefined && input . IdentityPoolName !== null && { IdentityPoolName : input . IdentityPoolName } ) , ... ( input . IdentityPoolTags !== undefined && input . IdentityPoolTags !== null && { IdentityPoolTags : serializeAws_json1_1IdentityPoolTagsType ( input . IdentityPoolTags , context ) , } ) , ... ( input . OpenIdConnectProviderARNs !== undefined && input . OpenIdConnectProviderARNs !== null && { OpenIdConnectProviderARNs : serializeAws_json1_1OIDCProviderList ( input . OpenIdConnectProviderARNs , context ) , } ) , ... ( input . SamlProviderARNs !== undefined && input . SamlProviderARNs !== null && { SamlProviderARNs : serializeAws_json1_1SAMLProviderList ( input . SamlProviderARNs , context ) , } ) , ... ( input . SupportedLoginProviders !== undefined && input . SupportedLoginProviders !== null && { SupportedLoginProviders : serializeAws_json1_1IdentityProviders ( input . SupportedLoginProviders , context ) , } ) , } ; } ; const serializeAws_json1_1IdentityPoolTagsListType = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1IdentityPoolTagsType = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1IdentityProviders = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1ListIdentitiesInput = ( input , context ) : any => { return { ... ( input . HideDisabled !== undefined && input . HideDisabled !== null && { HideDisabled : input . HideDisabled } ) , ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1ListIdentityPoolsInput = ( 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_1ListTagsForResourceInput = ( input , context ) : any => { return { ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , } ; } ; const serializeAws_json1_1LoginsList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1LoginsMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1LookupDeveloperIdentityInput = ( input , context ) : any => { return { ... ( input . DeveloperUserIdentifier !== undefined && input . DeveloperUserIdentifier !== null && { DeveloperUserIdentifier : input . DeveloperUserIdentifier } ) , ... ( input . IdentityId !== undefined && input . IdentityId !== null && { IdentityId : input . IdentityId } ) , ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ; } ; const serializeAws_json1_1MappingRule = ( input , context ) : any => { return { ... ( input . Claim !== undefined && input . Claim !== null && { Claim : input . Claim } ) , ... ( input . MatchType !== undefined && input . MatchType !== null && { MatchType : input . MatchType } ) , ... ( input . RoleARN !== undefined && input . RoleARN !== null && { RoleARN : input . RoleARN } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_json1_1MappingRulesList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_json1_1MappingRule ( entry , context ) ; } ) ; } ; const serializeAws_json1_1MergeDeveloperIdentitiesInput = ( input , context ) : any => { return { ... ( input . DestinationUserIdentifier !== undefined && input . DestinationUserIdentifier !== null && { DestinationUserIdentifier : input . DestinationUserIdentifier } ) , ... ( input . DeveloperProviderName !== undefined && input . DeveloperProviderName !== null && { DeveloperProviderName : input . DeveloperProviderName } ) , ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , ... ( input . SourceUserIdentifier !== undefined && input . SourceUserIdentifier !== null && { SourceUserIdentifier : input . SourceUserIdentifier } ) , } ; } ; const serializeAws_json1_1OIDCProviderList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1PrincipalTags = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1RoleMapping = ( input , context ) : any => { return { ... ( input . AmbiguousRoleResolution !== undefined && input . AmbiguousRoleResolution !== null && { AmbiguousRoleResolution : input . AmbiguousRoleResolution } ) , ... ( input . RulesConfiguration !== undefined && input . RulesConfiguration !== null && { RulesConfiguration : serializeAws_json1_1RulesConfigurationType ( input . RulesConfiguration , context ) , } ) , ... ( input . Type !== undefined && input . Type !== null && { Type : input . Type } ) , } ; } ; const serializeAws_json1_1RoleMappingMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_json1_1RoleMapping ( value , context ) , } ; } , { } ) ; } ; const serializeAws_json1_1RolesMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_json1_1RulesConfigurationType = ( input , context ) : any => { return { ... ( input . Rules !== undefined && input . Rules !== null && { Rules : serializeAws_json1_1MappingRulesList ( input . Rules , context ) } ) , } ; } ; const serializeAws_json1_1SAMLProviderList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_json1_1SetIdentityPoolRolesInput = ( input , context ) : any => { return { ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , ... ( input . RoleMappings !== undefined && input . RoleMappings !== null && { RoleMappings : serializeAws_json1_1RoleMappingMap ( input . RoleMappings , context ) } ) , ... ( input . Roles !== undefined && input . Roles !== null && { Roles : serializeAws_json1_1RolesMap ( input . Roles , context ) } ) , } ; } ; const serializeAws_json1_1SetPrincipalTagAttributeMapInput = ( input , context ) : any => { return { ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , ... ( input . IdentityProviderName !== undefined && input . IdentityProviderName !== null && { IdentityProviderName : input . IdentityProviderName } ) , ... ( input . PrincipalTags !== undefined && input . PrincipalTags !== null && { PrincipalTags : serializeAws_json1_1PrincipalTags ( input . PrincipalTags , context ) , } ) , ... ( input . UseDefaults !== undefined && input . UseDefaults !== null && { UseDefaults : input . UseDefaults } ) , } ; } ; const serializeAws_json1_1TagResourceInput = ( input , context ) : any => { return { ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_json1_1IdentityPoolTagsType ( input . Tags , context ) } ) , } ; } ; const serializeAws_json1_1UnlinkDeveloperIdentityInput = ( input , context ) : any => { return { ... ( input . DeveloperProviderName !== undefined && input . DeveloperProviderName !== null && { DeveloperProviderName : input . DeveloperProviderName } ) , ... ( input . DeveloperUserIdentifier !== undefined && input . DeveloperUserIdentifier !== null && { DeveloperUserIdentifier : input . DeveloperUserIdentifier } ) , ... ( input . IdentityId !== undefined && input . IdentityId !== null && { IdentityId : input . IdentityId } ) , ... ( input . IdentityPoolId !== undefined && input . IdentityPoolId !== null && { IdentityPoolId : input . IdentityPoolId } ) , } ; } ; const serializeAws_json1_1UnlinkIdentityInput = ( input , context ) : any => { return { ... ( input . IdentityId !== undefined && input . IdentityId !== null && { IdentityId : input . IdentityId } ) , ... ( input . Logins !== undefined && input . Logins !== null && { Logins : serializeAws_json1_1LoginsMap ( input . Logins , context ) } ) , ... ( input . LoginsToRemove !== undefined && input . LoginsToRemove !== null && { LoginsToRemove : serializeAws_json1_1LoginsList ( input . LoginsToRemove , context ) , } ) , } ; } ; const serializeAws_json1_1UntagResourceInput = ( input , context ) : any => { return { ... ( input . ResourceArn !== undefined && input . ResourceArn !== null && { ResourceArn : input . ResourceArn } ) , ... ( input . TagKeys !== undefined && input . TagKeys !== null && { TagKeys : serializeAws_json1_1IdentityPoolTagsListType ( input . TagKeys , context ) } ) , } ; } ; const deserializeAws_json1_1CognitoIdentityProvider = ( output , context ) : CognitoIdentityProvider => { return { ClientId : __expectString ( output . ClientId ) , ProviderName : __expectString ( output . ProviderName ) , ServerSideTokenCheck : __expectBoolean ( output . ServerSideTokenCheck ) , } as any ; } ; const deserializeAws_json1_1CognitoIdentityProviderList = ( output , context ) : CognitoIdentityProvider [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1CognitoIdentityProvider ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1ConcurrentModificationException = ( output , context ) : ConcurrentModificationException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1Credentials = ( output , context ) : Credentials => { return { AccessKeyId : __expectString ( output . AccessKeyId ) , Expiration : output . Expiration !== undefined && output . Expiration !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . Expiration ) ) ) : undefined , SecretKey : __expectString ( output . SecretKey ) , SessionToken : __expectString ( output . SessionToken ) , } as any ; } ; const deserializeAws_json1_1DeleteIdentitiesResponse = ( output , context ) : DeleteIdentitiesResponse => { return { UnprocessedIdentityIds : output . UnprocessedIdentityIds !== undefined && output . UnprocessedIdentityIds !== null ? deserializeAws_json1_1UnprocessedIdentityIdList ( output . UnprocessedIdentityIds , context ) : undefined , } as any ; } ; const deserializeAws_json1_1DeveloperUserAlreadyRegisteredException = ( output , context ) : DeveloperUserAlreadyRegisteredException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1DeveloperUserIdentifierList = ( 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_1ExternalServiceException = ( output , context ) : ExternalServiceException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1GetCredentialsForIdentityResponse = ( output , context ) : GetCredentialsForIdentityResponse => { return { Credentials : output . Credentials !== undefined && output . Credentials !== null ? deserializeAws_json1_1Credentials ( output . Credentials , context ) : undefined , IdentityId : __expectString ( output . IdentityId ) , } as any ; } ; const deserializeAws_json1_1GetIdentityPoolRolesResponse = ( output , context ) : GetIdentityPoolRolesResponse => { return { IdentityPoolId : __expectString ( output . IdentityPoolId ) , RoleMappings : output . RoleMappings !== undefined && output . RoleMappings !== null ? deserializeAws_json1_1RoleMappingMap ( output . RoleMappings , context ) : undefined , Roles : output . Roles !== undefined && output . Roles !== null ? deserializeAws_json1_1RolesMap ( output . Roles , context ) : undefined , } as any ; } ; const deserializeAws_json1_1GetIdResponse = ( output , context ) : GetIdResponse => { return { IdentityId : __expectString ( output . IdentityId ) , } as any ; } ; const deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityResponse = ( output , context ) : GetOpenIdTokenForDeveloperIdentityResponse => { return { IdentityId : __expectString ( output . IdentityId ) , Token : __expectString ( output . Token ) , } as any ; } ; const deserializeAws_json1_1GetOpenIdTokenResponse = ( output , context ) : GetOpenIdTokenResponse => { return { IdentityId : __expectString ( output . IdentityId ) , Token : __expectString ( output . Token ) , } as any ; } ; const deserializeAws_json1_1GetPrincipalTagAttributeMapResponse = ( output , context ) : GetPrincipalTagAttributeMapResponse => { return { IdentityPoolId : __expectString ( output . IdentityPoolId ) , IdentityProviderName : __expectString ( output . IdentityProviderName ) , PrincipalTags : output . PrincipalTags !== undefined && output . PrincipalTags !== null ? deserializeAws_json1_1PrincipalTags ( output . PrincipalTags , context ) : undefined , UseDefaults : __expectBoolean ( output . UseDefaults ) , } as any ; } ; const deserializeAws_json1_1IdentitiesList = ( output , context ) : IdentityDescription [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1IdentityDescription ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1IdentityDescription = ( output , context ) : IdentityDescription => { return { CreationDate : output . CreationDate !== undefined && output . CreationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationDate ) ) ) : undefined , IdentityId : __expectString ( output . IdentityId ) , LastModifiedDate : output . LastModifiedDate !== undefined && output . LastModifiedDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . LastModifiedDate ) ) ) : undefined , Logins : output . Logins !== undefined && output . Logins !== null ? deserializeAws_json1_1LoginsList ( output . Logins , context ) : undefined , } as any ; } ; const deserializeAws_json1_1IdentityPool = ( output , context ) : IdentityPool => { return { AllowClassicFlow : __expectBoolean ( output . AllowClassicFlow ) , AllowUnauthenticatedIdentities : __expectBoolean ( output . AllowUnauthenticatedIdentities ) , CognitoIdentityProviders : output . CognitoIdentityProviders !== undefined && output . CognitoIdentityProviders !== null ? deserializeAws_json1_1CognitoIdentityProviderList ( output . CognitoIdentityProviders , context ) : undefined , DeveloperProviderName : __expectString ( output . DeveloperProviderName ) , IdentityPoolId : __expectString ( output . IdentityPoolId ) , IdentityPoolName : __expectString ( output . IdentityPoolName ) , IdentityPoolTags : output . IdentityPoolTags !== undefined && output . IdentityPoolTags !== null ? deserializeAws_json1_1IdentityPoolTagsType ( output . IdentityPoolTags , context ) : undefined , OpenIdConnectProviderARNs : output . OpenIdConnectProviderARNs !== undefined && output . OpenIdConnectProviderARNs !== null ? deserializeAws_json1_1OIDCProviderList ( output . OpenIdConnectProviderARNs , context ) : undefined , SamlProviderARNs : output . SamlProviderARNs !== undefined && output . SamlProviderARNs !== null ? deserializeAws_json1_1SAMLProviderList ( output . SamlProviderARNs , context ) : undefined , SupportedLoginProviders : output . SupportedLoginProviders !== undefined && output . SupportedLoginProviders !== null ? deserializeAws_json1_1IdentityProviders ( output . SupportedLoginProviders , context ) : undefined , } as any ; } ; const deserializeAws_json1_1IdentityPoolShortDescription = ( output , context ) : IdentityPoolShortDescription => { return { IdentityPoolId : __expectString ( output . IdentityPoolId ) , IdentityPoolName : __expectString ( output . IdentityPoolName ) , } as any ; } ; const deserializeAws_json1_1IdentityPoolsList = ( output , context ) : IdentityPoolShortDescription [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1IdentityPoolShortDescription ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1IdentityPoolTagsType = ( 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_json1_1IdentityProviders = ( 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_json1_1InternalErrorException = ( output , context ) : InternalErrorException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InvalidIdentityPoolConfigurationException = ( output , context ) : InvalidIdentityPoolConfigurationException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1InvalidParameterException = ( output , context ) : InvalidParameterException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1LimitExceededException = ( output , context ) : LimitExceededException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ListIdentitiesResponse = ( output , context ) : ListIdentitiesResponse => { return { Identities : output . Identities !== undefined && output . Identities !== null ? deserializeAws_json1_1IdentitiesList ( output . Identities , context ) : undefined , IdentityPoolId : __expectString ( output . IdentityPoolId ) , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1ListIdentityPoolsResponse = ( output , context ) : ListIdentityPoolsResponse => { return { IdentityPools : output . IdentityPools !== undefined && output . IdentityPools !== null ? deserializeAws_json1_1IdentityPoolsList ( output . IdentityPools , 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_1IdentityPoolTagsType ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_json1_1LoginsList = ( 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_1LookupDeveloperIdentityResponse = ( output , context ) : LookupDeveloperIdentityResponse => { return { DeveloperUserIdentifierList : output . DeveloperUserIdentifierList !== undefined && output . DeveloperUserIdentifierList !== null ? deserializeAws_json1_1DeveloperUserIdentifierList ( output . DeveloperUserIdentifierList , context ) : undefined , IdentityId : __expectString ( output . IdentityId ) , NextToken : __expectString ( output . NextToken ) , } as any ; } ; const deserializeAws_json1_1MappingRule = ( output , context ) : MappingRule => { return { Claim : __expectString ( output . Claim ) , MatchType : __expectString ( output . MatchType ) , RoleARN : __expectString ( output . RoleARN ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_json1_1MappingRulesList = ( output , context ) : MappingRule [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1MappingRule ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1MergeDeveloperIdentitiesResponse = ( output , context ) : MergeDeveloperIdentitiesResponse => { return { IdentityId : __expectString ( output . IdentityId ) , } as any ; } ; const deserializeAws_json1_1NotAuthorizedException = ( output , context ) : NotAuthorizedException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1OIDCProviderList = ( 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_1PrincipalTags = ( 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_json1_1ResourceConflictException = ( output , context ) : ResourceConflictException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1ResourceNotFoundException = ( output , context ) : ResourceNotFoundException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1RoleMapping = ( output , context ) : RoleMapping => { return { AmbiguousRoleResolution : __expectString ( output . AmbiguousRoleResolution ) , RulesConfiguration : output . RulesConfiguration !== undefined && output . RulesConfiguration !== null ? deserializeAws_json1_1RulesConfigurationType ( output . RulesConfiguration , context ) : undefined , Type : __expectString ( output . Type ) , } as any ; } ; const deserializeAws_json1_1RoleMappingMap = ( output , context ) : { [ key ] : RoleMapping ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_json1_1RoleMapping ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_json1_1RolesMap = ( 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_json1_1RulesConfigurationType = ( output , context ) : RulesConfigurationType => { return { Rules : output . Rules !== undefined && output . Rules !== null ? deserializeAws_json1_1MappingRulesList ( output . Rules , context ) : undefined , } as any ; } ; const deserializeAws_json1_1SAMLProviderList = ( 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_1SetPrincipalTagAttributeMapResponse = ( output , context ) : SetPrincipalTagAttributeMapResponse => { return { IdentityPoolId : __expectString ( output . IdentityPoolId ) , IdentityProviderName : __expectString ( output . IdentityProviderName ) , PrincipalTags : output . PrincipalTags !== undefined && output . PrincipalTags !== null ? deserializeAws_json1_1PrincipalTags ( output . PrincipalTags , context ) : undefined , UseDefaults : __expectBoolean ( output . UseDefaults ) , } as any ; } ; const deserializeAws_json1_1TagResourceResponse = ( output , context ) : TagResourceResponse => { return { } as any ; } ; const deserializeAws_json1_1TooManyRequestsException = ( output , context ) : TooManyRequestsException => { return { message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_json1_1UnprocessedIdentityId = ( output , context ) : UnprocessedIdentityId => { return { ErrorCode : __expectString ( output . ErrorCode ) , IdentityId : __expectString ( output . IdentityId ) , } as any ; } ; const deserializeAws_json1_1UnprocessedIdentityIdList = ( output , context ) : UnprocessedIdentityId [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_json1_1UnprocessedIdentityId ( entry , context ) ; } ) ; } ; const deserializeAws_json1_1UntagResourceResponse = ( output , context ) : UntagResourceResponse => { 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 "" ; } ;