import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectLong as __expectLong , expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , limitedParseDouble as __limitedParseDouble , parseEpochTimestamp as __parseEpochTimestamp , serializeFloat as __serializeFloat , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { v4 as generateIdempotencyToken } from "uuid" ; import { CreateAccessPointCommandInput , CreateAccessPointCommandOutput } from "../commands/CreateAccessPointCommand" ; import { CreateFileSystemCommandInput , CreateFileSystemCommandOutput } from "../commands/CreateFileSystemCommand" ; import { CreateMountTargetCommandInput , CreateMountTargetCommandOutput } from "../commands/CreateMountTargetCommand" ; import { CreateTagsCommandInput , CreateTagsCommandOutput } from "../commands/CreateTagsCommand" ; import { DeleteAccessPointCommandInput , DeleteAccessPointCommandOutput } from "../commands/DeleteAccessPointCommand" ; import { DeleteFileSystemCommandInput , DeleteFileSystemCommandOutput } from "../commands/DeleteFileSystemCommand" ; import { DeleteFileSystemPolicyCommandInput , DeleteFileSystemPolicyCommandOutput , } from "../commands/DeleteFileSystemPolicyCommand" ; import { DeleteMountTargetCommandInput , DeleteMountTargetCommandOutput } from "../commands/DeleteMountTargetCommand" ; import { DeleteTagsCommandInput , DeleteTagsCommandOutput } from "../commands/DeleteTagsCommand" ; import { DescribeAccessPointsCommandInput , DescribeAccessPointsCommandOutput , } from "../commands/DescribeAccessPointsCommand" ; import { DescribeAccountPreferencesCommandInput , DescribeAccountPreferencesCommandOutput , } from "../commands/DescribeAccountPreferencesCommand" ; import { DescribeBackupPolicyCommandInput , DescribeBackupPolicyCommandOutput , } from "../commands/DescribeBackupPolicyCommand" ; import { DescribeFileSystemPolicyCommandInput , DescribeFileSystemPolicyCommandOutput , } from "../commands/DescribeFileSystemPolicyCommand" ; import { DescribeFileSystemsCommandInput , DescribeFileSystemsCommandOutput , } from "../commands/DescribeFileSystemsCommand" ; import { DescribeLifecycleConfigurationCommandInput , DescribeLifecycleConfigurationCommandOutput , } from "../commands/DescribeLifecycleConfigurationCommand" ; import { DescribeMountTargetsCommandInput , DescribeMountTargetsCommandOutput , } from "../commands/DescribeMountTargetsCommand" ; import { DescribeMountTargetSecurityGroupsCommandInput , DescribeMountTargetSecurityGroupsCommandOutput , } from "../commands/DescribeMountTargetSecurityGroupsCommand" ; import { DescribeTagsCommandInput , DescribeTagsCommandOutput } from "../commands/DescribeTagsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { ModifyMountTargetSecurityGroupsCommandInput , ModifyMountTargetSecurityGroupsCommandOutput , } from "../commands/ModifyMountTargetSecurityGroupsCommand" ; import { PutAccountPreferencesCommandInput , PutAccountPreferencesCommandOutput , } from "../commands/PutAccountPreferencesCommand" ; import { PutBackupPolicyCommandInput , PutBackupPolicyCommandOutput } from "../commands/PutBackupPolicyCommand" ; import { PutFileSystemPolicyCommandInput , PutFileSystemPolicyCommandOutput , } from "../commands/PutFileSystemPolicyCommand" ; import { PutLifecycleConfigurationCommandInput , PutLifecycleConfigurationCommandOutput , } from "../commands/PutLifecycleConfigurationCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateFileSystemCommandInput , UpdateFileSystemCommandOutput } from "../commands/UpdateFileSystemCommand" ; import { AccessPointAlreadyExists , AccessPointDescription , AccessPointLimitExceeded , AccessPointNotFound , AvailabilityZonesMismatch , BackupPolicy , BadRequest , CreationInfo , DependencyTimeout , FileSystemAlreadyExists , FileSystemDescription , FileSystemInUse , FileSystemLimitExceeded , FileSystemNotFound , FileSystemSize , IncorrectFileSystemLifeCycleState , IncorrectMountTargetState , InsufficientThroughputCapacity , InternalServerError , InvalidPolicyException , IpAddressInUse , LifecyclePolicy , MountTargetConflict , MountTargetDescription , MountTargetNotFound , NetworkInterfaceLimitExceeded , NoFreeAddressesInSubnet , PolicyNotFound , PosixUser , Resource , ResourceIdPreference , RootDirectory , SecurityGroupLimitExceeded , SecurityGroupNotFound , SubnetNotFound , Tag , ThroughputLimitExceeded , TooManyRequests , UnsupportedAvailabilityZone , ValidationException , } from "../models/models_0" ; export const serializeAws_restJson1CreateAccessPointCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/access-points" ; let body ; body = JSON . stringify ( { ClientToken : input . ClientToken ?? generateIdempotencyToken ( ) , ... ( input . FileSystemId !== undefined && input . FileSystemId !== null && { FileSystemId : input . FileSystemId } ) , ... ( input . PosixUser !== undefined && input . PosixUser !== null && { PosixUser : serializeAws_restJson1PosixUser ( input . PosixUser , context ) } ) , ... ( input . RootDirectory !== undefined && input . RootDirectory !== null && { RootDirectory : serializeAws_restJson1RootDirectory ( input . RootDirectory , context ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateFileSystemCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems" ; let body ; body = JSON . stringify ( { ... ( input . AvailabilityZoneName !== undefined && input . AvailabilityZoneName !== null && { AvailabilityZoneName : input . AvailabilityZoneName } ) , ... ( input . Backup !== undefined && input . Backup !== null && { Backup : input . Backup } ) , CreationToken : input . CreationToken ?? generateIdempotencyToken ( ) , ... ( input . Encrypted !== undefined && input . Encrypted !== null && { Encrypted : input . Encrypted } ) , ... ( input . KmsKeyId !== undefined && input . KmsKeyId !== null && { KmsKeyId : input . KmsKeyId } ) , ... ( input . PerformanceMode !== undefined && input . PerformanceMode !== null && { PerformanceMode : input . PerformanceMode } ) , ... ( input . ProvisionedThroughputInMibps !== undefined && input . ProvisionedThroughputInMibps !== null && { ProvisionedThroughputInMibps : __serializeFloat ( input . ProvisionedThroughputInMibps ) , } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , ... ( input . ThroughputMode !== undefined && input . ThroughputMode !== null && { ThroughputMode : input . ThroughputMode } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateMountTargetCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/mount-targets" ; let body ; body = JSON . stringify ( { ... ( input . FileSystemId !== undefined && input . FileSystemId !== null && { FileSystemId : input . FileSystemId } ) , ... ( input . IpAddress !== undefined && input . IpAddress !== null && { IpAddress : input . IpAddress } ) , ... ( input . SecurityGroups !== undefined && input . SecurityGroups !== null && { SecurityGroups : serializeAws_restJson1SecurityGroups ( input . SecurityGroups , context ) , } ) , ... ( input . SubnetId !== undefined && input . SubnetId !== null && { SubnetId : input . SubnetId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateTagsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/create-tags/{FileSystemId}" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteAccessPointCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/access-points/{AccessPointId}" ; if ( input . AccessPointId !== undefined ) { const labelValue = input . AccessPointId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: AccessPointId." ) ; } resolvedPath = resolvedPath . replace ( "{AccessPointId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: AccessPointId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteFileSystemCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems/{FileSystemId}" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteFileSystemPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems/{FileSystemId}/policy" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteMountTargetCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/mount-targets/{MountTargetId}" ; if ( input . MountTargetId !== undefined ) { const labelValue = input . MountTargetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MountTargetId." ) ; } resolvedPath = resolvedPath . replace ( "{MountTargetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MountTargetId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteTagsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/delete-tags/{FileSystemId}" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; body = JSON . stringify ( { ... ( input . TagKeys !== undefined && input . TagKeys !== null && { TagKeys : serializeAws_restJson1TagKeys ( input . TagKeys , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeAccessPointsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/access-points" ; const query = { ... ( input . MaxResults !== undefined && { MaxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , ... ( input . AccessPointId !== undefined && { AccessPointId : input . AccessPointId } ) , ... ( input . FileSystemId !== undefined && { FileSystemId : input . FileSystemId } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DescribeAccountPreferencesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/account-preferences" ; let body ; body = JSON . stringify ( { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeBackupPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems/{FileSystemId}/backup-policy" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeFileSystemPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems/{FileSystemId}/policy" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeFileSystemsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems" ; const query = { ... ( input . MaxItems !== undefined && { MaxItems : input . MaxItems . toString ( ) } ) , ... ( input . Marker !== undefined && { Marker : input . Marker } ) , ... ( input . CreationToken !== undefined && { CreationToken : input . CreationToken } ) , ... ( input . FileSystemId !== undefined && { FileSystemId : input . FileSystemId } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DescribeLifecycleConfigurationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems/{FileSystemId}/lifecycle-configuration" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeMountTargetsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/mount-targets" ; const query = { ... ( input . MaxItems !== undefined && { MaxItems : input . MaxItems . toString ( ) } ) , ... ( input . Marker !== undefined && { Marker : input . Marker } ) , ... ( input . FileSystemId !== undefined && { FileSystemId : input . FileSystemId } ) , ... ( input . MountTargetId !== undefined && { MountTargetId : input . MountTargetId } ) , ... ( input . AccessPointId !== undefined && { AccessPointId : input . AccessPointId } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1DescribeMountTargetSecurityGroupsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/mount-targets/{MountTargetId}/security-groups" ; if ( input . MountTargetId !== undefined ) { const labelValue = input . MountTargetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MountTargetId." ) ; } resolvedPath = resolvedPath . replace ( "{MountTargetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MountTargetId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeTagsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/tags/{FileSystemId}" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } const query = { ... ( input . MaxItems !== undefined && { MaxItems : input . MaxItems . toString ( ) } ) , ... ( input . Marker !== undefined && { Marker : input . Marker } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/resource-tags/{ResourceId}" ; if ( input . ResourceId !== undefined ) { const labelValue = input . ResourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceId." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceId." ) ; } const query = { ... ( input . MaxResults !== undefined && { MaxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { NextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ModifyMountTargetSecurityGroupsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/mount-targets/{MountTargetId}/security-groups" ; if ( input . MountTargetId !== undefined ) { const labelValue = input . MountTargetId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MountTargetId." ) ; } resolvedPath = resolvedPath . replace ( "{MountTargetId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MountTargetId." ) ; } let body ; body = JSON . stringify ( { ... ( input . SecurityGroups !== undefined && input . SecurityGroups !== null && { SecurityGroups : serializeAws_restJson1SecurityGroups ( input . SecurityGroups , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutAccountPreferencesCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/account-preferences" ; let body ; body = JSON . stringify ( { ... ( input . ResourceIdType !== undefined && input . ResourceIdType !== null && { ResourceIdType : input . ResourceIdType } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutBackupPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems/{FileSystemId}/backup-policy" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; body = JSON . stringify ( { ... ( input . BackupPolicy !== undefined && input . BackupPolicy !== null && { BackupPolicy : serializeAws_restJson1BackupPolicy ( input . BackupPolicy , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutFileSystemPolicyCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems/{FileSystemId}/policy" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; body = JSON . stringify ( { ... ( input . BypassPolicyLockoutSafetyCheck !== undefined && input . BypassPolicyLockoutSafetyCheck !== null && { BypassPolicyLockoutSafetyCheck : input . BypassPolicyLockoutSafetyCheck , } ) , ... ( input . Policy !== undefined && input . Policy !== null && { Policy : input . Policy } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutLifecycleConfigurationCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems/{FileSystemId}/lifecycle-configuration" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; body = JSON . stringify ( { ... ( input . LifecyclePolicies !== undefined && input . LifecyclePolicies !== null && { LifecyclePolicies : serializeAws_restJson1LifecyclePolicies ( input . LifecyclePolicies , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/resource-tags/{ResourceId}" ; if ( input . ResourceId !== undefined ) { const labelValue = input . ResourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceId." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/resource-tags/{ResourceId}" ; if ( input . ResourceId !== undefined ) { const labelValue = input . ResourceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceId." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceId." ) ; } const query = { ... ( input . TagKeys !== undefined && { tagKeys : ( input . TagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateFileSystemCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/2015-02-01/file-systems/{FileSystemId}" ; if ( input . FileSystemId !== undefined ) { const labelValue = input . FileSystemId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileSystemId." ) ; } resolvedPath = resolvedPath . replace ( "{FileSystemId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileSystemId." ) ; } let body ; body = JSON . stringify ( { ... ( input . ProvisionedThroughputInMibps !== undefined && input . ProvisionedThroughputInMibps !== null && { ProvisionedThroughputInMibps : __serializeFloat ( input . ProvisionedThroughputInMibps ) , } ) , ... ( input . ThroughputMode !== undefined && input . ThroughputMode !== null && { ThroughputMode : input . ThroughputMode } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1CreateAccessPointCommand = async ( output , context ) : Promise < CreateAccessPointCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateAccessPointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AccessPointArn : undefined , AccessPointId : undefined , ClientToken : undefined , FileSystemId : undefined , LifeCycleState : undefined , Name : undefined , OwnerId : undefined , PosixUser : undefined , RootDirectory : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AccessPointArn !== undefined && data . AccessPointArn !== null ) { contents . AccessPointArn = __expectString ( data . AccessPointArn ) ; } if ( data . AccessPointId !== undefined && data . AccessPointId !== null ) { contents . AccessPointId = __expectString ( data . AccessPointId ) ; } if ( data . ClientToken !== undefined && data . ClientToken !== null ) { contents . ClientToken = __expectString ( data . ClientToken ) ; } if ( data . FileSystemId !== undefined && data . FileSystemId !== null ) { contents . FileSystemId = __expectString ( data . FileSystemId ) ; } if ( data . LifeCycleState !== undefined && data . LifeCycleState !== null ) { contents . LifeCycleState = __expectString ( data . LifeCycleState ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . OwnerId !== undefined && data . OwnerId !== null ) { contents . OwnerId = __expectString ( data . OwnerId ) ; } if ( data . PosixUser !== undefined && data . PosixUser !== null ) { contents . PosixUser = deserializeAws_restJson1PosixUser ( data . PosixUser , context ) ; } if ( data . RootDirectory !== undefined && data . RootDirectory !== null ) { contents . RootDirectory = deserializeAws_restJson1RootDirectory ( data . RootDirectory , context ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateAccessPointCommandError = async ( output , context ) : Promise < CreateAccessPointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessPointAlreadyExists" : case "com.amazonaws.efs#AccessPointAlreadyExists" : response = { ... ( await deserializeAws_restJson1AccessPointAlreadyExistsResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "AccessPointLimitExceeded" : case "com.amazonaws.efs#AccessPointLimitExceeded" : response = { ... ( await deserializeAws_restJson1AccessPointLimitExceededResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IncorrectFileSystemLifeCycleState" : case "com.amazonaws.efs#IncorrectFileSystemLifeCycleState" : response = { ... ( await deserializeAws_restJson1IncorrectFileSystemLifeCycleStateResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1CreateFileSystemCommand = async ( output , context ) : Promise < CreateFileSystemCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateFileSystemCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AvailabilityZoneId : undefined , AvailabilityZoneName : undefined , CreationTime : undefined , CreationToken : undefined , Encrypted : undefined , FileSystemArn : undefined , FileSystemId : undefined , KmsKeyId : undefined , LifeCycleState : undefined , Name : undefined , NumberOfMountTargets : undefined , OwnerId : undefined , PerformanceMode : undefined , ProvisionedThroughputInMibps : undefined , SizeInBytes : undefined , Tags : undefined , ThroughputMode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AvailabilityZoneId !== undefined && data . AvailabilityZoneId !== null ) { contents . AvailabilityZoneId = __expectString ( data . AvailabilityZoneId ) ; } if ( data . AvailabilityZoneName !== undefined && data . AvailabilityZoneName !== null ) { contents . AvailabilityZoneName = __expectString ( data . AvailabilityZoneName ) ; } if ( data . CreationTime !== undefined && data . CreationTime !== null ) { contents . CreationTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationTime ) ) ) ; } if ( data . CreationToken !== undefined && data . CreationToken !== null ) { contents . CreationToken = __expectString ( data . CreationToken ) ; } if ( data . Encrypted !== undefined && data . Encrypted !== null ) { contents . Encrypted = __expectBoolean ( data . Encrypted ) ; } if ( data . FileSystemArn !== undefined && data . FileSystemArn !== null ) { contents . FileSystemArn = __expectString ( data . FileSystemArn ) ; } if ( data . FileSystemId !== undefined && data . FileSystemId !== null ) { contents . FileSystemId = __expectString ( data . FileSystemId ) ; } if ( data . KmsKeyId !== undefined && data . KmsKeyId !== null ) { contents . KmsKeyId = __expectString ( data . KmsKeyId ) ; } if ( data . LifeCycleState !== undefined && data . LifeCycleState !== null ) { contents . LifeCycleState = __expectString ( data . LifeCycleState ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . NumberOfMountTargets !== undefined && data . NumberOfMountTargets !== null ) { contents . NumberOfMountTargets = __expectInt32 ( data . NumberOfMountTargets ) ; } if ( data . OwnerId !== undefined && data . OwnerId !== null ) { contents . OwnerId = __expectString ( data . OwnerId ) ; } if ( data . PerformanceMode !== undefined && data . PerformanceMode !== null ) { contents . PerformanceMode = __expectString ( data . PerformanceMode ) ; } if ( data . ProvisionedThroughputInMibps !== undefined && data . ProvisionedThroughputInMibps !== null ) { contents . ProvisionedThroughputInMibps = __limitedParseDouble ( data . ProvisionedThroughputInMibps ) ; } if ( data . SizeInBytes !== undefined && data . SizeInBytes !== null ) { contents . SizeInBytes = deserializeAws_restJson1FileSystemSize ( data . SizeInBytes , context ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . Tags , context ) ; } if ( data . ThroughputMode !== undefined && data . ThroughputMode !== null ) { contents . ThroughputMode = __expectString ( data . ThroughputMode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateFileSystemCommandError = async ( output , context ) : Promise < CreateFileSystemCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemAlreadyExists" : case "com.amazonaws.efs#FileSystemAlreadyExists" : response = { ... ( await deserializeAws_restJson1FileSystemAlreadyExistsResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemLimitExceeded" : case "com.amazonaws.efs#FileSystemLimitExceeded" : response = { ... ( await deserializeAws_restJson1FileSystemLimitExceededResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientThroughputCapacity" : case "com.amazonaws.efs#InsufficientThroughputCapacity" : response = { ... ( await deserializeAws_restJson1InsufficientThroughputCapacityResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThroughputLimitExceeded" : case "com.amazonaws.efs#ThroughputLimitExceeded" : response = { ... ( await deserializeAws_restJson1ThroughputLimitExceededResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedAvailabilityZone" : case "com.amazonaws.efs#UnsupportedAvailabilityZone" : response = { ... ( await deserializeAws_restJson1UnsupportedAvailabilityZoneResponse ( 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_restJson1CreateMountTargetCommand = async ( output , context ) : Promise < CreateMountTargetCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateMountTargetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AvailabilityZoneId : undefined , AvailabilityZoneName : undefined , FileSystemId : undefined , IpAddress : undefined , LifeCycleState : undefined , MountTargetId : undefined , NetworkInterfaceId : undefined , OwnerId : undefined , SubnetId : undefined , VpcId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AvailabilityZoneId !== undefined && data . AvailabilityZoneId !== null ) { contents . AvailabilityZoneId = __expectString ( data . AvailabilityZoneId ) ; } if ( data . AvailabilityZoneName !== undefined && data . AvailabilityZoneName !== null ) { contents . AvailabilityZoneName = __expectString ( data . AvailabilityZoneName ) ; } if ( data . FileSystemId !== undefined && data . FileSystemId !== null ) { contents . FileSystemId = __expectString ( data . FileSystemId ) ; } if ( data . IpAddress !== undefined && data . IpAddress !== null ) { contents . IpAddress = __expectString ( data . IpAddress ) ; } if ( data . LifeCycleState !== undefined && data . LifeCycleState !== null ) { contents . LifeCycleState = __expectString ( data . LifeCycleState ) ; } if ( data . MountTargetId !== undefined && data . MountTargetId !== null ) { contents . MountTargetId = __expectString ( data . MountTargetId ) ; } if ( data . NetworkInterfaceId !== undefined && data . NetworkInterfaceId !== null ) { contents . NetworkInterfaceId = __expectString ( data . NetworkInterfaceId ) ; } if ( data . OwnerId !== undefined && data . OwnerId !== null ) { contents . OwnerId = __expectString ( data . OwnerId ) ; } if ( data . SubnetId !== undefined && data . SubnetId !== null ) { contents . SubnetId = __expectString ( data . SubnetId ) ; } if ( data . VpcId !== undefined && data . VpcId !== null ) { contents . VpcId = __expectString ( data . VpcId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateMountTargetCommandError = async ( output , context ) : Promise < CreateMountTargetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AvailabilityZonesMismatch" : case "com.amazonaws.efs#AvailabilityZonesMismatch" : response = { ... ( await deserializeAws_restJson1AvailabilityZonesMismatchResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IncorrectFileSystemLifeCycleState" : case "com.amazonaws.efs#IncorrectFileSystemLifeCycleState" : response = { ... ( await deserializeAws_restJson1IncorrectFileSystemLifeCycleStateResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IpAddressInUse" : case "com.amazonaws.efs#IpAddressInUse" : response = { ... ( await deserializeAws_restJson1IpAddressInUseResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MountTargetConflict" : case "com.amazonaws.efs#MountTargetConflict" : response = { ... ( await deserializeAws_restJson1MountTargetConflictResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NetworkInterfaceLimitExceeded" : case "com.amazonaws.efs#NetworkInterfaceLimitExceeded" : response = { ... ( await deserializeAws_restJson1NetworkInterfaceLimitExceededResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NoFreeAddressesInSubnet" : case "com.amazonaws.efs#NoFreeAddressesInSubnet" : response = { ... ( await deserializeAws_restJson1NoFreeAddressesInSubnetResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "SecurityGroupLimitExceeded" : case "com.amazonaws.efs#SecurityGroupLimitExceeded" : response = { ... ( await deserializeAws_restJson1SecurityGroupLimitExceededResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "SecurityGroupNotFound" : case "com.amazonaws.efs#SecurityGroupNotFound" : response = { ... ( await deserializeAws_restJson1SecurityGroupNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "SubnetNotFound" : case "com.amazonaws.efs#SubnetNotFound" : response = { ... ( await deserializeAws_restJson1SubnetNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnsupportedAvailabilityZone" : case "com.amazonaws.efs#UnsupportedAvailabilityZone" : response = { ... ( await deserializeAws_restJson1UnsupportedAvailabilityZoneResponse ( 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_restJson1CreateTagsCommand = async ( output , context ) : Promise < CreateTagsCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateTagsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateTagsCommandError = async ( output , context ) : Promise < CreateTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1DeleteAccessPointCommand = async ( output , context ) : Promise < DeleteAccessPointCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteAccessPointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteAccessPointCommandError = async ( output , context ) : Promise < DeleteAccessPointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessPointNotFound" : case "com.amazonaws.efs#AccessPointNotFound" : response = { ... ( await deserializeAws_restJson1AccessPointNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1DeleteFileSystemCommand = async ( output , context ) : Promise < DeleteFileSystemCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteFileSystemCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteFileSystemCommandError = async ( output , context ) : Promise < DeleteFileSystemCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemInUse" : case "com.amazonaws.efs#FileSystemInUse" : response = { ... ( await deserializeAws_restJson1FileSystemInUseResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1DeleteFileSystemPolicyCommand = async ( output , context ) : Promise < DeleteFileSystemPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteFileSystemPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteFileSystemPolicyCommandError = async ( output , context ) : Promise < DeleteFileSystemPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IncorrectFileSystemLifeCycleState" : case "com.amazonaws.efs#IncorrectFileSystemLifeCycleState" : response = { ... ( await deserializeAws_restJson1IncorrectFileSystemLifeCycleStateResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1DeleteMountTargetCommand = async ( output , context ) : Promise < DeleteMountTargetCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteMountTargetCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteMountTargetCommandError = async ( output , context ) : Promise < DeleteMountTargetCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "DependencyTimeout" : case "com.amazonaws.efs#DependencyTimeout" : response = { ... ( await deserializeAws_restJson1DependencyTimeoutResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MountTargetNotFound" : case "com.amazonaws.efs#MountTargetNotFound" : response = { ... ( await deserializeAws_restJson1MountTargetNotFoundResponse ( 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_restJson1DeleteTagsCommand = async ( output , context ) : Promise < DeleteTagsCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteTagsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteTagsCommandError = async ( output , context ) : Promise < DeleteTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1DescribeAccessPointsCommand = async ( output , context ) : Promise < DescribeAccessPointsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeAccessPointsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AccessPoints : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AccessPoints !== undefined && data . AccessPoints !== null ) { contents . AccessPoints = deserializeAws_restJson1AccessPointDescriptions ( data . AccessPoints , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeAccessPointsCommandError = async ( output , context ) : Promise < DescribeAccessPointsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessPointNotFound" : case "com.amazonaws.efs#AccessPointNotFound" : response = { ... ( await deserializeAws_restJson1AccessPointNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1DescribeAccountPreferencesCommand = async ( output , context ) : Promise < DescribeAccountPreferencesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeAccountPreferencesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , ResourceIdPreference : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . ResourceIdPreference !== undefined && data . ResourceIdPreference !== null ) { contents . ResourceIdPreference = deserializeAws_restJson1ResourceIdPreference ( data . ResourceIdPreference , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeAccountPreferencesCommandError = async ( output , context ) : Promise < DescribeAccountPreferencesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1DescribeBackupPolicyCommand = async ( output , context ) : Promise < DescribeBackupPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeBackupPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPolicy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPolicy !== undefined && data . BackupPolicy !== null ) { contents . BackupPolicy = deserializeAws_restJson1BackupPolicy ( data . BackupPolicy , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeBackupPolicyCommandError = async ( output , context ) : Promise < DescribeBackupPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PolicyNotFound" : case "com.amazonaws.efs#PolicyNotFound" : response = { ... ( await deserializeAws_restJson1PolicyNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.efs#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DescribeFileSystemPolicyCommand = async ( output , context ) : Promise < DescribeFileSystemPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeFileSystemPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , FileSystemId : undefined , Policy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . FileSystemId !== undefined && data . FileSystemId !== null ) { contents . FileSystemId = __expectString ( data . FileSystemId ) ; } if ( data . Policy !== undefined && data . Policy !== null ) { contents . Policy = __expectString ( data . Policy ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeFileSystemPolicyCommandError = async ( output , context ) : Promise < DescribeFileSystemPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "PolicyNotFound" : case "com.amazonaws.efs#PolicyNotFound" : response = { ... ( await deserializeAws_restJson1PolicyNotFoundResponse ( 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_restJson1DescribeFileSystemsCommand = async ( output , context ) : Promise < DescribeFileSystemsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeFileSystemsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , FileSystems : undefined , Marker : undefined , NextMarker : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . FileSystems !== undefined && data . FileSystems !== null ) { contents . FileSystems = deserializeAws_restJson1FileSystemDescriptions ( data . FileSystems , context ) ; } if ( data . Marker !== undefined && data . Marker !== null ) { contents . Marker = __expectString ( data . Marker ) ; } if ( data . NextMarker !== undefined && data . NextMarker !== null ) { contents . NextMarker = __expectString ( data . NextMarker ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeFileSystemsCommandError = async ( output , context ) : Promise < DescribeFileSystemsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1DescribeLifecycleConfigurationCommand = async ( output , context ) : Promise < DescribeLifecycleConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeLifecycleConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , LifecyclePolicies : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . LifecyclePolicies !== undefined && data . LifecyclePolicies !== null ) { contents . LifecyclePolicies = deserializeAws_restJson1LifecyclePolicies ( data . LifecyclePolicies , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeLifecycleConfigurationCommandError = async ( output , context ) : Promise < DescribeLifecycleConfigurationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1DescribeMountTargetsCommand = async ( output , context ) : Promise < DescribeMountTargetsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeMountTargetsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Marker : undefined , MountTargets : undefined , NextMarker : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Marker !== undefined && data . Marker !== null ) { contents . Marker = __expectString ( data . Marker ) ; } if ( data . MountTargets !== undefined && data . MountTargets !== null ) { contents . MountTargets = deserializeAws_restJson1MountTargetDescriptions ( data . MountTargets , context ) ; } if ( data . NextMarker !== undefined && data . NextMarker !== null ) { contents . NextMarker = __expectString ( data . NextMarker ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeMountTargetsCommandError = async ( output , context ) : Promise < DescribeMountTargetsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessPointNotFound" : case "com.amazonaws.efs#AccessPointNotFound" : response = { ... ( await deserializeAws_restJson1AccessPointNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MountTargetNotFound" : case "com.amazonaws.efs#MountTargetNotFound" : response = { ... ( await deserializeAws_restJson1MountTargetNotFoundResponse ( 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_restJson1DescribeMountTargetSecurityGroupsCommand = async ( output , context ) : Promise < DescribeMountTargetSecurityGroupsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeMountTargetSecurityGroupsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , SecurityGroups : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . SecurityGroups !== undefined && data . SecurityGroups !== null ) { contents . SecurityGroups = deserializeAws_restJson1SecurityGroups ( data . SecurityGroups , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeMountTargetSecurityGroupsCommandError = async ( output , context ) : Promise < DescribeMountTargetSecurityGroupsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IncorrectMountTargetState" : case "com.amazonaws.efs#IncorrectMountTargetState" : response = { ... ( await deserializeAws_restJson1IncorrectMountTargetStateResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MountTargetNotFound" : case "com.amazonaws.efs#MountTargetNotFound" : response = { ... ( await deserializeAws_restJson1MountTargetNotFoundResponse ( 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_restJson1DescribeTagsCommand = async ( output , context ) : Promise < DescribeTagsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeTagsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Marker : undefined , NextMarker : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Marker !== undefined && data . Marker !== null ) { contents . Marker = __expectString ( data . Marker ) ; } if ( data . NextMarker !== undefined && data . NextMarker !== null ) { contents . NextMarker = __expectString ( data . NextMarker ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeTagsCommandError = async ( output , context ) : Promise < DescribeTagsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . Tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTagsForResourceCommandError = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessPointNotFound" : case "com.amazonaws.efs#AccessPointNotFound" : response = { ... ( await deserializeAws_restJson1AccessPointNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1ModifyMountTargetSecurityGroupsCommand = async ( output , context ) : Promise < ModifyMountTargetSecurityGroupsCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1ModifyMountTargetSecurityGroupsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ModifyMountTargetSecurityGroupsCommandError = async ( output , context ) : Promise < ModifyMountTargetSecurityGroupsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IncorrectMountTargetState" : case "com.amazonaws.efs#IncorrectMountTargetState" : response = { ... ( await deserializeAws_restJson1IncorrectMountTargetStateResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "MountTargetNotFound" : case "com.amazonaws.efs#MountTargetNotFound" : response = { ... ( await deserializeAws_restJson1MountTargetNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "SecurityGroupLimitExceeded" : case "com.amazonaws.efs#SecurityGroupLimitExceeded" : response = { ... ( await deserializeAws_restJson1SecurityGroupLimitExceededResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "SecurityGroupNotFound" : case "com.amazonaws.efs#SecurityGroupNotFound" : response = { ... ( await deserializeAws_restJson1SecurityGroupNotFoundResponse ( 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_restJson1PutAccountPreferencesCommand = async ( output , context ) : Promise < PutAccountPreferencesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutAccountPreferencesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ResourceIdPreference : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ResourceIdPreference !== undefined && data . ResourceIdPreference !== null ) { contents . ResourceIdPreference = deserializeAws_restJson1ResourceIdPreference ( data . ResourceIdPreference , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutAccountPreferencesCommandError = async ( output , context ) : Promise < PutAccountPreferencesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1PutBackupPolicyCommand = async ( output , context ) : Promise < PutBackupPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutBackupPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , BackupPolicy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . BackupPolicy !== undefined && data . BackupPolicy !== null ) { contents . BackupPolicy = deserializeAws_restJson1BackupPolicy ( data . BackupPolicy , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutBackupPolicyCommandError = async ( output , context ) : Promise < PutBackupPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IncorrectFileSystemLifeCycleState" : case "com.amazonaws.efs#IncorrectFileSystemLifeCycleState" : response = { ... ( await deserializeAws_restJson1IncorrectFileSystemLifeCycleStateResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.efs#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1PutFileSystemPolicyCommand = async ( output , context ) : Promise < PutFileSystemPolicyCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutFileSystemPolicyCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , FileSystemId : undefined , Policy : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . FileSystemId !== undefined && data . FileSystemId !== null ) { contents . FileSystemId = __expectString ( data . FileSystemId ) ; } if ( data . Policy !== undefined && data . Policy !== null ) { contents . Policy = __expectString ( data . Policy ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutFileSystemPolicyCommandError = async ( output , context ) : Promise < PutFileSystemPolicyCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IncorrectFileSystemLifeCycleState" : case "com.amazonaws.efs#IncorrectFileSystemLifeCycleState" : response = { ... ( await deserializeAws_restJson1IncorrectFileSystemLifeCycleStateResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidPolicyException" : case "com.amazonaws.efs#InvalidPolicyException" : response = { ... ( await deserializeAws_restJson1InvalidPolicyExceptionResponse ( 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_restJson1PutLifecycleConfigurationCommand = async ( output , context ) : Promise < PutLifecycleConfigurationCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutLifecycleConfigurationCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , LifecyclePolicies : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . LifecyclePolicies !== undefined && data . LifecyclePolicies !== null ) { contents . LifecyclePolicies = deserializeAws_restJson1LifecyclePolicies ( data . LifecyclePolicies , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutLifecycleConfigurationCommandError = async ( output , context ) : Promise < PutLifecycleConfigurationCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IncorrectFileSystemLifeCycleState" : case "com.amazonaws.efs#IncorrectFileSystemLifeCycleState" : response = { ... ( await deserializeAws_restJson1IncorrectFileSystemLifeCycleStateResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessPointNotFound" : case "com.amazonaws.efs#AccessPointNotFound" : response = { ... ( await deserializeAws_restJson1AccessPointNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessPointNotFound" : case "com.amazonaws.efs#AccessPointNotFound" : response = { ... ( await deserializeAws_restJson1AccessPointNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( 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_restJson1UpdateFileSystemCommand = async ( output , context ) : Promise < UpdateFileSystemCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateFileSystemCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , AvailabilityZoneId : undefined , AvailabilityZoneName : undefined , CreationTime : undefined , CreationToken : undefined , Encrypted : undefined , FileSystemArn : undefined , FileSystemId : undefined , KmsKeyId : undefined , LifeCycleState : undefined , Name : undefined , NumberOfMountTargets : undefined , OwnerId : undefined , PerformanceMode : undefined , ProvisionedThroughputInMibps : undefined , SizeInBytes : undefined , Tags : undefined , ThroughputMode : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AvailabilityZoneId !== undefined && data . AvailabilityZoneId !== null ) { contents . AvailabilityZoneId = __expectString ( data . AvailabilityZoneId ) ; } if ( data . AvailabilityZoneName !== undefined && data . AvailabilityZoneName !== null ) { contents . AvailabilityZoneName = __expectString ( data . AvailabilityZoneName ) ; } if ( data . CreationTime !== undefined && data . CreationTime !== null ) { contents . CreationTime = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . CreationTime ) ) ) ; } if ( data . CreationToken !== undefined && data . CreationToken !== null ) { contents . CreationToken = __expectString ( data . CreationToken ) ; } if ( data . Encrypted !== undefined && data . Encrypted !== null ) { contents . Encrypted = __expectBoolean ( data . Encrypted ) ; } if ( data . FileSystemArn !== undefined && data . FileSystemArn !== null ) { contents . FileSystemArn = __expectString ( data . FileSystemArn ) ; } if ( data . FileSystemId !== undefined && data . FileSystemId !== null ) { contents . FileSystemId = __expectString ( data . FileSystemId ) ; } if ( data . KmsKeyId !== undefined && data . KmsKeyId !== null ) { contents . KmsKeyId = __expectString ( data . KmsKeyId ) ; } if ( data . LifeCycleState !== undefined && data . LifeCycleState !== null ) { contents . LifeCycleState = __expectString ( data . LifeCycleState ) ; } if ( data . Name !== undefined && data . Name !== null ) { contents . Name = __expectString ( data . Name ) ; } if ( data . NumberOfMountTargets !== undefined && data . NumberOfMountTargets !== null ) { contents . NumberOfMountTargets = __expectInt32 ( data . NumberOfMountTargets ) ; } if ( data . OwnerId !== undefined && data . OwnerId !== null ) { contents . OwnerId = __expectString ( data . OwnerId ) ; } if ( data . PerformanceMode !== undefined && data . PerformanceMode !== null ) { contents . PerformanceMode = __expectString ( data . PerformanceMode ) ; } if ( data . ProvisionedThroughputInMibps !== undefined && data . ProvisionedThroughputInMibps !== null ) { contents . ProvisionedThroughputInMibps = __limitedParseDouble ( data . ProvisionedThroughputInMibps ) ; } if ( data . SizeInBytes !== undefined && data . SizeInBytes !== null ) { contents . SizeInBytes = deserializeAws_restJson1FileSystemSize ( data . SizeInBytes , context ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . Tags , context ) ; } if ( data . ThroughputMode !== undefined && data . ThroughputMode !== null ) { contents . ThroughputMode = __expectString ( data . ThroughputMode ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateFileSystemCommandError = async ( output , context ) : Promise < UpdateFileSystemCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "BadRequest" : case "com.amazonaws.efs#BadRequest" : response = { ... ( await deserializeAws_restJson1BadRequestResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "FileSystemNotFound" : case "com.amazonaws.efs#FileSystemNotFound" : response = { ... ( await deserializeAws_restJson1FileSystemNotFoundResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "IncorrectFileSystemLifeCycleState" : case "com.amazonaws.efs#IncorrectFileSystemLifeCycleState" : response = { ... ( await deserializeAws_restJson1IncorrectFileSystemLifeCycleStateResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InsufficientThroughputCapacity" : case "com.amazonaws.efs#InsufficientThroughputCapacity" : response = { ... ( await deserializeAws_restJson1InsufficientThroughputCapacityResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerError" : case "com.amazonaws.efs#InternalServerError" : response = { ... ( await deserializeAws_restJson1InternalServerErrorResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThroughputLimitExceeded" : case "com.amazonaws.efs#ThroughputLimitExceeded" : response = { ... ( await deserializeAws_restJson1ThroughputLimitExceededResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequests" : case "com.amazonaws.efs#TooManyRequests" : response = { ... ( await deserializeAws_restJson1TooManyRequestsResponse ( 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_restJson1AccessPointAlreadyExistsResponse = async ( parsedOutput , context ) : Promise < AccessPointAlreadyExists > => { const contents = { name : "AccessPointAlreadyExists" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , AccessPointId : undefined , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . AccessPointId !== undefined && data . AccessPointId !== null ) { contents . AccessPointId = __expectString ( data . AccessPointId ) ; } if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1AccessPointLimitExceededResponse = async ( parsedOutput , context ) : Promise < AccessPointLimitExceeded > => { const contents = { name : "AccessPointLimitExceeded" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1AccessPointNotFoundResponse = async ( parsedOutput , context ) : Promise < AccessPointNotFound > => { const contents = { name : "AccessPointNotFound" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1AvailabilityZonesMismatchResponse = async ( parsedOutput , context ) : Promise < AvailabilityZonesMismatch > => { const contents = { name : "AvailabilityZonesMismatch" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1BadRequestResponse = async ( parsedOutput , context ) : Promise < BadRequest > => { const contents = { name : "BadRequest" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1DependencyTimeoutResponse = async ( parsedOutput , context ) : Promise < DependencyTimeout > => { const contents = { name : "DependencyTimeout" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1FileSystemAlreadyExistsResponse = async ( parsedOutput , context ) : Promise < FileSystemAlreadyExists > => { const contents = { name : "FileSystemAlreadyExists" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , FileSystemId : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . FileSystemId !== undefined && data . FileSystemId !== null ) { contents . FileSystemId = __expectString ( data . FileSystemId ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1FileSystemInUseResponse = async ( parsedOutput , context ) : Promise < FileSystemInUse > => { const contents = { name : "FileSystemInUse" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1FileSystemLimitExceededResponse = async ( parsedOutput , context ) : Promise < FileSystemLimitExceeded > => { const contents = { name : "FileSystemLimitExceeded" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1FileSystemNotFoundResponse = async ( parsedOutput , context ) : Promise < FileSystemNotFound > => { const contents = { name : "FileSystemNotFound" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1IncorrectFileSystemLifeCycleStateResponse = async ( parsedOutput , context ) : Promise < IncorrectFileSystemLifeCycleState > => { const contents = { name : "IncorrectFileSystemLifeCycleState" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1IncorrectMountTargetStateResponse = async ( parsedOutput , context ) : Promise < IncorrectMountTargetState > => { const contents = { name : "IncorrectMountTargetState" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1InsufficientThroughputCapacityResponse = async ( parsedOutput , context ) : Promise < InsufficientThroughputCapacity > => { const contents = { name : "InsufficientThroughputCapacity" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerErrorResponse = async ( parsedOutput , context ) : Promise < InternalServerError > => { const contents = { name : "InternalServerError" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1InvalidPolicyExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidPolicyException > => { const contents = { name : "InvalidPolicyException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1IpAddressInUseResponse = async ( parsedOutput , context ) : Promise < IpAddressInUse > => { const contents = { name : "IpAddressInUse" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1MountTargetConflictResponse = async ( parsedOutput , context ) : Promise < MountTargetConflict > => { const contents = { name : "MountTargetConflict" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1MountTargetNotFoundResponse = async ( parsedOutput , context ) : Promise < MountTargetNotFound > => { const contents = { name : "MountTargetNotFound" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1NetworkInterfaceLimitExceededResponse = async ( parsedOutput , context ) : Promise < NetworkInterfaceLimitExceeded > => { const contents = { name : "NetworkInterfaceLimitExceeded" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1NoFreeAddressesInSubnetResponse = async ( parsedOutput , context ) : Promise < NoFreeAddressesInSubnet > => { const contents = { name : "NoFreeAddressesInSubnet" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1PolicyNotFoundResponse = async ( parsedOutput , context ) : Promise < PolicyNotFound > => { const contents = { name : "PolicyNotFound" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1SecurityGroupLimitExceededResponse = async ( parsedOutput , context ) : Promise < SecurityGroupLimitExceeded > => { const contents = { name : "SecurityGroupLimitExceeded" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1SecurityGroupNotFoundResponse = async ( parsedOutput , context ) : Promise < SecurityGroupNotFound > => { const contents = { name : "SecurityGroupNotFound" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1SubnetNotFoundResponse = async ( parsedOutput , context ) : Promise < SubnetNotFound > => { const contents = { name : "SubnetNotFound" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1ThroughputLimitExceededResponse = async ( parsedOutput , context ) : Promise < ThroughputLimitExceeded > => { const contents = { name : "ThroughputLimitExceeded" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1TooManyRequestsResponse = async ( parsedOutput , context ) : Promise < TooManyRequests > => { const contents = { name : "TooManyRequests" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1UnsupportedAvailabilityZoneResponse = async ( parsedOutput , context ) : Promise < UnsupportedAvailabilityZone > => { const contents = { name : "UnsupportedAvailabilityZone" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , ErrorCode : undefined , Message : undefined , } ; const data = parsedOutput . body ; if ( data . ErrorCode !== undefined && data . ErrorCode !== null ) { contents . ErrorCode = __expectString ( data . ErrorCode ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . Message = __expectString ( data . Message ) ; } return contents ; } ; const serializeAws_restJson1BackupPolicy = ( input , context ) : any => { return { ... ( input . Status !== undefined && input . Status !== null && { Status : input . Status } ) , } ; } ; const serializeAws_restJson1CreationInfo = ( input , context ) : any => { return { ... ( input . OwnerGid !== undefined && input . OwnerGid !== null && { OwnerGid : input . OwnerGid } ) , ... ( input . OwnerUid !== undefined && input . OwnerUid !== null && { OwnerUid : input . OwnerUid } ) , ... ( input . Permissions !== undefined && input . Permissions !== null && { Permissions : input . Permissions } ) , } ; } ; const serializeAws_restJson1LifecyclePolicies = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1LifecyclePolicy ( entry , context ) ; } ) ; } ; const serializeAws_restJson1LifecyclePolicy = ( input , context ) : any => { return { ... ( input . TransitionToIA !== undefined && input . TransitionToIA !== null && { TransitionToIA : input . TransitionToIA } ) , ... ( input . TransitionToPrimaryStorageClass !== undefined && input . TransitionToPrimaryStorageClass !== null && { TransitionToPrimaryStorageClass : input . TransitionToPrimaryStorageClass , } ) , } ; } ; const serializeAws_restJson1PosixUser = ( input , context ) : any => { return { ... ( input . Gid !== undefined && input . Gid !== null && { Gid : input . Gid } ) , ... ( input . SecondaryGids !== undefined && input . SecondaryGids !== null && { SecondaryGids : serializeAws_restJson1SecondaryGids ( input . SecondaryGids , context ) , } ) , ... ( input . Uid !== undefined && input . Uid !== null && { Uid : input . Uid } ) , } ; } ; const serializeAws_restJson1RootDirectory = ( input , context ) : any => { return { ... ( input . CreationInfo !== undefined && input . CreationInfo !== null && { CreationInfo : serializeAws_restJson1CreationInfo ( input . CreationInfo , context ) } ) , ... ( input . Path !== undefined && input . Path !== null && { Path : input . Path } ) , } ; } ; const serializeAws_restJson1SecondaryGids = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1SecurityGroups = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Tag = ( input , context ) : any => { return { ... ( input . Key !== undefined && input . Key !== null && { Key : input . Key } ) , ... ( input . Value !== undefined && input . Value !== null && { Value : input . Value } ) , } ; } ; const serializeAws_restJson1TagKeys = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Tags = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Tag ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AccessPointDescription = ( output , context ) : AccessPointDescription => { return { AccessPointArn : __expectString ( output . AccessPointArn ) , AccessPointId : __expectString ( output . AccessPointId ) , ClientToken : __expectString ( output . ClientToken ) , FileSystemId : __expectString ( output . FileSystemId ) , LifeCycleState : __expectString ( output . LifeCycleState ) , Name : __expectString ( output . Name ) , OwnerId : __expectString ( output . OwnerId ) , PosixUser : output . PosixUser !== undefined && output . PosixUser !== null ? deserializeAws_restJson1PosixUser ( output . PosixUser , context ) : undefined , RootDirectory : output . RootDirectory !== undefined && output . RootDirectory !== null ? deserializeAws_restJson1RootDirectory ( output . RootDirectory , context ) : undefined , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1Tags ( output . Tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1AccessPointDescriptions = ( output , context ) : AccessPointDescription [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AccessPointDescription ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BackupPolicy = ( output , context ) : BackupPolicy => { return { Status : __expectString ( output . Status ) , } as any ; } ; const deserializeAws_restJson1CreationInfo = ( output , context ) : CreationInfo => { return { OwnerGid : __expectLong ( output . OwnerGid ) , OwnerUid : __expectLong ( output . OwnerUid ) , Permissions : __expectString ( output . Permissions ) , } as any ; } ; const deserializeAws_restJson1FileSystemDescription = ( output , context ) : FileSystemDescription => { return { AvailabilityZoneId : __expectString ( output . AvailabilityZoneId ) , AvailabilityZoneName : __expectString ( output . AvailabilityZoneName ) , CreationTime : output . CreationTime !== undefined && output . CreationTime !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . CreationTime ) ) ) : undefined , CreationToken : __expectString ( output . CreationToken ) , Encrypted : __expectBoolean ( output . Encrypted ) , FileSystemArn : __expectString ( output . FileSystemArn ) , FileSystemId : __expectString ( output . FileSystemId ) , KmsKeyId : __expectString ( output . KmsKeyId ) , LifeCycleState : __expectString ( output . LifeCycleState ) , Name : __expectString ( output . Name ) , NumberOfMountTargets : __expectInt32 ( output . NumberOfMountTargets ) , OwnerId : __expectString ( output . OwnerId ) , PerformanceMode : __expectString ( output . PerformanceMode ) , ProvisionedThroughputInMibps : __limitedParseDouble ( output . ProvisionedThroughputInMibps ) , SizeInBytes : output . SizeInBytes !== undefined && output . SizeInBytes !== null ? deserializeAws_restJson1FileSystemSize ( output . SizeInBytes , context ) : undefined , Tags : output . Tags !== undefined && output . Tags !== null ? deserializeAws_restJson1Tags ( output . Tags , context ) : undefined , ThroughputMode : __expectString ( output . ThroughputMode ) , } as any ; } ; const deserializeAws_restJson1FileSystemDescriptions = ( output , context ) : FileSystemDescription [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1FileSystemDescription ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1FileSystemSize = ( output , context ) : FileSystemSize => { return { Timestamp : output . Timestamp !== undefined && output . Timestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . Timestamp ) ) ) : undefined , Value : __expectLong ( output . Value ) , ValueInIA : __expectLong ( output . ValueInIA ) , ValueInStandard : __expectLong ( output . ValueInStandard ) , } as any ; } ; const deserializeAws_restJson1LifecyclePolicies = ( output , context ) : LifecyclePolicy [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1LifecyclePolicy ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1LifecyclePolicy = ( output , context ) : LifecyclePolicy => { return { TransitionToIA : __expectString ( output . TransitionToIA ) , TransitionToPrimaryStorageClass : __expectString ( output . TransitionToPrimaryStorageClass ) , } as any ; } ; const deserializeAws_restJson1MountTargetDescription = ( output , context ) : MountTargetDescription => { return { AvailabilityZoneId : __expectString ( output . AvailabilityZoneId ) , AvailabilityZoneName : __expectString ( output . AvailabilityZoneName ) , FileSystemId : __expectString ( output . FileSystemId ) , IpAddress : __expectString ( output . IpAddress ) , LifeCycleState : __expectString ( output . LifeCycleState ) , MountTargetId : __expectString ( output . MountTargetId ) , NetworkInterfaceId : __expectString ( output . NetworkInterfaceId ) , OwnerId : __expectString ( output . OwnerId ) , SubnetId : __expectString ( output . SubnetId ) , VpcId : __expectString ( output . VpcId ) , } as any ; } ; const deserializeAws_restJson1MountTargetDescriptions = ( output , context ) : MountTargetDescription [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1MountTargetDescription ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1PosixUser = ( output , context ) : PosixUser => { return { Gid : __expectLong ( output . Gid ) , SecondaryGids : output . SecondaryGids !== undefined && output . SecondaryGids !== null ? deserializeAws_restJson1SecondaryGids ( output . SecondaryGids , context ) : undefined , Uid : __expectLong ( output . Uid ) , } as any ; } ; const deserializeAws_restJson1ResourceIdPreference = ( output , context ) : ResourceIdPreference => { return { ResourceIdType : __expectString ( output . ResourceIdType ) , Resources : output . Resources !== undefined && output . Resources !== null ? deserializeAws_restJson1Resources ( output . Resources , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Resources = ( output , context ) : ( Resource | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1RootDirectory = ( output , context ) : RootDirectory => { return { CreationInfo : output . CreationInfo !== undefined && output . CreationInfo !== null ? deserializeAws_restJson1CreationInfo ( output . CreationInfo , context ) : undefined , Path : __expectString ( output . Path ) , } as any ; } ; const deserializeAws_restJson1SecondaryGids = ( output , context ) : number [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectLong ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1SecurityGroups = ( 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_restJson1Tag = ( output , context ) : Tag => { return { Key : __expectString ( output . Key ) , Value : __expectString ( output . Value ) , } as any ; } ; const deserializeAws_restJson1Tags = ( output , context ) : Tag [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Tag ( entry , context ) ; } ) ; } ; const deserializeMetadata = ( output ) : __ResponseMetadata => ( { httpStatusCode : output . statusCode , requestId : output . headers [ "x-amzn-requestid" ] ?? output . headers [ "x-amzn-request-id" ] , extendedRequestId : output . headers [ "x-amz-id-2" ] , cfId : output . headers [ "x-amz-cf-id" ] , } ) ; const collectBody = ( streamBody = new Uint8Array ( ) , context ) : Promise < Uint8Array > => { if ( streamBody instanceof Uint8Array ) { return Promise . resolve ( streamBody ) ; } return context . streamCollector ( streamBody ) || Promise . resolve ( new Uint8Array ( ) ) ; } ; const collectBodyString = ( streamBody , context ) : Promise < string > => collectBody ( streamBody , context ) . then ( ( body ) => context . utf8Encoder ( body ) ) ; const isSerializableHeaderValue = ( value ) : boolean => value !== undefined && value !== null && value !== "" && ( ! Object . getOwnPropertyNames ( value ) . includes ( "length" ) || value . length != 0 ) && ( ! Object . getOwnPropertyNames ( value ) . includes ( "size" ) || value . size != 0 ) ; const parseBody = ( streamBody , context ) : any => collectBodyString ( streamBody , context ) . then ( ( encoded ) => { if ( encoded . length ) { return JSON . parse ( encoded ) ; } return { } ; } ) ; /**
 * Load an error code for the aws.rest-json-1.1 protocol.
 */ const loadRestJsonErrorCode = ( output , data ) : string => { const findKey = ( object , key ) => Object . keys ( object ) . find ( ( k ) => k . toLowerCase ( ) === key . toLowerCase ( ) ) ; const sanitizeErrorCode = ( rawValue ) : string => { let cleanValue = rawValue ; if ( cleanValue . indexOf ( ":" ) >= 0 ) { cleanValue = cleanValue . split ( ":" ) [ 0 ] ; } if ( cleanValue . indexOf ( "#" ) >= 0 ) { cleanValue = cleanValue . split ( "#" ) [ 1 ] ; } return cleanValue ; } ; const headerKey = findKey ( output . headers , "x-amzn-errortype" ) ; if ( headerKey !== undefined ) { return sanitizeErrorCode ( output . headers [ headerKey ] ) ; } if ( data . code !== undefined ) { return sanitizeErrorCode ( data . code ) ; } if ( data [ "__type" ] !== undefined ) { return sanitizeErrorCode ( data [ "__type" ] ) ; } return "" ; } ;