UNPKG

cdk-amazon-chime-resources

Version:

![Experimental](https://img.shields.io/badge/experimental-important.svg?style=for-the-badge)

1,008 lines 138 kB
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http"; import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client"; import { v4 as generateIdempotencyToken } from "uuid"; import { ChimeSDKMediaPipelinesServiceException as __BaseException } from "../models/ChimeSDKMediaPipelinesServiceException"; import { BadRequestException, ConflictException, ForbiddenException, NotFoundException, ResourceLimitExceededException, ServiceFailureException, ServiceUnavailableException, ThrottledClientException, UnauthorizedClientException, } from "../models/models_0"; export const serializeAws_restJson1CreateMediaCapturePipelineCommand = async (input, context) => { 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 || ""}` + "/sdk-media-capture-pipelines"; let body; body = JSON.stringify({ ...(input.ChimeSdkMeetingConfiguration != null && { ChimeSdkMeetingConfiguration: serializeAws_restJson1ChimeSdkMeetingConfiguration(input.ChimeSdkMeetingConfiguration, context), }), ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), ...(input.SinkArn != null && { SinkArn: input.SinkArn }), ...(input.SinkType != null && { SinkType: input.SinkType }), ...(input.SourceArn != null && { SourceArn: input.SourceArn }), ...(input.SourceType != null && { SourceType: input.SourceType }), ...(input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); return new __HttpRequest({ protocol, hostname, port, method: "POST", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1CreateMediaConcatenationPipelineCommand = async (input, context) => { 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 || ""}` + "/sdk-media-concatenation-pipelines"; let body; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), ...(input.Sinks != null && { Sinks: serializeAws_restJson1ConcatenationSinkList(input.Sinks, context) }), ...(input.Sources != null && { Sources: serializeAws_restJson1ConcatenationSourceList(input.Sources, context) }), ...(input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); return new __HttpRequest({ protocol, hostname, port, method: "POST", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1CreateMediaInsightsPipelineCommand = async (input, context) => { 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 || ""}` + "/media-insights-pipelines"; let body; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), ...(input.KinesisVideoStreamRecordingSourceRuntimeConfiguration != null && { KinesisVideoStreamRecordingSourceRuntimeConfiguration: serializeAws_restJson1KinesisVideoStreamRecordingSourceRuntimeConfiguration(input.KinesisVideoStreamRecordingSourceRuntimeConfiguration, context), }), ...(input.KinesisVideoStreamSourceRuntimeConfiguration != null && { KinesisVideoStreamSourceRuntimeConfiguration: serializeAws_restJson1KinesisVideoStreamSourceRuntimeConfiguration(input.KinesisVideoStreamSourceRuntimeConfiguration, context), }), ...(input.MediaInsightsPipelineConfigurationArn != null && { MediaInsightsPipelineConfigurationArn: input.MediaInsightsPipelineConfigurationArn, }), ...(input.MediaInsightsRuntimeMetadata != null && { MediaInsightsRuntimeMetadata: serializeAws_restJson1MediaInsightsRuntimeMetadata(input.MediaInsightsRuntimeMetadata, context), }), ...(input.S3RecordingSinkRuntimeConfiguration != null && { S3RecordingSinkRuntimeConfiguration: serializeAws_restJson1S3RecordingSinkRuntimeConfiguration(input.S3RecordingSinkRuntimeConfiguration, context), }), ...(input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); return new __HttpRequest({ protocol, hostname, port, method: "POST", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1CreateMediaInsightsPipelineConfigurationCommand = async (input, context) => { 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 || ""}` + "/media-insights-pipeline-configurations"; let body; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), ...(input.Elements != null && { Elements: serializeAws_restJson1MediaInsightsPipelineConfigurationElements(input.Elements, context), }), ...(input.MediaInsightsPipelineConfigurationName != null && { MediaInsightsPipelineConfigurationName: input.MediaInsightsPipelineConfigurationName, }), ...(input.RealTimeAlertConfiguration != null && { RealTimeAlertConfiguration: serializeAws_restJson1RealTimeAlertConfiguration(input.RealTimeAlertConfiguration, context), }), ...(input.ResourceAccessRoleArn != null && { ResourceAccessRoleArn: input.ResourceAccessRoleArn }), ...(input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); return new __HttpRequest({ protocol, hostname, port, method: "POST", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1CreateMediaLiveConnectorPipelineCommand = async (input, context) => { 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 || ""}` + "/sdk-media-live-connector-pipelines"; let body; body = JSON.stringify({ ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), ...(input.Sinks != null && { Sinks: serializeAws_restJson1LiveConnectorSinkList(input.Sinks, context) }), ...(input.Sources != null && { Sources: serializeAws_restJson1LiveConnectorSourceList(input.Sources, context) }), ...(input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); return new __HttpRequest({ protocol, hostname, port, method: "POST", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1DeleteMediaCapturePipelineCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sdk-media-capture-pipelines/{MediaPipelineId}"; resolvedPath = __resolvedPath(resolvedPath, input, "MediaPipelineId", () => input.MediaPipelineId, "{MediaPipelineId}", false); let body; return new __HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1DeleteMediaInsightsPipelineConfigurationCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/media-insights-pipeline-configurations/{Identifier}"; resolvedPath = __resolvedPath(resolvedPath, input, "Identifier", () => input.Identifier, "{Identifier}", false); let body; return new __HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1DeleteMediaPipelineCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sdk-media-pipelines/{MediaPipelineId}"; resolvedPath = __resolvedPath(resolvedPath, input, "MediaPipelineId", () => input.MediaPipelineId, "{MediaPipelineId}", false); let body; return new __HttpRequest({ protocol, hostname, port, method: "DELETE", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1GetMediaCapturePipelineCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sdk-media-capture-pipelines/{MediaPipelineId}"; resolvedPath = __resolvedPath(resolvedPath, input, "MediaPipelineId", () => input.MediaPipelineId, "{MediaPipelineId}", false); let body; return new __HttpRequest({ protocol, hostname, port, method: "GET", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1GetMediaInsightsPipelineConfigurationCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/media-insights-pipeline-configurations/{Identifier}"; resolvedPath = __resolvedPath(resolvedPath, input, "Identifier", () => input.Identifier, "{Identifier}", false); let body; return new __HttpRequest({ protocol, hostname, port, method: "GET", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1GetMediaPipelineCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sdk-media-pipelines/{MediaPipelineId}"; resolvedPath = __resolvedPath(resolvedPath, input, "MediaPipelineId", () => input.MediaPipelineId, "{MediaPipelineId}", false); let body; return new __HttpRequest({ protocol, hostname, port, method: "GET", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1ListMediaCapturePipelinesCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sdk-media-capture-pipelines"; const query = map({ "next-token": [, input.NextToken], "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()], }); let body; return new __HttpRequest({ protocol, hostname, port, method: "GET", headers, path: resolvedPath, query, body, }); }; export const serializeAws_restJson1ListMediaInsightsPipelineConfigurationsCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/media-insights-pipeline-configurations"; const query = map({ "next-token": [, input.NextToken], "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()], }); let body; return new __HttpRequest({ protocol, hostname, port, method: "GET", headers, path: resolvedPath, query, body, }); }; export const serializeAws_restJson1ListMediaPipelinesCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/sdk-media-pipelines"; const query = map({ "next-token": [, input.NextToken], "max-results": [() => input.MaxResults !== void 0, () => input.MaxResults.toString()], }); let body; return new __HttpRequest({ protocol, hostname, port, method: "GET", headers, path: resolvedPath, query, body, }); }; export const serializeAws_restJson1ListTagsForResourceCommand = async (input, context) => { const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); const headers = {}; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags"; const query = map({ arn: [, __expectNonNull(input.ResourceARN, `ResourceARN`)], }); let body; return new __HttpRequest({ protocol, hostname, port, method: "GET", headers, path: resolvedPath, query, body, }); }; export const serializeAws_restJson1TagResourceCommand = async (input, context) => { 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 || ""}` + "/tags"; const query = map({ operation: [, "tag-resource"], }); let body; body = JSON.stringify({ ...(input.ResourceARN != null && { ResourceARN: input.ResourceARN }), ...(input.Tags != null && { Tags: serializeAws_restJson1TagList(input.Tags, context) }), }); return new __HttpRequest({ protocol, hostname, port, method: "POST", headers, path: resolvedPath, query, body, }); }; export const serializeAws_restJson1UntagResourceCommand = async (input, context) => { 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 || ""}` + "/tags"; const query = map({ operation: [, "untag-resource"], }); let body; body = JSON.stringify({ ...(input.ResourceARN != null && { ResourceARN: input.ResourceARN }), ...(input.TagKeys != null && { TagKeys: serializeAws_restJson1TagKeyList(input.TagKeys, context) }), }); return new __HttpRequest({ protocol, hostname, port, method: "POST", headers, path: resolvedPath, query, body, }); }; export const serializeAws_restJson1UpdateMediaInsightsPipelineConfigurationCommand = async (input, context) => { 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 || ""}` + "/media-insights-pipeline-configurations/{Identifier}"; resolvedPath = __resolvedPath(resolvedPath, input, "Identifier", () => input.Identifier, "{Identifier}", false); let body; body = JSON.stringify({ ...(input.Elements != null && { Elements: serializeAws_restJson1MediaInsightsPipelineConfigurationElements(input.Elements, context), }), ...(input.RealTimeAlertConfiguration != null && { RealTimeAlertConfiguration: serializeAws_restJson1RealTimeAlertConfiguration(input.RealTimeAlertConfiguration, context), }), ...(input.ResourceAccessRoleArn != null && { ResourceAccessRoleArn: input.ResourceAccessRoleArn }), }); return new __HttpRequest({ protocol, hostname, port, method: "PUT", headers, path: resolvedPath, body, }); }; export const serializeAws_restJson1UpdateMediaInsightsPipelineStatusCommand = async (input, context) => { 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 || ""}` + "/media-insights-pipeline-status/{Identifier}"; resolvedPath = __resolvedPath(resolvedPath, input, "Identifier", () => input.Identifier, "{Identifier}", false); let body; body = JSON.stringify({ ...(input.UpdateStatus != null && { UpdateStatus: input.UpdateStatus }), }); return new __HttpRequest({ protocol, hostname, port, method: "PUT", headers, path: resolvedPath, body, }); }; export const deserializeAws_restJson1CreateMediaCapturePipelineCommand = async (output, context) => { if (output.statusCode !== 201 && output.statusCode >= 300) { return deserializeAws_restJson1CreateMediaCapturePipelineCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data.MediaCapturePipeline != null) { contents.MediaCapturePipeline = deserializeAws_restJson1MediaCapturePipeline(data.MediaCapturePipeline, context); } return contents; }; const deserializeAws_restJson1CreateMediaCapturePipelineCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "ResourceLimitExceededException": case "com.amazonaws.chimesdkmediapipelines#ResourceLimitExceededException": throw await deserializeAws_restJson1ResourceLimitExceededExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1CreateMediaConcatenationPipelineCommand = async (output, context) => { if (output.statusCode !== 201 && output.statusCode >= 300) { return deserializeAws_restJson1CreateMediaConcatenationPipelineCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data.MediaConcatenationPipeline != null) { contents.MediaConcatenationPipeline = deserializeAws_restJson1MediaConcatenationPipeline(data.MediaConcatenationPipeline, context); } return contents; }; const deserializeAws_restJson1CreateMediaConcatenationPipelineCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "ResourceLimitExceededException": case "com.amazonaws.chimesdkmediapipelines#ResourceLimitExceededException": throw await deserializeAws_restJson1ResourceLimitExceededExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1CreateMediaInsightsPipelineCommand = async (output, context) => { if (output.statusCode !== 201 && output.statusCode >= 300) { return deserializeAws_restJson1CreateMediaInsightsPipelineCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data.MediaInsightsPipeline != null) { contents.MediaInsightsPipeline = deserializeAws_restJson1MediaInsightsPipeline(data.MediaInsightsPipeline, context); } return contents; }; const deserializeAws_restJson1CreateMediaInsightsPipelineCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "NotFoundException": case "com.amazonaws.chimesdkmediapipelines#NotFoundException": throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context); case "ResourceLimitExceededException": case "com.amazonaws.chimesdkmediapipelines#ResourceLimitExceededException": throw await deserializeAws_restJson1ResourceLimitExceededExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1CreateMediaInsightsPipelineConfigurationCommand = async (output, context) => { if (output.statusCode !== 201 && output.statusCode >= 300) { return deserializeAws_restJson1CreateMediaInsightsPipelineConfigurationCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data.MediaInsightsPipelineConfiguration != null) { contents.MediaInsightsPipelineConfiguration = deserializeAws_restJson1MediaInsightsPipelineConfiguration(data.MediaInsightsPipelineConfiguration, context); } return contents; }; const deserializeAws_restJson1CreateMediaInsightsPipelineConfigurationCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "NotFoundException": case "com.amazonaws.chimesdkmediapipelines#NotFoundException": throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context); case "ResourceLimitExceededException": case "com.amazonaws.chimesdkmediapipelines#ResourceLimitExceededException": throw await deserializeAws_restJson1ResourceLimitExceededExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1CreateMediaLiveConnectorPipelineCommand = async (output, context) => { if (output.statusCode !== 201 && output.statusCode >= 300) { return deserializeAws_restJson1CreateMediaLiveConnectorPipelineCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data.MediaLiveConnectorPipeline != null) { contents.MediaLiveConnectorPipeline = deserializeAws_restJson1MediaLiveConnectorPipeline(data.MediaLiveConnectorPipeline, context); } return contents; }; const deserializeAws_restJson1CreateMediaLiveConnectorPipelineCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "ResourceLimitExceededException": case "com.amazonaws.chimesdkmediapipelines#ResourceLimitExceededException": throw await deserializeAws_restJson1ResourceLimitExceededExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1DeleteMediaCapturePipelineCommand = async (output, context) => { if (output.statusCode !== 204 && output.statusCode >= 300) { return deserializeAws_restJson1DeleteMediaCapturePipelineCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); await collectBody(output.body, context); return contents; }; const deserializeAws_restJson1DeleteMediaCapturePipelineCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "NotFoundException": case "com.amazonaws.chimesdkmediapipelines#NotFoundException": throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1DeleteMediaInsightsPipelineConfigurationCommand = async (output, context) => { if (output.statusCode !== 204 && output.statusCode >= 300) { return deserializeAws_restJson1DeleteMediaInsightsPipelineConfigurationCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); await collectBody(output.body, context); return contents; }; const deserializeAws_restJson1DeleteMediaInsightsPipelineConfigurationCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ConflictException": case "com.amazonaws.chimesdkmediapipelines#ConflictException": throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "NotFoundException": case "com.amazonaws.chimesdkmediapipelines#NotFoundException": throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1DeleteMediaPipelineCommand = async (output, context) => { if (output.statusCode !== 204 && output.statusCode >= 300) { return deserializeAws_restJson1DeleteMediaPipelineCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); await collectBody(output.body, context); return contents; }; const deserializeAws_restJson1DeleteMediaPipelineCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "NotFoundException": case "com.amazonaws.chimesdkmediapipelines#NotFoundException": throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1GetMediaCapturePipelineCommand = async (output, context) => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetMediaCapturePipelineCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data.MediaCapturePipeline != null) { contents.MediaCapturePipeline = deserializeAws_restJson1MediaCapturePipeline(data.MediaCapturePipeline, context); } return contents; }; const deserializeAws_restJson1GetMediaCapturePipelineCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "NotFoundException": case "com.amazonaws.chimesdkmediapipelines#NotFoundException": throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1GetMediaInsightsPipelineConfigurationCommand = async (output, context) => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetMediaInsightsPipelineConfigurationCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data.MediaInsightsPipelineConfiguration != null) { contents.MediaInsightsPipelineConfiguration = deserializeAws_restJson1MediaInsightsPipelineConfiguration(data.MediaInsightsPipelineConfiguration, context); } return contents; }; const deserializeAws_restJson1GetMediaInsightsPipelineConfigurationCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "NotFoundException": case "com.amazonaws.chimesdkmediapipelines#NotFoundException": throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1GetMediaPipelineCommand = async (output, context) => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetMediaPipelineCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data.MediaPipeline != null) { contents.MediaPipeline = deserializeAws_restJson1MediaPipeline(data.MediaPipeline, context); } return contents; }; const deserializeAws_restJson1GetMediaPipelineCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); switch (errorCode) { case "BadRequestException": case "com.amazonaws.chimesdkmediapipelines#BadRequestException": throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context); case "ForbiddenException": case "com.amazonaws.chimesdkmediapipelines#ForbiddenException": throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context); case "NotFoundException": case "com.amazonaws.chimesdkmediapipelines#NotFoundException": throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context); case "ServiceFailureException": case "com.amazonaws.chimesdkmediapipelines#ServiceFailureException": throw await deserializeAws_restJson1ServiceFailureExceptionResponse(parsedOutput, context); case "ServiceUnavailableException": case "com.amazonaws.chimesdkmediapipelines#ServiceUnavailableException": throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context); case "ThrottledClientException": case "com.amazonaws.chimesdkmediapipelines#ThrottledClientException": throw await deserializeAws_restJson1ThrottledClientExceptionResponse(parsedOutput, context); case "UnauthorizedClientException": case "com.amazonaws.chimesdkmediapipelines#UnauthorizedClientException": throw await deserializeAws_restJson1UnauthorizedClientExceptionResponse(parsedOutput, context); default: const parsedBody = parsedOutput.body; throwDefaultError({ output, parsedBody, exceptionCtor: __BaseException, errorCode, }); } }; export const deserializeAws_restJson1ListMediaCapturePipelinesCommand = async (output, context) => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1ListMediaCapturePipelinesCommandError(output, context); } const contents = map({ $metadata: deserializeMetadata(output), }); const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data.MediaCapturePipelines != null) { contents.MediaCapturePipelines = deserializeAws_restJson1MediaCapturePipelineSummaryList(data.MediaCapturePipelines, context); } if (data.NextToken != null) { contents.NextToken = __expectString(data.NextToken); } return contents; }; const deserializeAws_restJson1ListMediaCapturePipelinesCommandError = async (output, context) => { const parsedOutput = { ...output, body: await parseErrorBody(output.body, context), }; const errorCode = loadRestJsonErrorCode(output, pars