import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , parseEpochTimestamp as __parseEpochTimestamp , strictParseInt32 as __strictParseInt32 , } 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 { AssociateBrowserSettingsCommandInput , AssociateBrowserSettingsCommandOutput , } from "../commands/AssociateBrowserSettingsCommand" ; import { AssociateNetworkSettingsCommandInput , AssociateNetworkSettingsCommandOutput , } from "../commands/AssociateNetworkSettingsCommand" ; import { AssociateTrustStoreCommandInput , AssociateTrustStoreCommandOutput , } from "../commands/AssociateTrustStoreCommand" ; import { AssociateUserSettingsCommandInput , AssociateUserSettingsCommandOutput , } from "../commands/AssociateUserSettingsCommand" ; import { CreateBrowserSettingsCommandInput , CreateBrowserSettingsCommandOutput , } from "../commands/CreateBrowserSettingsCommand" ; import { CreateIdentityProviderCommandInput , CreateIdentityProviderCommandOutput , } from "../commands/CreateIdentityProviderCommand" ; import { CreateNetworkSettingsCommandInput , CreateNetworkSettingsCommandOutput , } from "../commands/CreateNetworkSettingsCommand" ; import { CreatePortalCommandInput , CreatePortalCommandOutput } from "../commands/CreatePortalCommand" ; import { CreateTrustStoreCommandInput , CreateTrustStoreCommandOutput } from "../commands/CreateTrustStoreCommand" ; import { CreateUserSettingsCommandInput , CreateUserSettingsCommandOutput } from "../commands/CreateUserSettingsCommand" ; import { DeleteBrowserSettingsCommandInput , DeleteBrowserSettingsCommandOutput , } from "../commands/DeleteBrowserSettingsCommand" ; import { DeleteIdentityProviderCommandInput , DeleteIdentityProviderCommandOutput , } from "../commands/DeleteIdentityProviderCommand" ; import { DeleteNetworkSettingsCommandInput , DeleteNetworkSettingsCommandOutput , } from "../commands/DeleteNetworkSettingsCommand" ; import { DeletePortalCommandInput , DeletePortalCommandOutput } from "../commands/DeletePortalCommand" ; import { DeleteTrustStoreCommandInput , DeleteTrustStoreCommandOutput } from "../commands/DeleteTrustStoreCommand" ; import { DeleteUserSettingsCommandInput , DeleteUserSettingsCommandOutput } from "../commands/DeleteUserSettingsCommand" ; import { DisassociateBrowserSettingsCommandInput , DisassociateBrowserSettingsCommandOutput , } from "../commands/DisassociateBrowserSettingsCommand" ; import { DisassociateNetworkSettingsCommandInput , DisassociateNetworkSettingsCommandOutput , } from "../commands/DisassociateNetworkSettingsCommand" ; import { DisassociateTrustStoreCommandInput , DisassociateTrustStoreCommandOutput , } from "../commands/DisassociateTrustStoreCommand" ; import { DisassociateUserSettingsCommandInput , DisassociateUserSettingsCommandOutput , } from "../commands/DisassociateUserSettingsCommand" ; import { GetBrowserSettingsCommandInput , GetBrowserSettingsCommandOutput } from "../commands/GetBrowserSettingsCommand" ; import { GetIdentityProviderCommandInput , GetIdentityProviderCommandOutput , } from "../commands/GetIdentityProviderCommand" ; import { GetNetworkSettingsCommandInput , GetNetworkSettingsCommandOutput } from "../commands/GetNetworkSettingsCommand" ; import { GetPortalCommandInput , GetPortalCommandOutput } from "../commands/GetPortalCommand" ; import { GetPortalServiceProviderMetadataCommandInput , GetPortalServiceProviderMetadataCommandOutput , } from "../commands/GetPortalServiceProviderMetadataCommand" ; import { GetTrustStoreCertificateCommandInput , GetTrustStoreCertificateCommandOutput , } from "../commands/GetTrustStoreCertificateCommand" ; import { GetTrustStoreCommandInput , GetTrustStoreCommandOutput } from "../commands/GetTrustStoreCommand" ; import { GetUserSettingsCommandInput , GetUserSettingsCommandOutput } from "../commands/GetUserSettingsCommand" ; import { ListBrowserSettingsCommandInput , ListBrowserSettingsCommandOutput , } from "../commands/ListBrowserSettingsCommand" ; import { ListIdentityProvidersCommandInput , ListIdentityProvidersCommandOutput , } from "../commands/ListIdentityProvidersCommand" ; import { ListNetworkSettingsCommandInput , ListNetworkSettingsCommandOutput , } from "../commands/ListNetworkSettingsCommand" ; import { ListPortalsCommandInput , ListPortalsCommandOutput } from "../commands/ListPortalsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { ListTrustStoreCertificatesCommandInput , ListTrustStoreCertificatesCommandOutput , } from "../commands/ListTrustStoreCertificatesCommand" ; import { ListTrustStoresCommandInput , ListTrustStoresCommandOutput } from "../commands/ListTrustStoresCommand" ; import { ListUserSettingsCommandInput , ListUserSettingsCommandOutput } from "../commands/ListUserSettingsCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateBrowserSettingsCommandInput , UpdateBrowserSettingsCommandOutput , } from "../commands/UpdateBrowserSettingsCommand" ; import { UpdateIdentityProviderCommandInput , UpdateIdentityProviderCommandOutput , } from "../commands/UpdateIdentityProviderCommand" ; import { UpdateNetworkSettingsCommandInput , UpdateNetworkSettingsCommandOutput , } from "../commands/UpdateNetworkSettingsCommand" ; import { UpdatePortalCommandInput , UpdatePortalCommandOutput } from "../commands/UpdatePortalCommand" ; import { UpdateTrustStoreCommandInput , UpdateTrustStoreCommandOutput } from "../commands/UpdateTrustStoreCommand" ; import { UpdateUserSettingsCommandInput , UpdateUserSettingsCommandOutput } from "../commands/UpdateUserSettingsCommand" ; import { AccessDeniedException , BrowserSettings , BrowserSettingsSummary , Certificate , CertificateSummary , ConflictException , IdentityProvider , IdentityProviderSummary , InternalServerException , NetworkSettings , NetworkSettingsSummary , Portal , PortalSummary , ResourceNotFoundException , ServiceQuotaExceededException , Tag , ThrottlingException , TooManyTagsException , TrustStore , TrustStoreSummary , UserSettings , UserSettingsSummary , ValidationException , ValidationExceptionField , } from "../models/models_0" ; export const serializeAws_restJson1AssociateBrowserSettingsCommand = 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 || "" }` + "/portals/{portalArn+}/browserSettings" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } const query = { ... ( input . browserSettingsArn !== undefined && { browserSettingsArn : input . browserSettingsArn } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1AssociateNetworkSettingsCommand = 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 || "" }` + "/portals/{portalArn+}/networkSettings" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } const query = { ... ( input . networkSettingsArn !== undefined && { networkSettingsArn : input . networkSettingsArn } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1AssociateTrustStoreCommand = 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 || "" }` + "/portals/{portalArn+}/trustStores" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } const query = { ... ( input . trustStoreArn !== undefined && { trustStoreArn : input . trustStoreArn } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1AssociateUserSettingsCommand = 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 || "" }` + "/portals/{portalArn+}/userSettings" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } const query = { ... ( input . userSettingsArn !== undefined && { userSettingsArn : input . userSettingsArn } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1CreateBrowserSettingsCommand = 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 || "" }` + "/browserSettings" ; let body ; body = JSON . stringify ( { ... ( input . additionalEncryptionContext !== undefined && input . additionalEncryptionContext !== null && { additionalEncryptionContext : serializeAws_restJson1EncryptionContextMap ( input . additionalEncryptionContext , context ) , } ) , ... ( input . browserPolicy !== undefined && input . browserPolicy !== null && { browserPolicy : input . browserPolicy } ) , clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . customerManagedKey !== undefined && input . customerManagedKey !== null && { customerManagedKey : input . customerManagedKey } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagList ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateIdentityProviderCommand = 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 || "" }` + "/identityProviders" ; let body ; body = JSON . stringify ( { clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . identityProviderDetails !== undefined && input . identityProviderDetails !== null && { identityProviderDetails : serializeAws_restJson1IdentityProviderDetails ( input . identityProviderDetails , context ) , } ) , ... ( input . identityProviderName !== undefined && input . identityProviderName !== null && { identityProviderName : input . identityProviderName } ) , ... ( input . identityProviderType !== undefined && input . identityProviderType !== null && { identityProviderType : input . identityProviderType } ) , ... ( input . portalArn !== undefined && input . portalArn !== null && { portalArn : input . portalArn } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateNetworkSettingsCommand = 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 || "" }` + "/networkSettings" ; let body ; body = JSON . stringify ( { clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . securityGroupIds !== undefined && input . securityGroupIds !== null && { securityGroupIds : serializeAws_restJson1SecurityGroupIdList ( input . securityGroupIds , context ) , } ) , ... ( input . subnetIds !== undefined && input . subnetIds !== null && { subnetIds : serializeAws_restJson1SubnetIdList ( input . subnetIds , context ) } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagList ( input . tags , context ) } ) , ... ( input . vpcId !== undefined && input . vpcId !== null && { vpcId : input . vpcId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreatePortalCommand = 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 || "" }` + "/portals" ; let body ; body = JSON . stringify ( { ... ( input . additionalEncryptionContext !== undefined && input . additionalEncryptionContext !== null && { additionalEncryptionContext : serializeAws_restJson1EncryptionContextMap ( input . additionalEncryptionContext , context ) , } ) , clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . customerManagedKey !== undefined && input . customerManagedKey !== null && { customerManagedKey : input . customerManagedKey } ) , ... ( input . displayName !== undefined && input . displayName !== null && { displayName : input . displayName } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagList ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateTrustStoreCommand = 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 || "" }` + "/trustStores" ; let body ; body = JSON . stringify ( { ... ( input . certificateList !== undefined && input . certificateList !== null && { certificateList : serializeAws_restJson1CertificateList ( input . certificateList , context ) , } ) , clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagList ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateUserSettingsCommand = 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 || "" }` + "/userSettings" ; let body ; body = JSON . stringify ( { clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . copyAllowed !== undefined && input . copyAllowed !== null && { copyAllowed : input . copyAllowed } ) , ... ( input . downloadAllowed !== undefined && input . downloadAllowed !== null && { downloadAllowed : input . downloadAllowed } ) , ... ( input . pasteAllowed !== undefined && input . pasteAllowed !== null && { pasteAllowed : input . pasteAllowed } ) , ... ( input . printAllowed !== undefined && input . printAllowed !== null && { printAllowed : input . printAllowed } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagList ( input . tags , context ) } ) , ... ( input . uploadAllowed !== undefined && input . uploadAllowed !== null && { uploadAllowed : input . uploadAllowed } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteBrowserSettingsCommand = 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 || "" }` + "/browserSettings/{browserSettingsArn+}" ; if ( input . browserSettingsArn !== undefined ) { const labelValue = input . browserSettingsArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: browserSettingsArn." ) ; } resolvedPath = resolvedPath . replace ( "{browserSettingsArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: browserSettingsArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteIdentityProviderCommand = 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 || "" }` + "/identityProviders/{identityProviderArn+}" ; if ( input . identityProviderArn !== undefined ) { const labelValue = input . identityProviderArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: identityProviderArn." ) ; } resolvedPath = resolvedPath . replace ( "{identityProviderArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: identityProviderArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteNetworkSettingsCommand = 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 || "" }` + "/networkSettings/{networkSettingsArn+}" ; if ( input . networkSettingsArn !== undefined ) { const labelValue = input . networkSettingsArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: networkSettingsArn." ) ; } resolvedPath = resolvedPath . replace ( "{networkSettingsArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: networkSettingsArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeletePortalCommand = 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 || "" }` + "/portals/{portalArn+}" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteTrustStoreCommand = 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 || "" }` + "/trustStores/{trustStoreArn+}" ; if ( input . trustStoreArn !== undefined ) { const labelValue = input . trustStoreArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: trustStoreArn." ) ; } resolvedPath = resolvedPath . replace ( "{trustStoreArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: trustStoreArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteUserSettingsCommand = 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 || "" }` + "/userSettings/{userSettingsArn+}" ; if ( input . userSettingsArn !== undefined ) { const labelValue = input . userSettingsArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: userSettingsArn." ) ; } resolvedPath = resolvedPath . replace ( "{userSettingsArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: userSettingsArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateBrowserSettingsCommand = 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 || "" }` + "/portals/{portalArn+}/browserSettings" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateNetworkSettingsCommand = 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 || "" }` + "/portals/{portalArn+}/networkSettings" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateTrustStoreCommand = 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 || "" }` + "/portals/{portalArn+}/trustStores" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateUserSettingsCommand = 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 || "" }` + "/portals/{portalArn+}/userSettings" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetBrowserSettingsCommand = 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 || "" }` + "/browserSettings/{browserSettingsArn+}" ; if ( input . browserSettingsArn !== undefined ) { const labelValue = input . browserSettingsArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: browserSettingsArn." ) ; } resolvedPath = resolvedPath . replace ( "{browserSettingsArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: browserSettingsArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetIdentityProviderCommand = 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 || "" }` + "/identityProviders/{identityProviderArn+}" ; if ( input . identityProviderArn !== undefined ) { const labelValue = input . identityProviderArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: identityProviderArn." ) ; } resolvedPath = resolvedPath . replace ( "{identityProviderArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: identityProviderArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetNetworkSettingsCommand = 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 || "" }` + "/networkSettings/{networkSettingsArn+}" ; if ( input . networkSettingsArn !== undefined ) { const labelValue = input . networkSettingsArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: networkSettingsArn." ) ; } resolvedPath = resolvedPath . replace ( "{networkSettingsArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: networkSettingsArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetPortalCommand = 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 || "" }` + "/portals/{portalArn+}" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetPortalServiceProviderMetadataCommand = 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 || "" }` + "/portalIdp/{portalArn+}" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetTrustStoreCommand = 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 || "" }` + "/trustStores/{trustStoreArn+}" ; if ( input . trustStoreArn !== undefined ) { const labelValue = input . trustStoreArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: trustStoreArn." ) ; } resolvedPath = resolvedPath . replace ( "{trustStoreArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: trustStoreArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetTrustStoreCertificateCommand = 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 || "" }` + "/trustStores/{trustStoreArn+}/certificate" ; if ( input . trustStoreArn !== undefined ) { const labelValue = input . trustStoreArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: trustStoreArn." ) ; } resolvedPath = resolvedPath . replace ( "{trustStoreArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: trustStoreArn." ) ; } const query = { ... ( input . thumbprint !== undefined && { thumbprint : input . thumbprint } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetUserSettingsCommand = 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 || "" }` + "/userSettings/{userSettingsArn+}" ; if ( input . userSettingsArn !== undefined ) { const labelValue = input . userSettingsArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: userSettingsArn." ) ; } resolvedPath = resolvedPath . replace ( "{userSettingsArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: userSettingsArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListBrowserSettingsCommand = 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 || "" }` + "/browserSettings" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListIdentityProvidersCommand = 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 || "" }` + "/portals/{portalArn+}/identityProviders" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListNetworkSettingsCommand = 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 || "" }` + "/networkSettings" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListPortalsCommand = 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 || "" }` + "/portals" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; 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 || "" }` + "/tags/{resourceArn+}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListTrustStoreCertificatesCommand = 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 || "" }` + "/trustStores/{trustStoreArn+}/certificates" ; if ( input . trustStoreArn !== undefined ) { const labelValue = input . trustStoreArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: trustStoreArn." ) ; } resolvedPath = resolvedPath . replace ( "{trustStoreArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: trustStoreArn." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTrustStoresCommand = 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 || "" }` + "/trustStores" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListUserSettingsCommand = 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 || "" }` + "/userSettings" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn+}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } let body ; body = JSON . stringify ( { clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagList ( 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 || "" }` + "/tags/{resourceArn+}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } const query = { ... ( input . tagKeys !== undefined && { tagKeys : ( input . tagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateBrowserSettingsCommand = 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 || "" }` + "/browserSettings/{browserSettingsArn+}" ; if ( input . browserSettingsArn !== undefined ) { const labelValue = input . browserSettingsArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: browserSettingsArn." ) ; } resolvedPath = resolvedPath . replace ( "{browserSettingsArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: browserSettingsArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . browserPolicy !== undefined && input . browserPolicy !== null && { browserPolicy : input . browserPolicy } ) , clientToken : input . clientToken ?? generateIdempotencyToken ( ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateIdentityProviderCommand = 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 || "" }` + "/identityProviders/{identityProviderArn+}" ; if ( input . identityProviderArn !== undefined ) { const labelValue = input . identityProviderArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: identityProviderArn." ) ; } resolvedPath = resolvedPath . replace ( "{identityProviderArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: identityProviderArn." ) ; } let body ; body = JSON . stringify ( { clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . identityProviderDetails !== undefined && input . identityProviderDetails !== null && { identityProviderDetails : serializeAws_restJson1IdentityProviderDetails ( input . identityProviderDetails , context ) , } ) , ... ( input . identityProviderName !== undefined && input . identityProviderName !== null && { identityProviderName : input . identityProviderName } ) , ... ( input . identityProviderType !== undefined && input . identityProviderType !== null && { identityProviderType : input . identityProviderType } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateNetworkSettingsCommand = 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 || "" }` + "/networkSettings/{networkSettingsArn+}" ; if ( input . networkSettingsArn !== undefined ) { const labelValue = input . networkSettingsArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: networkSettingsArn." ) ; } resolvedPath = resolvedPath . replace ( "{networkSettingsArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: networkSettingsArn." ) ; } let body ; body = JSON . stringify ( { clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . securityGroupIds !== undefined && input . securityGroupIds !== null && { securityGroupIds : serializeAws_restJson1SecurityGroupIdList ( input . securityGroupIds , context ) , } ) , ... ( input . subnetIds !== undefined && input . subnetIds !== null && { subnetIds : serializeAws_restJson1SubnetIdList ( input . subnetIds , context ) } ) , ... ( input . vpcId !== undefined && input . vpcId !== null && { vpcId : input . vpcId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdatePortalCommand = 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 || "" }` + "/portals/{portalArn+}" ; if ( input . portalArn !== undefined ) { const labelValue = input . portalArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: portalArn." ) ; } resolvedPath = resolvedPath . replace ( "{portalArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: portalArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . displayName !== undefined && input . displayName !== null && { displayName : input . displayName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateTrustStoreCommand = 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 || "" }` + "/trustStores/{trustStoreArn+}" ; if ( input . trustStoreArn !== undefined ) { const labelValue = input . trustStoreArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: trustStoreArn." ) ; } resolvedPath = resolvedPath . replace ( "{trustStoreArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: trustStoreArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . certificatesToAdd !== undefined && input . certificatesToAdd !== null && { certificatesToAdd : serializeAws_restJson1CertificateList ( input . certificatesToAdd , context ) , } ) , ... ( input . certificatesToDelete !== undefined && input . certificatesToDelete !== null && { certificatesToDelete : serializeAws_restJson1CertificateThumbprintList ( input . certificatesToDelete , context ) , } ) , clientToken : input . clientToken ?? generateIdempotencyToken ( ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateUserSettingsCommand = 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 || "" }` + "/userSettings/{userSettingsArn+}" ; if ( input . userSettingsArn !== undefined ) { const labelValue = input . userSettingsArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: userSettingsArn." ) ; } resolvedPath = resolvedPath . replace ( "{userSettingsArn+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: userSettingsArn." ) ; } let body ; body = JSON . stringify ( { clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . copyAllowed !== undefined && input . copyAllowed !== null && { copyAllowed : input . copyAllowed } ) , ... ( input . downloadAllowed !== undefined && input . downloadAllowed !== null && { downloadAllowed : input . downloadAllowed } ) , ... ( input . pasteAllowed !== undefined && input . pasteAllowed !== null && { pasteAllowed : input . pasteAllowed } ) , ... ( input . printAllowed !== undefined && input . printAllowed !== null && { printAllowed : input . printAllowed } ) , ... ( input . uploadAllowed !== undefined && input . uploadAllowed !== null && { uploadAllowed : input . uploadAllowed } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1AssociateBrowserSettingsCommand = async ( output , context ) : Promise < AssociateBrowserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateBrowserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , browserSettingsArn : undefined , portalArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . browserSettingsArn !== undefined && data . browserSettingsArn !== null ) { contents . browserSettingsArn = __expectString ( data . browserSettingsArn ) ; } if ( data . portalArn !== undefined && data . portalArn !== null ) { contents . portalArn = __expectString ( data . portalArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateBrowserSettingsCommandError = async ( output , context ) : Promise < AssociateBrowserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1AssociateNetworkSettingsCommand = async ( output , context ) : Promise < AssociateNetworkSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateNetworkSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , networkSettingsArn : undefined , portalArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . networkSettingsArn !== undefined && data . networkSettingsArn !== null ) { contents . networkSettingsArn = __expectString ( data . networkSettingsArn ) ; } if ( data . portalArn !== undefined && data . portalArn !== null ) { contents . portalArn = __expectString ( data . portalArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateNetworkSettingsCommandError = async ( output , context ) : Promise < AssociateNetworkSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1AssociateTrustStoreCommand = async ( output , context ) : Promise < AssociateTrustStoreCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateTrustStoreCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , portalArn : undefined , trustStoreArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . portalArn !== undefined && data . portalArn !== null ) { contents . portalArn = __expectString ( data . portalArn ) ; } if ( data . trustStoreArn !== undefined && data . trustStoreArn !== null ) { contents . trustStoreArn = __expectString ( data . trustStoreArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateTrustStoreCommandError = async ( output , context ) : Promise < AssociateTrustStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1AssociateUserSettingsCommand = async ( output , context ) : Promise < AssociateUserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateUserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , portalArn : undefined , userSettingsArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . portalArn !== undefined && data . portalArn !== null ) { contents . portalArn = __expectString ( data . portalArn ) ; } if ( data . userSettingsArn !== undefined && data . userSettingsArn !== null ) { contents . userSettingsArn = __expectString ( data . userSettingsArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateUserSettingsCommandError = async ( output , context ) : Promise < AssociateUserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1CreateBrowserSettingsCommand = async ( output , context ) : Promise < CreateBrowserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateBrowserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , browserSettingsArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . browserSettingsArn !== undefined && data . browserSettingsArn !== null ) { contents . browserSettingsArn = __expectString ( data . browserSettingsArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateBrowserSettingsCommandError = async ( output , context ) : Promise < CreateBrowserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.workspacesweb#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1CreateIdentityProviderCommand = async ( output , context ) : Promise < CreateIdentityProviderCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateIdentityProviderCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , identityProviderArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . identityProviderArn !== undefined && data . identityProviderArn !== null ) { contents . identityProviderArn = __expectString ( data . identityProviderArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateIdentityProviderCommandError = async ( output , context ) : Promise < CreateIdentityProviderCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1CreateNetworkSettingsCommand = async ( output , context ) : Promise < CreateNetworkSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateNetworkSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , networkSettingsArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . networkSettingsArn !== undefined && data . networkSettingsArn !== null ) { contents . networkSettingsArn = __expectString ( data . networkSettingsArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateNetworkSettingsCommandError = async ( output , context ) : Promise < CreateNetworkSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.workspacesweb#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1CreatePortalCommand = async ( output , context ) : Promise < CreatePortalCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreatePortalCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , portalArn : undefined , portalEndpoint : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . portalArn !== undefined && data . portalArn !== null ) { contents . portalArn = __expectString ( data . portalArn ) ; } if ( data . portalEndpoint !== undefined && data . portalEndpoint !== null ) { contents . portalEndpoint = __expectString ( data . portalEndpoint ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreatePortalCommandError = async ( output , context ) : Promise < CreatePortalCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.workspacesweb#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1CreateTrustStoreCommand = async ( output , context ) : Promise < CreateTrustStoreCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateTrustStoreCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , trustStoreArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . trustStoreArn !== undefined && data . trustStoreArn !== null ) { contents . trustStoreArn = __expectString ( data . trustStoreArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateTrustStoreCommandError = async ( output , context ) : Promise < CreateTrustStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.workspacesweb#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1CreateUserSettingsCommand = async ( output , context ) : Promise < CreateUserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateUserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , userSettingsArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . userSettingsArn !== undefined && data . userSettingsArn !== null ) { contents . userSettingsArn = __expectString ( data . userSettingsArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateUserSettingsCommandError = async ( output , context ) : Promise < CreateUserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.workspacesweb#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DeleteBrowserSettingsCommand = async ( output , context ) : Promise < DeleteBrowserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteBrowserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteBrowserSettingsCommandError = async ( output , context ) : Promise < DeleteBrowserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DeleteIdentityProviderCommand = async ( output , context ) : Promise < DeleteIdentityProviderCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteIdentityProviderCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteIdentityProviderCommandError = async ( output , context ) : Promise < DeleteIdentityProviderCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DeleteNetworkSettingsCommand = async ( output , context ) : Promise < DeleteNetworkSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteNetworkSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteNetworkSettingsCommandError = async ( output , context ) : Promise < DeleteNetworkSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DeletePortalCommand = async ( output , context ) : Promise < DeletePortalCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeletePortalCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeletePortalCommandError = async ( output , context ) : Promise < DeletePortalCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DeleteTrustStoreCommand = async ( output , context ) : Promise < DeleteTrustStoreCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteTrustStoreCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteTrustStoreCommandError = async ( output , context ) : Promise < DeleteTrustStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DeleteUserSettingsCommand = async ( output , context ) : Promise < DeleteUserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteUserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteUserSettingsCommandError = async ( output , context ) : Promise < DeleteUserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.workspacesweb#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DisassociateBrowserSettingsCommand = async ( output , context ) : Promise < DisassociateBrowserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateBrowserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateBrowserSettingsCommandError = async ( output , context ) : Promise < DisassociateBrowserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DisassociateNetworkSettingsCommand = async ( output , context ) : Promise < DisassociateNetworkSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateNetworkSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateNetworkSettingsCommandError = async ( output , context ) : Promise < DisassociateNetworkSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DisassociateTrustStoreCommand = async ( output , context ) : Promise < DisassociateTrustStoreCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateTrustStoreCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateTrustStoreCommandError = async ( output , context ) : Promise < DisassociateTrustStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1DisassociateUserSettingsCommand = async ( output , context ) : Promise < DisassociateUserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateUserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateUserSettingsCommandError = async ( output , context ) : Promise < DisassociateUserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1GetBrowserSettingsCommand = async ( output , context ) : Promise < GetBrowserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetBrowserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , browserSettings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . browserSettings !== undefined && data . browserSettings !== null ) { contents . browserSettings = deserializeAws_restJson1BrowserSettings ( data . browserSettings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetBrowserSettingsCommandError = async ( output , context ) : Promise < GetBrowserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1GetIdentityProviderCommand = async ( output , context ) : Promise < GetIdentityProviderCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetIdentityProviderCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , identityProvider : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . identityProvider !== undefined && data . identityProvider !== null ) { contents . identityProvider = deserializeAws_restJson1IdentityProvider ( data . identityProvider , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetIdentityProviderCommandError = async ( output , context ) : Promise < GetIdentityProviderCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1GetNetworkSettingsCommand = async ( output , context ) : Promise < GetNetworkSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetNetworkSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , networkSettings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . networkSettings !== undefined && data . networkSettings !== null ) { contents . networkSettings = deserializeAws_restJson1NetworkSettings ( data . networkSettings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetNetworkSettingsCommandError = async ( output , context ) : Promise < GetNetworkSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1GetPortalCommand = async ( output , context ) : Promise < GetPortalCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetPortalCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , portal : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . portal !== undefined && data . portal !== null ) { contents . portal = deserializeAws_restJson1Portal ( data . portal , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetPortalCommandError = async ( output , context ) : Promise < GetPortalCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1GetPortalServiceProviderMetadataCommand = async ( output , context ) : Promise < GetPortalServiceProviderMetadataCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetPortalServiceProviderMetadataCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , portalArn : undefined , serviceProviderSamlMetadata : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . portalArn !== undefined && data . portalArn !== null ) { contents . portalArn = __expectString ( data . portalArn ) ; } if ( data . serviceProviderSamlMetadata !== undefined && data . serviceProviderSamlMetadata !== null ) { contents . serviceProviderSamlMetadata = __expectString ( data . serviceProviderSamlMetadata ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetPortalServiceProviderMetadataCommandError = async ( output , context ) : Promise < GetPortalServiceProviderMetadataCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1GetTrustStoreCommand = async ( output , context ) : Promise < GetTrustStoreCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetTrustStoreCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , trustStore : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . trustStore !== undefined && data . trustStore !== null ) { contents . trustStore = deserializeAws_restJson1TrustStore ( data . trustStore , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetTrustStoreCommandError = async ( output , context ) : Promise < GetTrustStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1GetTrustStoreCertificateCommand = async ( output , context ) : Promise < GetTrustStoreCertificateCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetTrustStoreCertificateCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , certificate : undefined , trustStoreArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . certificate !== undefined && data . certificate !== null ) { contents . certificate = deserializeAws_restJson1Certificate ( data . certificate , context ) ; } if ( data . trustStoreArn !== undefined && data . trustStoreArn !== null ) { contents . trustStoreArn = __expectString ( data . trustStoreArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetTrustStoreCertificateCommandError = async ( output , context ) : Promise < GetTrustStoreCertificateCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1GetUserSettingsCommand = async ( output , context ) : Promise < GetUserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetUserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , userSettings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . userSettings !== undefined && data . userSettings !== null ) { contents . userSettings = deserializeAws_restJson1UserSettings ( data . userSettings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetUserSettingsCommandError = async ( output , context ) : Promise < GetUserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1ListBrowserSettingsCommand = async ( output , context ) : Promise < ListBrowserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListBrowserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , browserSettings : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . browserSettings !== undefined && data . browserSettings !== null ) { contents . browserSettings = deserializeAws_restJson1BrowserSettingsList ( data . browserSettings , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListBrowserSettingsCommandError = async ( output , context ) : Promise < ListBrowserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1ListIdentityProvidersCommand = async ( output , context ) : Promise < ListIdentityProvidersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListIdentityProvidersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , identityProviders : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . identityProviders !== undefined && data . identityProviders !== null ) { contents . identityProviders = deserializeAws_restJson1IdentityProviderList ( data . identityProviders , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListIdentityProvidersCommandError = async ( output , context ) : Promise < ListIdentityProvidersCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1ListNetworkSettingsCommand = async ( output , context ) : Promise < ListNetworkSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListNetworkSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , networkSettings : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . networkSettings !== undefined && data . networkSettings !== null ) { contents . networkSettings = deserializeAws_restJson1NetworkSettingsList ( data . networkSettings , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListNetworkSettingsCommandError = async ( output , context ) : Promise < ListNetworkSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1ListPortalsCommand = async ( output , context ) : Promise < ListPortalsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListPortalsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , portals : 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 . portals !== undefined && data . portals !== null ) { contents . portals = deserializeAws_restJson1PortalList ( data . portals , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListPortalsCommandError = async ( output , context ) : Promise < ListPortalsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagList ( 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 "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1ListTrustStoreCertificatesCommand = async ( output , context ) : Promise < ListTrustStoreCertificatesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTrustStoreCertificatesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , certificateList : undefined , nextToken : undefined , trustStoreArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . certificateList !== undefined && data . certificateList !== null ) { contents . certificateList = deserializeAws_restJson1CertificateSummaryList ( data . certificateList , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } if ( data . trustStoreArn !== undefined && data . trustStoreArn !== null ) { contents . trustStoreArn = __expectString ( data . trustStoreArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTrustStoreCertificatesCommandError = async ( output , context ) : Promise < ListTrustStoreCertificatesCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1ListTrustStoresCommand = async ( output , context ) : Promise < ListTrustStoresCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTrustStoresCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , trustStores : 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 . trustStores !== undefined && data . trustStores !== null ) { contents . trustStores = deserializeAws_restJson1TrustStoreSummaryList ( data . trustStores , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTrustStoresCommandError = async ( output , context ) : Promise < ListTrustStoresCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1ListUserSettingsCommand = async ( output , context ) : Promise < ListUserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListUserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , userSettings : 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 . userSettings !== undefined && data . userSettings !== null ) { contents . userSettings = deserializeAws_restJson1UserSettingsList ( data . userSettings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListUserSettingsCommandError = async ( output , context ) : Promise < ListUserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyTagsException" : case "com.amazonaws.workspacesweb#TooManyTagsException" : response = { ... ( await deserializeAws_restJson1TooManyTagsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1UpdateBrowserSettingsCommand = async ( output , context ) : Promise < UpdateBrowserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateBrowserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , browserSettings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . browserSettings !== undefined && data . browserSettings !== null ) { contents . browserSettings = deserializeAws_restJson1BrowserSettings ( data . browserSettings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateBrowserSettingsCommandError = async ( output , context ) : Promise < UpdateBrowserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1UpdateIdentityProviderCommand = async ( output , context ) : Promise < UpdateIdentityProviderCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateIdentityProviderCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , identityProvider : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . identityProvider !== undefined && data . identityProvider !== null ) { contents . identityProvider = deserializeAws_restJson1IdentityProvider ( data . identityProvider , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateIdentityProviderCommandError = async ( output , context ) : Promise < UpdateIdentityProviderCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1UpdateNetworkSettingsCommand = async ( output , context ) : Promise < UpdateNetworkSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateNetworkSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , networkSettings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . networkSettings !== undefined && data . networkSettings !== null ) { contents . networkSettings = deserializeAws_restJson1NetworkSettings ( data . networkSettings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateNetworkSettingsCommandError = async ( output , context ) : Promise < UpdateNetworkSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1UpdatePortalCommand = async ( output , context ) : Promise < UpdatePortalCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdatePortalCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , portal : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . portal !== undefined && data . portal !== null ) { contents . portal = deserializeAws_restJson1Portal ( data . portal , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdatePortalCommandError = async ( output , context ) : Promise < UpdatePortalCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1UpdateTrustStoreCommand = async ( output , context ) : Promise < UpdateTrustStoreCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateTrustStoreCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , trustStoreArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . trustStoreArn !== undefined && data . trustStoreArn !== null ) { contents . trustStoreArn = __expectString ( data . trustStoreArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateTrustStoreCommandError = async ( output , context ) : Promise < UpdateTrustStoreCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.workspacesweb#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#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_restJson1UpdateUserSettingsCommand = async ( output , context ) : Promise < UpdateUserSettingsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateUserSettingsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , userSettings : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . userSettings !== undefined && data . userSettings !== null ) { contents . userSettings = deserializeAws_restJson1UserSettings ( data . userSettings , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateUserSettingsCommandError = async ( output , context ) : Promise < UpdateUserSettingsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.workspacesweb#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.workspacesweb#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.workspacesweb#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.workspacesweb#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.workspacesweb#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_restJson1AccessDeniedExceptionResponse = async ( parsedOutput , context ) : Promise < AccessDeniedException > => { const contents = { name : "AccessDeniedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , resourceId : undefined , resourceType : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . resourceId !== undefined && data . resourceId !== null ) { contents . resourceId = __expectString ( data . resourceId ) ; } if ( data . resourceType !== undefined && data . resourceType !== null ) { contents . resourceType = __expectString ( data . resourceType ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , retryAfterSeconds : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . retryAfterSeconds = __strictParseInt32 ( parsedOutput . headers [ "retry-after" ] ) ; } const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , resourceId : undefined , resourceType : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . resourceId !== undefined && data . resourceId !== null ) { contents . resourceId = __expectString ( data . resourceId ) ; } if ( data . resourceType !== undefined && data . resourceType !== null ) { contents . resourceType = __expectString ( data . resourceType ) ; } return contents ; } ; const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceQuotaExceededException > => { const contents = { name : "ServiceQuotaExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , quotaCode : undefined , resourceId : undefined , resourceType : undefined , serviceCode : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . quotaCode !== undefined && data . quotaCode !== null ) { contents . quotaCode = __expectString ( data . quotaCode ) ; } if ( data . resourceId !== undefined && data . resourceId !== null ) { contents . resourceId = __expectString ( data . resourceId ) ; } if ( data . resourceType !== undefined && data . resourceType !== null ) { contents . resourceType = __expectString ( data . resourceType ) ; } if ( data . serviceCode !== undefined && data . serviceCode !== null ) { contents . serviceCode = __expectString ( data . serviceCode ) ; } return contents ; } ; const deserializeAws_restJson1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const contents = { name : "ThrottlingException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , quotaCode : undefined , retryAfterSeconds : undefined , serviceCode : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . retryAfterSeconds = __strictParseInt32 ( parsedOutput . headers [ "retry-after" ] ) ; } const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . quotaCode !== undefined && data . quotaCode !== null ) { contents . quotaCode = __expectString ( data . quotaCode ) ; } if ( data . serviceCode !== undefined && data . serviceCode !== null ) { contents . serviceCode = __expectString ( data . serviceCode ) ; } return contents ; } ; const deserializeAws_restJson1TooManyTagsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyTagsException > => { const contents = { name : "TooManyTagsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , resourceName : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . resourceName !== undefined && data . resourceName !== null ) { contents . resourceName = __expectString ( data . resourceName ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , fieldList : undefined , message : undefined , reason : undefined , } ; const data = parsedOutput . body ; if ( data . fieldList !== undefined && data . fieldList !== null ) { contents . fieldList = deserializeAws_restJson1ValidationExceptionFieldList ( data . fieldList , context ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . reason !== undefined && data . reason !== null ) { contents . reason = __expectString ( data . reason ) ; } return contents ; } ; const serializeAws_restJson1CertificateList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return context . base64Encoder ( entry ) ; } ) ; } ; const serializeAws_restJson1CertificateThumbprintList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1EncryptionContextMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1IdentityProviderDetails = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1SecurityGroupIdList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1SubnetIdList = ( 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_restJson1TagList = ( 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_restJson1ArnList = ( 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_restJson1BrowserSettings = ( output , context ) : BrowserSettings => { return { associatedPortalArns : output . associatedPortalArns !== undefined && output . associatedPortalArns !== null ? deserializeAws_restJson1ArnList ( output . associatedPortalArns , context ) : undefined , browserPolicy : __expectString ( output . browserPolicy ) , browserSettingsArn : __expectString ( output . browserSettingsArn ) , } as any ; } ; const deserializeAws_restJson1BrowserSettingsList = ( output , context ) : BrowserSettingsSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BrowserSettingsSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BrowserSettingsSummary = ( output , context ) : BrowserSettingsSummary => { return { browserSettingsArn : __expectString ( output . browserSettingsArn ) , } as any ; } ; const deserializeAws_restJson1Certificate = ( output , context ) : Certificate => { return { body : output . body !== undefined && output . body !== null ? context . base64Decoder ( output . body ) : undefined , issuer : __expectString ( output . issuer ) , notValidAfter : output . notValidAfter !== undefined && output . notValidAfter !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . notValidAfter ) ) ) : undefined , notValidBefore : output . notValidBefore !== undefined && output . notValidBefore !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . notValidBefore ) ) ) : undefined , subject : __expectString ( output . subject ) , thumbprint : __expectString ( output . thumbprint ) , } as any ; } ; const deserializeAws_restJson1CertificateSummary = ( output , context ) : CertificateSummary => { return { issuer : __expectString ( output . issuer ) , notValidAfter : output . notValidAfter !== undefined && output . notValidAfter !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . notValidAfter ) ) ) : undefined , notValidBefore : output . notValidBefore !== undefined && output . notValidBefore !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . notValidBefore ) ) ) : undefined , subject : __expectString ( output . subject ) , thumbprint : __expectString ( output . thumbprint ) , } as any ; } ; const deserializeAws_restJson1CertificateSummaryList = ( output , context ) : CertificateSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CertificateSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1IdentityProvider = ( output , context ) : IdentityProvider => { return { identityProviderArn : __expectString ( output . identityProviderArn ) , identityProviderDetails : output . identityProviderDetails !== undefined && output . identityProviderDetails !== null ? deserializeAws_restJson1IdentityProviderDetails ( output . identityProviderDetails , context ) : undefined , identityProviderName : __expectString ( output . identityProviderName ) , identityProviderType : __expectString ( output . identityProviderType ) , } as any ; } ; const deserializeAws_restJson1IdentityProviderDetails = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1IdentityProviderList = ( output , context ) : IdentityProviderSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1IdentityProviderSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1IdentityProviderSummary = ( output , context ) : IdentityProviderSummary => { return { identityProviderArn : __expectString ( output . identityProviderArn ) , identityProviderName : __expectString ( output . identityProviderName ) , identityProviderType : __expectString ( output . identityProviderType ) , } as any ; } ; const deserializeAws_restJson1NetworkSettings = ( output , context ) : NetworkSettings => { return { associatedPortalArns : output . associatedPortalArns !== undefined && output . associatedPortalArns !== null ? deserializeAws_restJson1ArnList ( output . associatedPortalArns , context ) : undefined , networkSettingsArn : __expectString ( output . networkSettingsArn ) , securityGroupIds : output . securityGroupIds !== undefined && output . securityGroupIds !== null ? deserializeAws_restJson1SecurityGroupIdList ( output . securityGroupIds , context ) : undefined , subnetIds : output . subnetIds !== undefined && output . subnetIds !== null ? deserializeAws_restJson1SubnetIdList ( output . subnetIds , context ) : undefined , vpcId : __expectString ( output . vpcId ) , } as any ; } ; const deserializeAws_restJson1NetworkSettingsList = ( output , context ) : NetworkSettingsSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1NetworkSettingsSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1NetworkSettingsSummary = ( output , context ) : NetworkSettingsSummary => { return { networkSettingsArn : __expectString ( output . networkSettingsArn ) , vpcId : __expectString ( output . vpcId ) , } as any ; } ; const deserializeAws_restJson1Portal = ( output , context ) : Portal => { return { browserSettingsArn : __expectString ( output . browserSettingsArn ) , browserType : __expectString ( output . browserType ) , creationDate : output . creationDate !== undefined && output . creationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationDate ) ) ) : undefined , displayName : __expectString ( output . displayName ) , networkSettingsArn : __expectString ( output . networkSettingsArn ) , portalArn : __expectString ( output . portalArn ) , portalEndpoint : __expectString ( output . portalEndpoint ) , portalStatus : __expectString ( output . portalStatus ) , rendererType : __expectString ( output . rendererType ) , statusReason : __expectString ( output . statusReason ) , trustStoreArn : __expectString ( output . trustStoreArn ) , userSettingsArn : __expectString ( output . userSettingsArn ) , } as any ; } ; const deserializeAws_restJson1PortalList = ( output , context ) : PortalSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1PortalSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1PortalSummary = ( output , context ) : PortalSummary => { return { browserSettingsArn : __expectString ( output . browserSettingsArn ) , browserType : __expectString ( output . browserType ) , creationDate : output . creationDate !== undefined && output . creationDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationDate ) ) ) : undefined , displayName : __expectString ( output . displayName ) , networkSettingsArn : __expectString ( output . networkSettingsArn ) , portalArn : __expectString ( output . portalArn ) , portalEndpoint : __expectString ( output . portalEndpoint ) , portalStatus : __expectString ( output . portalStatus ) , rendererType : __expectString ( output . rendererType ) , trustStoreArn : __expectString ( output . trustStoreArn ) , userSettingsArn : __expectString ( output . userSettingsArn ) , } as any ; } ; const deserializeAws_restJson1SecurityGroupIdList = ( 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_restJson1SubnetIdList = ( 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_restJson1TagList = ( output , context ) : Tag [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Tag ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1TrustStore = ( output , context ) : TrustStore => { return { associatedPortalArns : output . associatedPortalArns !== undefined && output . associatedPortalArns !== null ? deserializeAws_restJson1ArnList ( output . associatedPortalArns , context ) : undefined , trustStoreArn : __expectString ( output . trustStoreArn ) , } as any ; } ; const deserializeAws_restJson1TrustStoreSummary = ( output , context ) : TrustStoreSummary => { return { trustStoreArn : __expectString ( output . trustStoreArn ) , } as any ; } ; const deserializeAws_restJson1TrustStoreSummaryList = ( output , context ) : TrustStoreSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1TrustStoreSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1UserSettings = ( output , context ) : UserSettings => { return { associatedPortalArns : output . associatedPortalArns !== undefined && output . associatedPortalArns !== null ? deserializeAws_restJson1ArnList ( output . associatedPortalArns , context ) : undefined , copyAllowed : __expectString ( output . copyAllowed ) , downloadAllowed : __expectString ( output . downloadAllowed ) , pasteAllowed : __expectString ( output . pasteAllowed ) , printAllowed : __expectString ( output . printAllowed ) , uploadAllowed : __expectString ( output . uploadAllowed ) , userSettingsArn : __expectString ( output . userSettingsArn ) , } as any ; } ; const deserializeAws_restJson1UserSettingsList = ( output , context ) : UserSettingsSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1UserSettingsSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1UserSettingsSummary = ( output , context ) : UserSettingsSummary => { return { copyAllowed : __expectString ( output . copyAllowed ) , downloadAllowed : __expectString ( output . downloadAllowed ) , pasteAllowed : __expectString ( output . pasteAllowed ) , printAllowed : __expectString ( output . printAllowed ) , uploadAllowed : __expectString ( output . uploadAllowed ) , userSettingsArn : __expectString ( output . userSettingsArn ) , } as any ; } ; const deserializeAws_restJson1ValidationExceptionField = ( output , context ) : ValidationExceptionField => { return { message : __expectString ( output . message ) , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1ValidationExceptionFieldList = ( output , context ) : ValidationExceptionField [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ValidationExceptionField ( 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 "" ; } ;