import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectNonNull as __expectNonNull , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , } 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 { ConfigureLogsCommandInput , ConfigureLogsCommandOutput } from "../commands/ConfigureLogsCommand" ; import { CreateChannelCommandInput , CreateChannelCommandOutput } from "../commands/CreateChannelCommand" ; import { CreateHarvestJobCommandInput , CreateHarvestJobCommandOutput } from "../commands/CreateHarvestJobCommand" ; import { CreateOriginEndpointCommandInput , CreateOriginEndpointCommandOutput , } from "../commands/CreateOriginEndpointCommand" ; import { DeleteChannelCommandInput , DeleteChannelCommandOutput } from "../commands/DeleteChannelCommand" ; import { DeleteOriginEndpointCommandInput , DeleteOriginEndpointCommandOutput , } from "../commands/DeleteOriginEndpointCommand" ; import { DescribeChannelCommandInput , DescribeChannelCommandOutput } from "../commands/DescribeChannelCommand" ; import { DescribeHarvestJobCommandInput , DescribeHarvestJobCommandOutput } from "../commands/DescribeHarvestJobCommand" ; import { DescribeOriginEndpointCommandInput , DescribeOriginEndpointCommandOutput , } from "../commands/DescribeOriginEndpointCommand" ; import { ListChannelsCommandInput , ListChannelsCommandOutput } from "../commands/ListChannelsCommand" ; import { ListHarvestJobsCommandInput , ListHarvestJobsCommandOutput } from "../commands/ListHarvestJobsCommand" ; import { ListOriginEndpointsCommandInput , ListOriginEndpointsCommandOutput , } from "../commands/ListOriginEndpointsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { RotateChannelCredentialsCommandInput , RotateChannelCredentialsCommandOutput , } from "../commands/RotateChannelCredentialsCommand" ; import { RotateIngestEndpointCredentialsCommandInput , RotateIngestEndpointCredentialsCommandOutput , } from "../commands/RotateIngestEndpointCredentialsCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateChannelCommandInput , UpdateChannelCommandOutput } from "../commands/UpdateChannelCommand" ; import { UpdateOriginEndpointCommandInput , UpdateOriginEndpointCommandOutput , } from "../commands/UpdateOriginEndpointCommand" ; import { __AdTriggersElement , __PeriodTriggersElement , Authorization , Channel , CmafEncryption , CmafPackage , CmafPackageCreateOrUpdateParameters , DashEncryption , DashPackage , EgressAccessLogs , EncryptionContractConfiguration , ForbiddenException , HarvestJob , HlsEncryption , HlsIngest , HlsManifest , HlsManifestCreateOrUpdateParameters , HlsPackage , IngestEndpoint , IngressAccessLogs , InternalServerErrorException , MssEncryption , MssPackage , NotFoundException , OriginEndpoint , S3Destination , ServiceUnavailableException , SpekeKeyProvider , StreamSelection , TooManyRequestsException , UnprocessableEntityException , } from "../models/models_0" ; export const serializeAws_restJson1ConfigureLogsCommand = 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 || "" }` + "/channels/{Id}/configure_logs" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } let body ; body = JSON . stringify ( { ... ( input . EgressAccessLogs !== undefined && input . EgressAccessLogs !== null && { egressAccessLogs : serializeAws_restJson1EgressAccessLogs ( input . EgressAccessLogs , context ) , } ) , ... ( input . IngressAccessLogs !== undefined && input . IngressAccessLogs !== null && { ingressAccessLogs : serializeAws_restJson1IngressAccessLogs ( input . IngressAccessLogs , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateChannelCommand = 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 || "" }` + "/channels" ; let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { description : input . Description } ) , ... ( input . Id !== undefined && input . Id !== null && { id : input . Id } ) , ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateHarvestJobCommand = 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 || "" }` + "/harvest_jobs" ; let body ; body = JSON . stringify ( { ... ( input . EndTime !== undefined && input . EndTime !== null && { endTime : input . EndTime } ) , ... ( input . Id !== undefined && input . Id !== null && { id : input . Id } ) , ... ( input . OriginEndpointId !== undefined && input . OriginEndpointId !== null && { originEndpointId : input . OriginEndpointId } ) , ... ( input . S3Destination !== undefined && input . S3Destination !== null && { s3Destination : serializeAws_restJson1S3Destination ( input . S3Destination , context ) , } ) , ... ( input . StartTime !== undefined && input . StartTime !== null && { startTime : input . StartTime } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateOriginEndpointCommand = 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 || "" }` + "/origin_endpoints" ; let body ; body = JSON . stringify ( { ... ( input . Authorization !== undefined && input . Authorization !== null && { authorization : serializeAws_restJson1Authorization ( input . Authorization , context ) , } ) , ... ( input . ChannelId !== undefined && input . ChannelId !== null && { channelId : input . ChannelId } ) , ... ( input . CmafPackage !== undefined && input . CmafPackage !== null && { cmafPackage : serializeAws_restJson1CmafPackageCreateOrUpdateParameters ( input . CmafPackage , context ) , } ) , ... ( input . DashPackage !== undefined && input . DashPackage !== null && { dashPackage : serializeAws_restJson1DashPackage ( input . DashPackage , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { description : input . Description } ) , ... ( input . HlsPackage !== undefined && input . HlsPackage !== null && { hlsPackage : serializeAws_restJson1HlsPackage ( input . HlsPackage , context ) } ) , ... ( input . Id !== undefined && input . Id !== null && { id : input . Id } ) , ... ( input . ManifestName !== undefined && input . ManifestName !== null && { manifestName : input . ManifestName } ) , ... ( input . MssPackage !== undefined && input . MssPackage !== null && { mssPackage : serializeAws_restJson1MssPackage ( input . MssPackage , context ) } ) , ... ( input . Origination !== undefined && input . Origination !== null && { origination : input . Origination } ) , ... ( input . StartoverWindowSeconds !== undefined && input . StartoverWindowSeconds !== null && { startoverWindowSeconds : input . StartoverWindowSeconds } ) , ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1Tags ( input . Tags , context ) } ) , ... ( input . TimeDelaySeconds !== undefined && input . TimeDelaySeconds !== null && { timeDelaySeconds : input . TimeDelaySeconds } ) , ... ( input . Whitelist !== undefined && input . Whitelist !== null && { whitelist : serializeAws_restJson1__listOf__string ( input . Whitelist , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteChannelCommand = 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 || "" }` + "/channels/{Id}" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteOriginEndpointCommand = 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 || "" }` + "/origin_endpoints/{Id}" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeChannelCommand = 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 || "" }` + "/channels/{Id}" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeHarvestJobCommand = 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 || "" }` + "/harvest_jobs/{Id}" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeOriginEndpointCommand = 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 || "" }` + "/origin_endpoints/{Id}" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListChannelsCommand = 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 || "" }` + "/channels" ; const query = { ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListHarvestJobsCommand = 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 || "" }` + "/harvest_jobs" ; const query = { ... ( input . IncludeChannelId !== undefined && { includeChannelId : input . IncludeChannelId } ) , ... ( input . IncludeStatus !== undefined && { includeStatus : input . IncludeStatus } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListOriginEndpointsCommand = 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 || "" }` + "/origin_endpoints" ; const query = { ... ( input . ChannelId !== undefined && { channelId : input . ChannelId } ) , ... ( input . MaxResults !== undefined && { maxResults : input . MaxResults . toString ( ) } ) , ... ( input . NextToken !== undefined && { nextToken : input . NextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1RotateChannelCredentialsCommand = 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 || "" }` + "/channels/{Id}/credentials" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1RotateIngestEndpointCredentialsCommand = 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 || "" }` + "/channels/{Id}/ingest_endpoints/{IngestEndpointId}/credentials" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } if ( input . IngestEndpointId !== undefined ) { const labelValue = input . IngestEndpointId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IngestEndpointId." ) ; } resolvedPath = resolvedPath . replace ( "{IngestEndpointId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IngestEndpointId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{ResourceArn}" ; if ( input . ResourceArn !== undefined ) { const labelValue = input . ResourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ResourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{ResourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . Tags !== undefined && input . Tags !== null && { tags : serializeAws_restJson1__mapOf__string ( 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}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ResourceArn." ) ; } const query = { ... ( input . TagKeys !== undefined && { tagKeys : ( input . TagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateChannelCommand = 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 || "" }` + "/channels/{Id}" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { description : input . Description } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateOriginEndpointCommand = 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 || "" }` + "/origin_endpoints/{Id}" ; if ( input . Id !== undefined ) { const labelValue = input . Id ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Id." ) ; } resolvedPath = resolvedPath . replace ( "{Id}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Id." ) ; } let body ; body = JSON . stringify ( { ... ( input . Authorization !== undefined && input . Authorization !== null && { authorization : serializeAws_restJson1Authorization ( input . Authorization , context ) , } ) , ... ( input . CmafPackage !== undefined && input . CmafPackage !== null && { cmafPackage : serializeAws_restJson1CmafPackageCreateOrUpdateParameters ( input . CmafPackage , context ) , } ) , ... ( input . DashPackage !== undefined && input . DashPackage !== null && { dashPackage : serializeAws_restJson1DashPackage ( input . DashPackage , context ) } ) , ... ( input . Description !== undefined && input . Description !== null && { description : input . Description } ) , ... ( input . HlsPackage !== undefined && input . HlsPackage !== null && { hlsPackage : serializeAws_restJson1HlsPackage ( input . HlsPackage , context ) } ) , ... ( input . ManifestName !== undefined && input . ManifestName !== null && { manifestName : input . ManifestName } ) , ... ( input . MssPackage !== undefined && input . MssPackage !== null && { mssPackage : serializeAws_restJson1MssPackage ( input . MssPackage , context ) } ) , ... ( input . Origination !== undefined && input . Origination !== null && { origination : input . Origination } ) , ... ( input . StartoverWindowSeconds !== undefined && input . StartoverWindowSeconds !== null && { startoverWindowSeconds : input . StartoverWindowSeconds } ) , ... ( input . TimeDelaySeconds !== undefined && input . TimeDelaySeconds !== null && { timeDelaySeconds : input . TimeDelaySeconds } ) , ... ( input . Whitelist !== undefined && input . Whitelist !== null && { whitelist : serializeAws_restJson1__listOf__string ( input . Whitelist , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1ConfigureLogsCommand = async ( output , context ) : Promise < ConfigureLogsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ConfigureLogsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Description : undefined , EgressAccessLogs : undefined , HlsIngest : undefined , Id : undefined , IngressAccessLogs : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . egressAccessLogs !== undefined && data . egressAccessLogs !== null ) { contents . EgressAccessLogs = deserializeAws_restJson1EgressAccessLogs ( data . egressAccessLogs , context ) ; } if ( data . hlsIngest !== undefined && data . hlsIngest !== null ) { contents . HlsIngest = deserializeAws_restJson1HlsIngest ( data . hlsIngest , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . ingressAccessLogs !== undefined && data . ingressAccessLogs !== null ) { contents . IngressAccessLogs = deserializeAws_restJson1IngressAccessLogs ( data . ingressAccessLogs , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ConfigureLogsCommandError = async ( output , context ) : Promise < ConfigureLogsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1CreateChannelCommand = async ( output , context ) : Promise < CreateChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Description : undefined , EgressAccessLogs : undefined , HlsIngest : undefined , Id : undefined , IngressAccessLogs : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . egressAccessLogs !== undefined && data . egressAccessLogs !== null ) { contents . EgressAccessLogs = deserializeAws_restJson1EgressAccessLogs ( data . egressAccessLogs , context ) ; } if ( data . hlsIngest !== undefined && data . hlsIngest !== null ) { contents . HlsIngest = deserializeAws_restJson1HlsIngest ( data . hlsIngest , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . ingressAccessLogs !== undefined && data . ingressAccessLogs !== null ) { contents . IngressAccessLogs = deserializeAws_restJson1IngressAccessLogs ( data . ingressAccessLogs , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateChannelCommandError = async ( output , context ) : Promise < CreateChannelCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1CreateHarvestJobCommand = async ( output , context ) : Promise < CreateHarvestJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateHarvestJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , ChannelId : undefined , CreatedAt : undefined , EndTime : undefined , Id : undefined , OriginEndpointId : undefined , S3Destination : undefined , StartTime : undefined , Status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . channelId !== undefined && data . channelId !== null ) { contents . ChannelId = __expectString ( data . channelId ) ; } if ( data . createdAt !== undefined && data . createdAt !== null ) { contents . CreatedAt = __expectString ( data . createdAt ) ; } if ( data . endTime !== undefined && data . endTime !== null ) { contents . EndTime = __expectString ( data . endTime ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . originEndpointId !== undefined && data . originEndpointId !== null ) { contents . OriginEndpointId = __expectString ( data . originEndpointId ) ; } if ( data . s3Destination !== undefined && data . s3Destination !== null ) { contents . S3Destination = deserializeAws_restJson1S3Destination ( data . s3Destination , context ) ; } if ( data . startTime !== undefined && data . startTime !== null ) { contents . StartTime = __expectString ( data . startTime ) ; } if ( data . status !== undefined && data . status !== null ) { contents . Status = __expectString ( data . status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateHarvestJobCommandError = async ( output , context ) : Promise < CreateHarvestJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1CreateOriginEndpointCommand = async ( output , context ) : Promise < CreateOriginEndpointCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateOriginEndpointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Authorization : undefined , ChannelId : undefined , CmafPackage : undefined , DashPackage : undefined , Description : undefined , HlsPackage : undefined , Id : undefined , ManifestName : undefined , MssPackage : undefined , Origination : undefined , StartoverWindowSeconds : undefined , Tags : undefined , TimeDelaySeconds : undefined , Url : undefined , Whitelist : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . authorization !== undefined && data . authorization !== null ) { contents . Authorization = deserializeAws_restJson1Authorization ( data . authorization , context ) ; } if ( data . channelId !== undefined && data . channelId !== null ) { contents . ChannelId = __expectString ( data . channelId ) ; } if ( data . cmafPackage !== undefined && data . cmafPackage !== null ) { contents . CmafPackage = deserializeAws_restJson1CmafPackage ( data . cmafPackage , context ) ; } if ( data . dashPackage !== undefined && data . dashPackage !== null ) { contents . DashPackage = deserializeAws_restJson1DashPackage ( data . dashPackage , context ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . hlsPackage !== undefined && data . hlsPackage !== null ) { contents . HlsPackage = deserializeAws_restJson1HlsPackage ( data . hlsPackage , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . manifestName !== undefined && data . manifestName !== null ) { contents . ManifestName = __expectString ( data . manifestName ) ; } if ( data . mssPackage !== undefined && data . mssPackage !== null ) { contents . MssPackage = deserializeAws_restJson1MssPackage ( data . mssPackage , context ) ; } if ( data . origination !== undefined && data . origination !== null ) { contents . Origination = __expectString ( data . origination ) ; } if ( data . startoverWindowSeconds !== undefined && data . startoverWindowSeconds !== null ) { contents . StartoverWindowSeconds = __expectInt32 ( data . startoverWindowSeconds ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } if ( data . timeDelaySeconds !== undefined && data . timeDelaySeconds !== null ) { contents . TimeDelaySeconds = __expectInt32 ( data . timeDelaySeconds ) ; } if ( data . url !== undefined && data . url !== null ) { contents . Url = __expectString ( data . url ) ; } if ( data . whitelist !== undefined && data . whitelist !== null ) { contents . Whitelist = deserializeAws_restJson1__listOf__string ( data . whitelist , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateOriginEndpointCommandError = async ( output , context ) : Promise < CreateOriginEndpointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1DeleteChannelCommand = async ( output , context ) : Promise < DeleteChannelCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteChannelCommandError = async ( output , context ) : Promise < DeleteChannelCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1DeleteOriginEndpointCommand = async ( output , context ) : Promise < DeleteOriginEndpointCommandOutput > => { if ( output . statusCode !== 202 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteOriginEndpointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteOriginEndpointCommandError = async ( output , context ) : Promise < DeleteOriginEndpointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1DescribeChannelCommand = async ( output , context ) : Promise < DescribeChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Description : undefined , EgressAccessLogs : undefined , HlsIngest : undefined , Id : undefined , IngressAccessLogs : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . egressAccessLogs !== undefined && data . egressAccessLogs !== null ) { contents . EgressAccessLogs = deserializeAws_restJson1EgressAccessLogs ( data . egressAccessLogs , context ) ; } if ( data . hlsIngest !== undefined && data . hlsIngest !== null ) { contents . HlsIngest = deserializeAws_restJson1HlsIngest ( data . hlsIngest , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . ingressAccessLogs !== undefined && data . ingressAccessLogs !== null ) { contents . IngressAccessLogs = deserializeAws_restJson1IngressAccessLogs ( data . ingressAccessLogs , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeChannelCommandError = async ( output , context ) : Promise < DescribeChannelCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1DescribeHarvestJobCommand = async ( output , context ) : Promise < DescribeHarvestJobCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeHarvestJobCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , ChannelId : undefined , CreatedAt : undefined , EndTime : undefined , Id : undefined , OriginEndpointId : undefined , S3Destination : undefined , StartTime : undefined , Status : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . channelId !== undefined && data . channelId !== null ) { contents . ChannelId = __expectString ( data . channelId ) ; } if ( data . createdAt !== undefined && data . createdAt !== null ) { contents . CreatedAt = __expectString ( data . createdAt ) ; } if ( data . endTime !== undefined && data . endTime !== null ) { contents . EndTime = __expectString ( data . endTime ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . originEndpointId !== undefined && data . originEndpointId !== null ) { contents . OriginEndpointId = __expectString ( data . originEndpointId ) ; } if ( data . s3Destination !== undefined && data . s3Destination !== null ) { contents . S3Destination = deserializeAws_restJson1S3Destination ( data . s3Destination , context ) ; } if ( data . startTime !== undefined && data . startTime !== null ) { contents . StartTime = __expectString ( data . startTime ) ; } if ( data . status !== undefined && data . status !== null ) { contents . Status = __expectString ( data . status ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeHarvestJobCommandError = async ( output , context ) : Promise < DescribeHarvestJobCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1DescribeOriginEndpointCommand = async ( output , context ) : Promise < DescribeOriginEndpointCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeOriginEndpointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Authorization : undefined , ChannelId : undefined , CmafPackage : undefined , DashPackage : undefined , Description : undefined , HlsPackage : undefined , Id : undefined , ManifestName : undefined , MssPackage : undefined , Origination : undefined , StartoverWindowSeconds : undefined , Tags : undefined , TimeDelaySeconds : undefined , Url : undefined , Whitelist : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . authorization !== undefined && data . authorization !== null ) { contents . Authorization = deserializeAws_restJson1Authorization ( data . authorization , context ) ; } if ( data . channelId !== undefined && data . channelId !== null ) { contents . ChannelId = __expectString ( data . channelId ) ; } if ( data . cmafPackage !== undefined && data . cmafPackage !== null ) { contents . CmafPackage = deserializeAws_restJson1CmafPackage ( data . cmafPackage , context ) ; } if ( data . dashPackage !== undefined && data . dashPackage !== null ) { contents . DashPackage = deserializeAws_restJson1DashPackage ( data . dashPackage , context ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . hlsPackage !== undefined && data . hlsPackage !== null ) { contents . HlsPackage = deserializeAws_restJson1HlsPackage ( data . hlsPackage , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . manifestName !== undefined && data . manifestName !== null ) { contents . ManifestName = __expectString ( data . manifestName ) ; } if ( data . mssPackage !== undefined && data . mssPackage !== null ) { contents . MssPackage = deserializeAws_restJson1MssPackage ( data . mssPackage , context ) ; } if ( data . origination !== undefined && data . origination !== null ) { contents . Origination = __expectString ( data . origination ) ; } if ( data . startoverWindowSeconds !== undefined && data . startoverWindowSeconds !== null ) { contents . StartoverWindowSeconds = __expectInt32 ( data . startoverWindowSeconds ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } if ( data . timeDelaySeconds !== undefined && data . timeDelaySeconds !== null ) { contents . TimeDelaySeconds = __expectInt32 ( data . timeDelaySeconds ) ; } if ( data . url !== undefined && data . url !== null ) { contents . Url = __expectString ( data . url ) ; } if ( data . whitelist !== undefined && data . whitelist !== null ) { contents . Whitelist = deserializeAws_restJson1__listOf__string ( data . whitelist , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeOriginEndpointCommandError = async ( output , context ) : Promise < DescribeOriginEndpointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1ListChannelsCommand = async ( output , context ) : Promise < ListChannelsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListChannelsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Channels : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . channels !== undefined && data . channels !== null ) { contents . Channels = deserializeAws_restJson1__listOfChannel ( data . channels , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListChannelsCommandError = async ( output , context ) : Promise < ListChannelsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1ListHarvestJobsCommand = async ( output , context ) : Promise < ListHarvestJobsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListHarvestJobsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , HarvestJobs : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . harvestJobs !== undefined && data . harvestJobs !== null ) { contents . HarvestJobs = deserializeAws_restJson1__listOfHarvestJob ( data . harvestJobs , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . NextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListHarvestJobsCommandError = async ( output , context ) : Promise < ListHarvestJobsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1ListOriginEndpointsCommand = async ( output , context ) : Promise < ListOriginEndpointsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListOriginEndpointsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , NextToken : undefined , OriginEndpoints : 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 . originEndpoints !== undefined && data . originEndpoints !== null ) { contents . OriginEndpoints = deserializeAws_restJson1__listOfOriginEndpoint ( data . originEndpoints , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListOriginEndpointsCommandError = async ( output , context ) : Promise < ListOriginEndpointsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1__mapOf__string ( 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 ) { 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_restJson1RotateChannelCredentialsCommand = async ( output , context ) : Promise < RotateChannelCredentialsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1RotateChannelCredentialsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Description : undefined , EgressAccessLogs : undefined , HlsIngest : undefined , Id : undefined , IngressAccessLogs : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . egressAccessLogs !== undefined && data . egressAccessLogs !== null ) { contents . EgressAccessLogs = deserializeAws_restJson1EgressAccessLogs ( data . egressAccessLogs , context ) ; } if ( data . hlsIngest !== undefined && data . hlsIngest !== null ) { contents . HlsIngest = deserializeAws_restJson1HlsIngest ( data . hlsIngest , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . ingressAccessLogs !== undefined && data . ingressAccessLogs !== null ) { contents . IngressAccessLogs = deserializeAws_restJson1IngressAccessLogs ( data . ingressAccessLogs , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1RotateChannelCredentialsCommandError = async ( output , context ) : Promise < RotateChannelCredentialsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1RotateIngestEndpointCredentialsCommand = async ( output , context ) : Promise < RotateIngestEndpointCredentialsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1RotateIngestEndpointCredentialsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Description : undefined , EgressAccessLogs : undefined , HlsIngest : undefined , Id : undefined , IngressAccessLogs : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . egressAccessLogs !== undefined && data . egressAccessLogs !== null ) { contents . EgressAccessLogs = deserializeAws_restJson1EgressAccessLogs ( data . egressAccessLogs , context ) ; } if ( data . hlsIngest !== undefined && data . hlsIngest !== null ) { contents . HlsIngest = deserializeAws_restJson1HlsIngest ( data . hlsIngest , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . ingressAccessLogs !== undefined && data . ingressAccessLogs !== null ) { contents . IngressAccessLogs = deserializeAws_restJson1IngressAccessLogs ( data . ingressAccessLogs , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1RotateIngestEndpointCredentialsCommandError = async ( output , context ) : Promise < RotateIngestEndpointCredentialsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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 !== 204 && 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 ) { 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 !== 204 && 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 ) { 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_restJson1UpdateChannelCommand = async ( output , context ) : Promise < UpdateChannelCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateChannelCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Description : undefined , EgressAccessLogs : undefined , HlsIngest : undefined , Id : undefined , IngressAccessLogs : undefined , Tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . egressAccessLogs !== undefined && data . egressAccessLogs !== null ) { contents . EgressAccessLogs = deserializeAws_restJson1EgressAccessLogs ( data . egressAccessLogs , context ) ; } if ( data . hlsIngest !== undefined && data . hlsIngest !== null ) { contents . HlsIngest = deserializeAws_restJson1HlsIngest ( data . hlsIngest , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . ingressAccessLogs !== undefined && data . ingressAccessLogs !== null ) { contents . IngressAccessLogs = deserializeAws_restJson1IngressAccessLogs ( data . ingressAccessLogs , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateChannelCommandError = async ( output , context ) : Promise < UpdateChannelCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1UpdateOriginEndpointCommand = async ( output , context ) : Promise < UpdateOriginEndpointCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateOriginEndpointCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Arn : undefined , Authorization : undefined , ChannelId : undefined , CmafPackage : undefined , DashPackage : undefined , Description : undefined , HlsPackage : undefined , Id : undefined , ManifestName : undefined , MssPackage : undefined , Origination : undefined , StartoverWindowSeconds : undefined , Tags : undefined , TimeDelaySeconds : undefined , Url : undefined , Whitelist : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . arn !== undefined && data . arn !== null ) { contents . Arn = __expectString ( data . arn ) ; } if ( data . authorization !== undefined && data . authorization !== null ) { contents . Authorization = deserializeAws_restJson1Authorization ( data . authorization , context ) ; } if ( data . channelId !== undefined && data . channelId !== null ) { contents . ChannelId = __expectString ( data . channelId ) ; } if ( data . cmafPackage !== undefined && data . cmafPackage !== null ) { contents . CmafPackage = deserializeAws_restJson1CmafPackage ( data . cmafPackage , context ) ; } if ( data . dashPackage !== undefined && data . dashPackage !== null ) { contents . DashPackage = deserializeAws_restJson1DashPackage ( data . dashPackage , context ) ; } if ( data . description !== undefined && data . description !== null ) { contents . Description = __expectString ( data . description ) ; } if ( data . hlsPackage !== undefined && data . hlsPackage !== null ) { contents . HlsPackage = deserializeAws_restJson1HlsPackage ( data . hlsPackage , context ) ; } if ( data . id !== undefined && data . id !== null ) { contents . Id = __expectString ( data . id ) ; } if ( data . manifestName !== undefined && data . manifestName !== null ) { contents . ManifestName = __expectString ( data . manifestName ) ; } if ( data . mssPackage !== undefined && data . mssPackage !== null ) { contents . MssPackage = deserializeAws_restJson1MssPackage ( data . mssPackage , context ) ; } if ( data . origination !== undefined && data . origination !== null ) { contents . Origination = __expectString ( data . origination ) ; } if ( data . startoverWindowSeconds !== undefined && data . startoverWindowSeconds !== null ) { contents . StartoverWindowSeconds = __expectInt32 ( data . startoverWindowSeconds ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . Tags = deserializeAws_restJson1Tags ( data . tags , context ) ; } if ( data . timeDelaySeconds !== undefined && data . timeDelaySeconds !== null ) { contents . TimeDelaySeconds = __expectInt32 ( data . timeDelaySeconds ) ; } if ( data . url !== undefined && data . url !== null ) { contents . Url = __expectString ( data . url ) ; } if ( data . whitelist !== undefined && data . whitelist !== null ) { contents . Whitelist = deserializeAws_restJson1__listOf__string ( data . whitelist , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateOriginEndpointCommandError = async ( output , context ) : Promise < UpdateOriginEndpointCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "ForbiddenException" : case "com.amazonaws.mediapackage#ForbiddenException" : response = { ... ( await deserializeAws_restJson1ForbiddenExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerErrorException" : case "com.amazonaws.mediapackage#InternalServerErrorException" : response = { ... ( await deserializeAws_restJson1InternalServerErrorExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "NotFoundException" : case "com.amazonaws.mediapackage#NotFoundException" : response = { ... ( await deserializeAws_restJson1NotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceUnavailableException" : case "com.amazonaws.mediapackage#ServiceUnavailableException" : response = { ... ( await deserializeAws_restJson1ServiceUnavailableExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.mediapackage#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "UnprocessableEntityException" : case "com.amazonaws.mediapackage#UnprocessableEntityException" : response = { ... ( await deserializeAws_restJson1UnprocessableEntityExceptionResponse ( 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_restJson1ForbiddenExceptionResponse = async ( parsedOutput , context ) : Promise < ForbiddenException > => { const contents = { name : "ForbiddenException" , $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_restJson1InternalServerErrorExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerErrorException > => { const contents = { name : "InternalServerErrorException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1NotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < NotFoundException > => { const contents = { name : "NotFoundException" , $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_restJson1ServiceUnavailableExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceUnavailableException > => { const contents = { name : "ServiceUnavailableException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1TooManyRequestsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyRequestsException > => { const contents = { name : "TooManyRequestsException" , $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_restJson1UnprocessableEntityExceptionResponse = async ( parsedOutput , context ) : Promise < UnprocessableEntityException > => { const contents = { name : "UnprocessableEntityException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const serializeAws_restJson1__listOf__PeriodTriggersElement = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1__listOf__string = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1__listOfHlsManifestCreateOrUpdateParameters = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1HlsManifestCreateOrUpdateParameters ( entry , context ) ; } ) ; } ; const serializeAws_restJson1__mapOf__string = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1AdTriggers = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1Authorization = ( input , context ) : any => { return { ... ( input . CdnIdentifierSecret !== undefined && input . CdnIdentifierSecret !== null && { cdnIdentifierSecret : input . CdnIdentifierSecret } ) , ... ( input . SecretsRoleArn !== undefined && input . SecretsRoleArn !== null && { secretsRoleArn : input . SecretsRoleArn } ) , } ; } ; const serializeAws_restJson1CmafEncryption = ( input , context ) : any => { return { ... ( input . ConstantInitializationVector !== undefined && input . ConstantInitializationVector !== null && { constantInitializationVector : input . ConstantInitializationVector , } ) , ... ( input . KeyRotationIntervalSeconds !== undefined && input . KeyRotationIntervalSeconds !== null && { keyRotationIntervalSeconds : input . KeyRotationIntervalSeconds } ) , ... ( input . SpekeKeyProvider !== undefined && input . SpekeKeyProvider !== null && { spekeKeyProvider : serializeAws_restJson1SpekeKeyProvider ( input . SpekeKeyProvider , context ) , } ) , } ; } ; const serializeAws_restJson1CmafPackageCreateOrUpdateParameters = ( input , context ) : any => { return { ... ( input . Encryption !== undefined && input . Encryption !== null && { encryption : serializeAws_restJson1CmafEncryption ( input . Encryption , context ) } ) , ... ( input . HlsManifests !== undefined && input . HlsManifests !== null && { hlsManifests : serializeAws_restJson1__listOfHlsManifestCreateOrUpdateParameters ( input . HlsManifests , context ) , } ) , ... ( input . SegmentDurationSeconds !== undefined && input . SegmentDurationSeconds !== null && { segmentDurationSeconds : input . SegmentDurationSeconds } ) , ... ( input . SegmentPrefix !== undefined && input . SegmentPrefix !== null && { segmentPrefix : input . SegmentPrefix } ) , ... ( input . StreamSelection !== undefined && input . StreamSelection !== null && { streamSelection : serializeAws_restJson1StreamSelection ( input . StreamSelection , context ) , } ) , } ; } ; const serializeAws_restJson1DashEncryption = ( input , context ) : any => { return { ... ( input . KeyRotationIntervalSeconds !== undefined && input . KeyRotationIntervalSeconds !== null && { keyRotationIntervalSeconds : input . KeyRotationIntervalSeconds } ) , ... ( input . SpekeKeyProvider !== undefined && input . SpekeKeyProvider !== null && { spekeKeyProvider : serializeAws_restJson1SpekeKeyProvider ( input . SpekeKeyProvider , context ) , } ) , } ; } ; const serializeAws_restJson1DashPackage = ( input , context ) : any => { return { ... ( input . AdTriggers !== undefined && input . AdTriggers !== null && { adTriggers : serializeAws_restJson1AdTriggers ( input . AdTriggers , context ) } ) , ... ( input . AdsOnDeliveryRestrictions !== undefined && input . AdsOnDeliveryRestrictions !== null && { adsOnDeliveryRestrictions : input . AdsOnDeliveryRestrictions } ) , ... ( input . Encryption !== undefined && input . Encryption !== null && { encryption : serializeAws_restJson1DashEncryption ( input . Encryption , context ) } ) , ... ( input . ManifestLayout !== undefined && input . ManifestLayout !== null && { manifestLayout : input . ManifestLayout } ) , ... ( input . ManifestWindowSeconds !== undefined && input . ManifestWindowSeconds !== null && { manifestWindowSeconds : input . ManifestWindowSeconds } ) , ... ( input . MinBufferTimeSeconds !== undefined && input . MinBufferTimeSeconds !== null && { minBufferTimeSeconds : input . MinBufferTimeSeconds } ) , ... ( input . MinUpdatePeriodSeconds !== undefined && input . MinUpdatePeriodSeconds !== null && { minUpdatePeriodSeconds : input . MinUpdatePeriodSeconds } ) , ... ( input . PeriodTriggers !== undefined && input . PeriodTriggers !== null && { periodTriggers : serializeAws_restJson1__listOf__PeriodTriggersElement ( input . PeriodTriggers , context ) , } ) , ... ( input . Profile !== undefined && input . Profile !== null && { profile : input . Profile } ) , ... ( input . SegmentDurationSeconds !== undefined && input . SegmentDurationSeconds !== null && { segmentDurationSeconds : input . SegmentDurationSeconds } ) , ... ( input . SegmentTemplateFormat !== undefined && input . SegmentTemplateFormat !== null && { segmentTemplateFormat : input . SegmentTemplateFormat } ) , ... ( input . StreamSelection !== undefined && input . StreamSelection !== null && { streamSelection : serializeAws_restJson1StreamSelection ( input . StreamSelection , context ) , } ) , ... ( input . SuggestedPresentationDelaySeconds !== undefined && input . SuggestedPresentationDelaySeconds !== null && { suggestedPresentationDelaySeconds : input . SuggestedPresentationDelaySeconds , } ) , ... ( input . UtcTiming !== undefined && input . UtcTiming !== null && { utcTiming : input . UtcTiming } ) , ... ( input . UtcTimingUri !== undefined && input . UtcTimingUri !== null && { utcTimingUri : input . UtcTimingUri } ) , } ; } ; const serializeAws_restJson1EgressAccessLogs = ( input , context ) : any => { return { ... ( input . LogGroupName !== undefined && input . LogGroupName !== null && { logGroupName : input . LogGroupName } ) , } ; } ; const serializeAws_restJson1EncryptionContractConfiguration = ( input , context ) : any => { return { ... ( input . PresetSpeke20Audio !== undefined && input . PresetSpeke20Audio !== null && { presetSpeke20Audio : input . PresetSpeke20Audio } ) , ... ( input . PresetSpeke20Video !== undefined && input . PresetSpeke20Video !== null && { presetSpeke20Video : input . PresetSpeke20Video } ) , } ; } ; const serializeAws_restJson1HlsEncryption = ( input , context ) : any => { return { ... ( input . ConstantInitializationVector !== undefined && input . ConstantInitializationVector !== null && { constantInitializationVector : input . ConstantInitializationVector , } ) , ... ( input . EncryptionMethod !== undefined && input . EncryptionMethod !== null && { encryptionMethod : input . EncryptionMethod } ) , ... ( input . KeyRotationIntervalSeconds !== undefined && input . KeyRotationIntervalSeconds !== null && { keyRotationIntervalSeconds : input . KeyRotationIntervalSeconds } ) , ... ( input . RepeatExtXKey !== undefined && input . RepeatExtXKey !== null && { repeatExtXKey : input . RepeatExtXKey } ) , ... ( input . SpekeKeyProvider !== undefined && input . SpekeKeyProvider !== null && { spekeKeyProvider : serializeAws_restJson1SpekeKeyProvider ( input . SpekeKeyProvider , context ) , } ) , } ; } ; const serializeAws_restJson1HlsManifestCreateOrUpdateParameters = ( input , context ) : any => { return { ... ( input . AdMarkers !== undefined && input . AdMarkers !== null && { adMarkers : input . AdMarkers } ) , ... ( input . AdTriggers !== undefined && input . AdTriggers !== null && { adTriggers : serializeAws_restJson1AdTriggers ( input . AdTriggers , context ) } ) , ... ( input . AdsOnDeliveryRestrictions !== undefined && input . AdsOnDeliveryRestrictions !== null && { adsOnDeliveryRestrictions : input . AdsOnDeliveryRestrictions } ) , ... ( input . Id !== undefined && input . Id !== null && { id : input . Id } ) , ... ( input . IncludeIframeOnlyStream !== undefined && input . IncludeIframeOnlyStream !== null && { includeIframeOnlyStream : input . IncludeIframeOnlyStream } ) , ... ( input . ManifestName !== undefined && input . ManifestName !== null && { manifestName : input . ManifestName } ) , ... ( input . PlaylistType !== undefined && input . PlaylistType !== null && { playlistType : input . PlaylistType } ) , ... ( input . PlaylistWindowSeconds !== undefined && input . PlaylistWindowSeconds !== null && { playlistWindowSeconds : input . PlaylistWindowSeconds } ) , ... ( input . ProgramDateTimeIntervalSeconds !== undefined && input . ProgramDateTimeIntervalSeconds !== null && { programDateTimeIntervalSeconds : input . ProgramDateTimeIntervalSeconds , } ) , } ; } ; const serializeAws_restJson1HlsPackage = ( input , context ) : any => { return { ... ( input . AdMarkers !== undefined && input . AdMarkers !== null && { adMarkers : input . AdMarkers } ) , ... ( input . AdTriggers !== undefined && input . AdTriggers !== null && { adTriggers : serializeAws_restJson1AdTriggers ( input . AdTriggers , context ) } ) , ... ( input . AdsOnDeliveryRestrictions !== undefined && input . AdsOnDeliveryRestrictions !== null && { adsOnDeliveryRestrictions : input . AdsOnDeliveryRestrictions } ) , ... ( input . Encryption !== undefined && input . Encryption !== null && { encryption : serializeAws_restJson1HlsEncryption ( input . Encryption , context ) } ) , ... ( input . IncludeDvbSubtitles !== undefined && input . IncludeDvbSubtitles !== null && { includeDvbSubtitles : input . IncludeDvbSubtitles } ) , ... ( input . IncludeIframeOnlyStream !== undefined && input . IncludeIframeOnlyStream !== null && { includeIframeOnlyStream : input . IncludeIframeOnlyStream } ) , ... ( input . PlaylistType !== undefined && input . PlaylistType !== null && { playlistType : input . PlaylistType } ) , ... ( input . PlaylistWindowSeconds !== undefined && input . PlaylistWindowSeconds !== null && { playlistWindowSeconds : input . PlaylistWindowSeconds } ) , ... ( input . ProgramDateTimeIntervalSeconds !== undefined && input . ProgramDateTimeIntervalSeconds !== null && { programDateTimeIntervalSeconds : input . ProgramDateTimeIntervalSeconds , } ) , ... ( input . SegmentDurationSeconds !== undefined && input . SegmentDurationSeconds !== null && { segmentDurationSeconds : input . SegmentDurationSeconds } ) , ... ( input . StreamSelection !== undefined && input . StreamSelection !== null && { streamSelection : serializeAws_restJson1StreamSelection ( input . StreamSelection , context ) , } ) , ... ( input . UseAudioRenditionGroup !== undefined && input . UseAudioRenditionGroup !== null && { useAudioRenditionGroup : input . UseAudioRenditionGroup } ) , } ; } ; const serializeAws_restJson1IngressAccessLogs = ( input , context ) : any => { return { ... ( input . LogGroupName !== undefined && input . LogGroupName !== null && { logGroupName : input . LogGroupName } ) , } ; } ; const serializeAws_restJson1MssEncryption = ( input , context ) : any => { return { ... ( input . SpekeKeyProvider !== undefined && input . SpekeKeyProvider !== null && { spekeKeyProvider : serializeAws_restJson1SpekeKeyProvider ( input . SpekeKeyProvider , context ) , } ) , } ; } ; const serializeAws_restJson1MssPackage = ( input , context ) : any => { return { ... ( input . Encryption !== undefined && input . Encryption !== null && { encryption : serializeAws_restJson1MssEncryption ( input . Encryption , context ) } ) , ... ( input . ManifestWindowSeconds !== undefined && input . ManifestWindowSeconds !== null && { manifestWindowSeconds : input . ManifestWindowSeconds } ) , ... ( input . SegmentDurationSeconds !== undefined && input . SegmentDurationSeconds !== null && { segmentDurationSeconds : input . SegmentDurationSeconds } ) , ... ( input . StreamSelection !== undefined && input . StreamSelection !== null && { streamSelection : serializeAws_restJson1StreamSelection ( input . StreamSelection , context ) , } ) , } ; } ; const serializeAws_restJson1S3Destination = ( input , context ) : any => { return { ... ( input . BucketName !== undefined && input . BucketName !== null && { bucketName : input . BucketName } ) , ... ( input . ManifestKey !== undefined && input . ManifestKey !== null && { manifestKey : input . ManifestKey } ) , ... ( input . RoleArn !== undefined && input . RoleArn !== null && { roleArn : input . RoleArn } ) , } ; } ; const serializeAws_restJson1SpekeKeyProvider = ( input , context ) : any => { return { ... ( input . CertificateArn !== undefined && input . CertificateArn !== null && { certificateArn : input . CertificateArn } ) , ... ( input . EncryptionContractConfiguration !== undefined && input . EncryptionContractConfiguration !== null && { encryptionContractConfiguration : serializeAws_restJson1EncryptionContractConfiguration ( input . EncryptionContractConfiguration , context ) , } ) , ... ( input . ResourceId !== undefined && input . ResourceId !== null && { resourceId : input . ResourceId } ) , ... ( input . RoleArn !== undefined && input . RoleArn !== null && { roleArn : input . RoleArn } ) , ... ( input . SystemIds !== undefined && input . SystemIds !== null && { systemIds : serializeAws_restJson1__listOf__string ( input . SystemIds , context ) } ) , ... ( input . Url !== undefined && input . Url !== null && { url : input . Url } ) , } ; } ; const serializeAws_restJson1StreamSelection = ( input , context ) : any => { return { ... ( input . MaxVideoBitsPerSecond !== undefined && input . MaxVideoBitsPerSecond !== null && { maxVideoBitsPerSecond : input . MaxVideoBitsPerSecond } ) , ... ( input . MinVideoBitsPerSecond !== undefined && input . MinVideoBitsPerSecond !== null && { minVideoBitsPerSecond : input . MinVideoBitsPerSecond } ) , ... ( input . StreamOrder !== undefined && input . StreamOrder !== null && { streamOrder : input . StreamOrder } ) , } ; } ; const serializeAws_restJson1Tags = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const deserializeAws_restJson1__listOf__PeriodTriggersElement = ( output , context ) : ( __PeriodTriggersElement | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1__listOf__string = ( 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_restJson1__listOfChannel = ( output , context ) : Channel [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Channel ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfHarvestJob = ( output , context ) : HarvestJob [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1HarvestJob ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfHlsManifest = ( output , context ) : HlsManifest [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1HlsManifest ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfIngestEndpoint = ( output , context ) : IngestEndpoint [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1IngestEndpoint ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__listOfOriginEndpoint = ( output , context ) : OriginEndpoint [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1OriginEndpoint ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1__mapOf__string = ( 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_restJson1AdTriggers = ( output , context ) : ( __AdTriggersElement | string ) [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __expectString ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1Authorization = ( output , context ) : Authorization => { return { CdnIdentifierSecret : __expectString ( output . cdnIdentifierSecret ) , SecretsRoleArn : __expectString ( output . secretsRoleArn ) , } as any ; } ; const deserializeAws_restJson1Channel = ( output , context ) : Channel => { return { Arn : __expectString ( output . arn ) , Description : __expectString ( output . description ) , EgressAccessLogs : output . egressAccessLogs !== undefined && output . egressAccessLogs !== null ? deserializeAws_restJson1EgressAccessLogs ( output . egressAccessLogs , context ) : undefined , HlsIngest : output . hlsIngest !== undefined && output . hlsIngest !== null ? deserializeAws_restJson1HlsIngest ( output . hlsIngest , context ) : undefined , Id : __expectString ( output . id ) , IngressAccessLogs : output . ingressAccessLogs !== undefined && output . ingressAccessLogs !== null ? deserializeAws_restJson1IngressAccessLogs ( output . ingressAccessLogs , context ) : undefined , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CmafEncryption = ( output , context ) : CmafEncryption => { return { ConstantInitializationVector : __expectString ( output . constantInitializationVector ) , KeyRotationIntervalSeconds : __expectInt32 ( output . keyRotationIntervalSeconds ) , SpekeKeyProvider : output . spekeKeyProvider !== undefined && output . spekeKeyProvider !== null ? deserializeAws_restJson1SpekeKeyProvider ( output . spekeKeyProvider , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CmafPackage = ( output , context ) : CmafPackage => { return { Encryption : output . encryption !== undefined && output . encryption !== null ? deserializeAws_restJson1CmafEncryption ( output . encryption , context ) : undefined , HlsManifests : output . hlsManifests !== undefined && output . hlsManifests !== null ? deserializeAws_restJson1__listOfHlsManifest ( output . hlsManifests , context ) : undefined , SegmentDurationSeconds : __expectInt32 ( output . segmentDurationSeconds ) , SegmentPrefix : __expectString ( output . segmentPrefix ) , StreamSelection : output . streamSelection !== undefined && output . streamSelection !== null ? deserializeAws_restJson1StreamSelection ( output . streamSelection , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DashEncryption = ( output , context ) : DashEncryption => { return { KeyRotationIntervalSeconds : __expectInt32 ( output . keyRotationIntervalSeconds ) , SpekeKeyProvider : output . spekeKeyProvider !== undefined && output . spekeKeyProvider !== null ? deserializeAws_restJson1SpekeKeyProvider ( output . spekeKeyProvider , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DashPackage = ( output , context ) : DashPackage => { return { AdTriggers : output . adTriggers !== undefined && output . adTriggers !== null ? deserializeAws_restJson1AdTriggers ( output . adTriggers , context ) : undefined , AdsOnDeliveryRestrictions : __expectString ( output . adsOnDeliveryRestrictions ) , Encryption : output . encryption !== undefined && output . encryption !== null ? deserializeAws_restJson1DashEncryption ( output . encryption , context ) : undefined , ManifestLayout : __expectString ( output . manifestLayout ) , ManifestWindowSeconds : __expectInt32 ( output . manifestWindowSeconds ) , MinBufferTimeSeconds : __expectInt32 ( output . minBufferTimeSeconds ) , MinUpdatePeriodSeconds : __expectInt32 ( output . minUpdatePeriodSeconds ) , PeriodTriggers : output . periodTriggers !== undefined && output . periodTriggers !== null ? deserializeAws_restJson1__listOf__PeriodTriggersElement ( output . periodTriggers , context ) : undefined , Profile : __expectString ( output . profile ) , SegmentDurationSeconds : __expectInt32 ( output . segmentDurationSeconds ) , SegmentTemplateFormat : __expectString ( output . segmentTemplateFormat ) , StreamSelection : output . streamSelection !== undefined && output . streamSelection !== null ? deserializeAws_restJson1StreamSelection ( output . streamSelection , context ) : undefined , SuggestedPresentationDelaySeconds : __expectInt32 ( output . suggestedPresentationDelaySeconds ) , UtcTiming : __expectString ( output . utcTiming ) , UtcTimingUri : __expectString ( output . utcTimingUri ) , } as any ; } ; const deserializeAws_restJson1EgressAccessLogs = ( output , context ) : EgressAccessLogs => { return { LogGroupName : __expectString ( output . logGroupName ) , } as any ; } ; const deserializeAws_restJson1EncryptionContractConfiguration = ( output , context ) : EncryptionContractConfiguration => { return { PresetSpeke20Audio : __expectString ( output . presetSpeke20Audio ) , PresetSpeke20Video : __expectString ( output . presetSpeke20Video ) , } as any ; } ; const deserializeAws_restJson1HarvestJob = ( output , context ) : HarvestJob => { return { Arn : __expectString ( output . arn ) , ChannelId : __expectString ( output . channelId ) , CreatedAt : __expectString ( output . createdAt ) , EndTime : __expectString ( output . endTime ) , Id : __expectString ( output . id ) , OriginEndpointId : __expectString ( output . originEndpointId ) , S3Destination : output . s3Destination !== undefined && output . s3Destination !== null ? deserializeAws_restJson1S3Destination ( output . s3Destination , context ) : undefined , StartTime : __expectString ( output . startTime ) , Status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1HlsEncryption = ( output , context ) : HlsEncryption => { return { ConstantInitializationVector : __expectString ( output . constantInitializationVector ) , EncryptionMethod : __expectString ( output . encryptionMethod ) , KeyRotationIntervalSeconds : __expectInt32 ( output . keyRotationIntervalSeconds ) , RepeatExtXKey : __expectBoolean ( output . repeatExtXKey ) , SpekeKeyProvider : output . spekeKeyProvider !== undefined && output . spekeKeyProvider !== null ? deserializeAws_restJson1SpekeKeyProvider ( output . spekeKeyProvider , context ) : undefined , } as any ; } ; const deserializeAws_restJson1HlsIngest = ( output , context ) : HlsIngest => { return { IngestEndpoints : output . ingestEndpoints !== undefined && output . ingestEndpoints !== null ? deserializeAws_restJson1__listOfIngestEndpoint ( output . ingestEndpoints , context ) : undefined , } as any ; } ; const deserializeAws_restJson1HlsManifest = ( output , context ) : HlsManifest => { return { AdMarkers : __expectString ( output . adMarkers ) , Id : __expectString ( output . id ) , IncludeIframeOnlyStream : __expectBoolean ( output . includeIframeOnlyStream ) , ManifestName : __expectString ( output . manifestName ) , PlaylistType : __expectString ( output . playlistType ) , PlaylistWindowSeconds : __expectInt32 ( output . playlistWindowSeconds ) , ProgramDateTimeIntervalSeconds : __expectInt32 ( output . programDateTimeIntervalSeconds ) , Url : __expectString ( output . url ) , } as any ; } ; const deserializeAws_restJson1HlsPackage = ( output , context ) : HlsPackage => { return { AdMarkers : __expectString ( output . adMarkers ) , AdTriggers : output . adTriggers !== undefined && output . adTriggers !== null ? deserializeAws_restJson1AdTriggers ( output . adTriggers , context ) : undefined , AdsOnDeliveryRestrictions : __expectString ( output . adsOnDeliveryRestrictions ) , Encryption : output . encryption !== undefined && output . encryption !== null ? deserializeAws_restJson1HlsEncryption ( output . encryption , context ) : undefined , IncludeDvbSubtitles : __expectBoolean ( output . includeDvbSubtitles ) , IncludeIframeOnlyStream : __expectBoolean ( output . includeIframeOnlyStream ) , PlaylistType : __expectString ( output . playlistType ) , PlaylistWindowSeconds : __expectInt32 ( output . playlistWindowSeconds ) , ProgramDateTimeIntervalSeconds : __expectInt32 ( output . programDateTimeIntervalSeconds ) , SegmentDurationSeconds : __expectInt32 ( output . segmentDurationSeconds ) , StreamSelection : output . streamSelection !== undefined && output . streamSelection !== null ? deserializeAws_restJson1StreamSelection ( output . streamSelection , context ) : undefined , UseAudioRenditionGroup : __expectBoolean ( output . useAudioRenditionGroup ) , } as any ; } ; const deserializeAws_restJson1IngestEndpoint = ( output , context ) : IngestEndpoint => { return { Id : __expectString ( output . id ) , Password : __expectString ( output . password ) , Url : __expectString ( output . url ) , Username : __expectString ( output . username ) , } as any ; } ; const deserializeAws_restJson1IngressAccessLogs = ( output , context ) : IngressAccessLogs => { return { LogGroupName : __expectString ( output . logGroupName ) , } as any ; } ; const deserializeAws_restJson1MssEncryption = ( output , context ) : MssEncryption => { return { SpekeKeyProvider : output . spekeKeyProvider !== undefined && output . spekeKeyProvider !== null ? deserializeAws_restJson1SpekeKeyProvider ( output . spekeKeyProvider , context ) : undefined , } as any ; } ; const deserializeAws_restJson1MssPackage = ( output , context ) : MssPackage => { return { Encryption : output . encryption !== undefined && output . encryption !== null ? deserializeAws_restJson1MssEncryption ( output . encryption , context ) : undefined , ManifestWindowSeconds : __expectInt32 ( output . manifestWindowSeconds ) , SegmentDurationSeconds : __expectInt32 ( output . segmentDurationSeconds ) , StreamSelection : output . streamSelection !== undefined && output . streamSelection !== null ? deserializeAws_restJson1StreamSelection ( output . streamSelection , context ) : undefined , } as any ; } ; const deserializeAws_restJson1OriginEndpoint = ( output , context ) : OriginEndpoint => { return { Arn : __expectString ( output . arn ) , Authorization : output . authorization !== undefined && output . authorization !== null ? deserializeAws_restJson1Authorization ( output . authorization , context ) : undefined , ChannelId : __expectString ( output . channelId ) , CmafPackage : output . cmafPackage !== undefined && output . cmafPackage !== null ? deserializeAws_restJson1CmafPackage ( output . cmafPackage , context ) : undefined , DashPackage : output . dashPackage !== undefined && output . dashPackage !== null ? deserializeAws_restJson1DashPackage ( output . dashPackage , context ) : undefined , Description : __expectString ( output . description ) , HlsPackage : output . hlsPackage !== undefined && output . hlsPackage !== null ? deserializeAws_restJson1HlsPackage ( output . hlsPackage , context ) : undefined , Id : __expectString ( output . id ) , ManifestName : __expectString ( output . manifestName ) , MssPackage : output . mssPackage !== undefined && output . mssPackage !== null ? deserializeAws_restJson1MssPackage ( output . mssPackage , context ) : undefined , Origination : __expectString ( output . origination ) , StartoverWindowSeconds : __expectInt32 ( output . startoverWindowSeconds ) , Tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1Tags ( output . tags , context ) : undefined , TimeDelaySeconds : __expectInt32 ( output . timeDelaySeconds ) , Url : __expectString ( output . url ) , Whitelist : output . whitelist !== undefined && output . whitelist !== null ? deserializeAws_restJson1__listOf__string ( output . whitelist , context ) : undefined , } as any ; } ; const deserializeAws_restJson1S3Destination = ( output , context ) : S3Destination => { return { BucketName : __expectString ( output . bucketName ) , ManifestKey : __expectString ( output . manifestKey ) , RoleArn : __expectString ( output . roleArn ) , } as any ; } ; const deserializeAws_restJson1SpekeKeyProvider = ( output , context ) : SpekeKeyProvider => { return { CertificateArn : __expectString ( output . certificateArn ) , EncryptionContractConfiguration : output . encryptionContractConfiguration !== undefined && output . encryptionContractConfiguration !== null ? deserializeAws_restJson1EncryptionContractConfiguration ( output . encryptionContractConfiguration , context ) : undefined , ResourceId : __expectString ( output . resourceId ) , RoleArn : __expectString ( output . roleArn ) , SystemIds : output . systemIds !== undefined && output . systemIds !== null ? deserializeAws_restJson1__listOf__string ( output . systemIds , context ) : undefined , Url : __expectString ( output . url ) , } as any ; } ; const deserializeAws_restJson1StreamSelection = ( output , context ) : StreamSelection => { return { MaxVideoBitsPerSecond : __expectInt32 ( output . maxVideoBitsPerSecond ) , MinVideoBitsPerSecond : __expectInt32 ( output . minVideoBitsPerSecond ) , StreamOrder : __expectString ( output . streamOrder ) , } as any ; } ; const deserializeAws_restJson1Tags = ( 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 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 "" ; } ;