@aws-sdk/client-ivs 3.141.0 → 3.149.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -501,16 +501,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
501
501
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
502
502
  const headers = {};
503
503
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
504
- if (input.resourceArn !== undefined) {
505
- const labelValue = input.resourceArn;
506
- if (labelValue.length <= 0) {
507
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
508
- }
509
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
510
- }
511
- else {
512
- throw new Error("No value provided for input HTTP label: resourceArn.");
513
- }
504
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
514
505
  let body;
515
506
  return new protocol_http_1.HttpRequest({
516
507
  protocol,
@@ -572,16 +563,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
572
563
  "content-type": "application/json",
573
564
  };
574
565
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
575
- if (input.resourceArn !== undefined) {
576
- const labelValue = input.resourceArn;
577
- if (labelValue.length <= 0) {
578
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
579
- }
580
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
581
- }
582
- else {
583
- throw new Error("No value provided for input HTTP label: resourceArn.");
584
- }
566
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
585
567
  let body;
586
568
  body = JSON.stringify({
587
569
  ...(input.tags != null && { tags: serializeAws_restJson1Tags(input.tags, context) }),
@@ -601,19 +583,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
601
583
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
602
584
  const headers = {};
603
585
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
604
- if (input.resourceArn !== undefined) {
605
- const labelValue = input.resourceArn;
606
- if (labelValue.length <= 0) {
607
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
608
- }
609
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
610
- }
611
- else {
612
- throw new Error("No value provided for input HTTP label: resourceArn.");
613
- }
614
- const query = {
615
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
616
- };
586
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
587
+ const query = map({
588
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
589
+ });
617
590
  let body;
618
591
  return new protocol_http_1.HttpRequest({
619
592
  protocol,
@@ -657,19 +630,17 @@ const deserializeAws_restJson1BatchGetChannelCommand = async (output, context) =
657
630
  if (output.statusCode !== 200 && output.statusCode >= 300) {
658
631
  return deserializeAws_restJson1BatchGetChannelCommandError(output, context);
659
632
  }
660
- const contents = {
633
+ const contents = map({
661
634
  $metadata: deserializeMetadata(output),
662
- channels: undefined,
663
- errors: undefined,
664
- };
635
+ });
665
636
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
666
- if (data.channels !== undefined && data.channels !== null) {
637
+ if (data.channels != null) {
667
638
  contents.channels = deserializeAws_restJson1Channels(data.channels, context);
668
639
  }
669
- if (data.errors !== undefined && data.errors !== null) {
640
+ if (data.errors != null) {
670
641
  contents.errors = deserializeAws_restJson1BatchErrors(data.errors, context);
671
642
  }
672
- return Promise.resolve(contents);
643
+ return contents;
673
644
  };
674
645
  exports.deserializeAws_restJson1BatchGetChannelCommand = deserializeAws_restJson1BatchGetChannelCommand;
675
646
  const deserializeAws_restJson1BatchGetChannelCommandError = async (output, context) => {
@@ -677,38 +648,30 @@ const deserializeAws_restJson1BatchGetChannelCommandError = async (output, conte
677
648
  ...output,
678
649
  body: await parseBody(output.body, context),
679
650
  };
680
- let response;
681
651
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
682
- switch (errorCode) {
683
- default:
684
- const parsedBody = parsedOutput.body;
685
- const $metadata = deserializeMetadata(output);
686
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
687
- response = new IvsServiceException_1.IvsServiceException({
688
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
689
- $fault: "client",
690
- $metadata,
691
- });
692
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
693
- }
652
+ const parsedBody = parsedOutput.body;
653
+ (0, smithy_client_1.throwDefaultError)({
654
+ output,
655
+ parsedBody,
656
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
657
+ errorCode,
658
+ });
694
659
  };
695
660
  const deserializeAws_restJson1BatchGetStreamKeyCommand = async (output, context) => {
696
661
  if (output.statusCode !== 200 && output.statusCode >= 300) {
697
662
  return deserializeAws_restJson1BatchGetStreamKeyCommandError(output, context);
698
663
  }
699
- const contents = {
664
+ const contents = map({
700
665
  $metadata: deserializeMetadata(output),
701
- errors: undefined,
702
- streamKeys: undefined,
703
- };
666
+ });
704
667
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
705
- if (data.errors !== undefined && data.errors !== null) {
668
+ if (data.errors != null) {
706
669
  contents.errors = deserializeAws_restJson1BatchErrors(data.errors, context);
707
670
  }
708
- if (data.streamKeys !== undefined && data.streamKeys !== null) {
671
+ if (data.streamKeys != null) {
709
672
  contents.streamKeys = deserializeAws_restJson1StreamKeys(data.streamKeys, context);
710
673
  }
711
- return Promise.resolve(contents);
674
+ return contents;
712
675
  };
713
676
  exports.deserializeAws_restJson1BatchGetStreamKeyCommand = deserializeAws_restJson1BatchGetStreamKeyCommand;
714
677
  const deserializeAws_restJson1BatchGetStreamKeyCommandError = async (output, context) => {
@@ -716,38 +679,30 @@ const deserializeAws_restJson1BatchGetStreamKeyCommandError = async (output, con
716
679
  ...output,
717
680
  body: await parseBody(output.body, context),
718
681
  };
719
- let response;
720
682
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
721
- switch (errorCode) {
722
- default:
723
- const parsedBody = parsedOutput.body;
724
- const $metadata = deserializeMetadata(output);
725
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
726
- response = new IvsServiceException_1.IvsServiceException({
727
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
728
- $fault: "client",
729
- $metadata,
730
- });
731
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
732
- }
683
+ const parsedBody = parsedOutput.body;
684
+ (0, smithy_client_1.throwDefaultError)({
685
+ output,
686
+ parsedBody,
687
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
688
+ errorCode,
689
+ });
733
690
  };
734
691
  const deserializeAws_restJson1CreateChannelCommand = async (output, context) => {
735
692
  if (output.statusCode !== 200 && output.statusCode >= 300) {
736
693
  return deserializeAws_restJson1CreateChannelCommandError(output, context);
737
694
  }
738
- const contents = {
695
+ const contents = map({
739
696
  $metadata: deserializeMetadata(output),
740
- channel: undefined,
741
- streamKey: undefined,
742
- };
697
+ });
743
698
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
744
- if (data.channel !== undefined && data.channel !== null) {
699
+ if (data.channel != null) {
745
700
  contents.channel = deserializeAws_restJson1Channel(data.channel, context);
746
701
  }
747
- if (data.streamKey !== undefined && data.streamKey !== null) {
702
+ if (data.streamKey != null) {
748
703
  contents.streamKey = deserializeAws_restJson1StreamKey(data.streamKey, context);
749
704
  }
750
- return Promise.resolve(contents);
705
+ return contents;
751
706
  };
752
707
  exports.deserializeAws_restJson1CreateChannelCommand = deserializeAws_restJson1CreateChannelCommand;
753
708
  const deserializeAws_restJson1CreateChannelCommandError = async (output, context) => {
@@ -755,7 +710,6 @@ const deserializeAws_restJson1CreateChannelCommandError = async (output, context
755
710
  ...output,
756
711
  body: await parseBody(output.body, context),
757
712
  };
758
- let response;
759
713
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
760
714
  switch (errorCode) {
761
715
  case "AccessDeniedException":
@@ -775,29 +729,26 @@ const deserializeAws_restJson1CreateChannelCommandError = async (output, context
775
729
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
776
730
  default:
777
731
  const parsedBody = parsedOutput.body;
778
- const $metadata = deserializeMetadata(output);
779
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
780
- response = new IvsServiceException_1.IvsServiceException({
781
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
782
- $fault: "client",
783
- $metadata,
732
+ (0, smithy_client_1.throwDefaultError)({
733
+ output,
734
+ parsedBody,
735
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
736
+ errorCode,
784
737
  });
785
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
786
738
  }
787
739
  };
788
740
  const deserializeAws_restJson1CreateRecordingConfigurationCommand = async (output, context) => {
789
741
  if (output.statusCode !== 200 && output.statusCode >= 300) {
790
742
  return deserializeAws_restJson1CreateRecordingConfigurationCommandError(output, context);
791
743
  }
792
- const contents = {
744
+ const contents = map({
793
745
  $metadata: deserializeMetadata(output),
794
- recordingConfiguration: undefined,
795
- };
746
+ });
796
747
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
797
- if (data.recordingConfiguration !== undefined && data.recordingConfiguration !== null) {
748
+ if (data.recordingConfiguration != null) {
798
749
  contents.recordingConfiguration = deserializeAws_restJson1RecordingConfiguration(data.recordingConfiguration, context);
799
750
  }
800
- return Promise.resolve(contents);
751
+ return contents;
801
752
  };
802
753
  exports.deserializeAws_restJson1CreateRecordingConfigurationCommand = deserializeAws_restJson1CreateRecordingConfigurationCommand;
803
754
  const deserializeAws_restJson1CreateRecordingConfigurationCommandError = async (output, context) => {
@@ -805,7 +756,6 @@ const deserializeAws_restJson1CreateRecordingConfigurationCommandError = async (
805
756
  ...output,
806
757
  body: await parseBody(output.body, context),
807
758
  };
808
- let response;
809
759
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
810
760
  switch (errorCode) {
811
761
  case "AccessDeniedException":
@@ -828,29 +778,26 @@ const deserializeAws_restJson1CreateRecordingConfigurationCommandError = async (
828
778
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
829
779
  default:
830
780
  const parsedBody = parsedOutput.body;
831
- const $metadata = deserializeMetadata(output);
832
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
833
- response = new IvsServiceException_1.IvsServiceException({
834
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
835
- $fault: "client",
836
- $metadata,
781
+ (0, smithy_client_1.throwDefaultError)({
782
+ output,
783
+ parsedBody,
784
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
785
+ errorCode,
837
786
  });
838
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
839
787
  }
840
788
  };
841
789
  const deserializeAws_restJson1CreateStreamKeyCommand = async (output, context) => {
842
790
  if (output.statusCode !== 200 && output.statusCode >= 300) {
843
791
  return deserializeAws_restJson1CreateStreamKeyCommandError(output, context);
844
792
  }
845
- const contents = {
793
+ const contents = map({
846
794
  $metadata: deserializeMetadata(output),
847
- streamKey: undefined,
848
- };
795
+ });
849
796
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
850
- if (data.streamKey !== undefined && data.streamKey !== null) {
797
+ if (data.streamKey != null) {
851
798
  contents.streamKey = deserializeAws_restJson1StreamKey(data.streamKey, context);
852
799
  }
853
- return Promise.resolve(contents);
800
+ return contents;
854
801
  };
855
802
  exports.deserializeAws_restJson1CreateStreamKeyCommand = deserializeAws_restJson1CreateStreamKeyCommand;
856
803
  const deserializeAws_restJson1CreateStreamKeyCommandError = async (output, context) => {
@@ -858,7 +805,6 @@ const deserializeAws_restJson1CreateStreamKeyCommandError = async (output, conte
858
805
  ...output,
859
806
  body: await parseBody(output.body, context),
860
807
  };
861
- let response;
862
808
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
863
809
  switch (errorCode) {
864
810
  case "AccessDeniedException":
@@ -878,25 +824,23 @@ const deserializeAws_restJson1CreateStreamKeyCommandError = async (output, conte
878
824
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
879
825
  default:
880
826
  const parsedBody = parsedOutput.body;
881
- const $metadata = deserializeMetadata(output);
882
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
883
- response = new IvsServiceException_1.IvsServiceException({
884
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
885
- $fault: "client",
886
- $metadata,
827
+ (0, smithy_client_1.throwDefaultError)({
828
+ output,
829
+ parsedBody,
830
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
831
+ errorCode,
887
832
  });
888
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
889
833
  }
890
834
  };
891
835
  const deserializeAws_restJson1DeleteChannelCommand = async (output, context) => {
892
836
  if (output.statusCode !== 204 && output.statusCode >= 300) {
893
837
  return deserializeAws_restJson1DeleteChannelCommandError(output, context);
894
838
  }
895
- const contents = {
839
+ const contents = map({
896
840
  $metadata: deserializeMetadata(output),
897
- };
841
+ });
898
842
  await collectBody(output.body, context);
899
- return Promise.resolve(contents);
843
+ return contents;
900
844
  };
901
845
  exports.deserializeAws_restJson1DeleteChannelCommand = deserializeAws_restJson1DeleteChannelCommand;
902
846
  const deserializeAws_restJson1DeleteChannelCommandError = async (output, context) => {
@@ -904,7 +848,6 @@ const deserializeAws_restJson1DeleteChannelCommandError = async (output, context
904
848
  ...output,
905
849
  body: await parseBody(output.body, context),
906
850
  };
907
- let response;
908
851
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
909
852
  switch (errorCode) {
910
853
  case "AccessDeniedException":
@@ -924,25 +867,23 @@ const deserializeAws_restJson1DeleteChannelCommandError = async (output, context
924
867
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
925
868
  default:
926
869
  const parsedBody = parsedOutput.body;
927
- const $metadata = deserializeMetadata(output);
928
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
929
- response = new IvsServiceException_1.IvsServiceException({
930
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
931
- $fault: "client",
932
- $metadata,
870
+ (0, smithy_client_1.throwDefaultError)({
871
+ output,
872
+ parsedBody,
873
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
874
+ errorCode,
933
875
  });
934
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
935
876
  }
936
877
  };
937
878
  const deserializeAws_restJson1DeletePlaybackKeyPairCommand = async (output, context) => {
938
879
  if (output.statusCode !== 200 && output.statusCode >= 300) {
939
880
  return deserializeAws_restJson1DeletePlaybackKeyPairCommandError(output, context);
940
881
  }
941
- const contents = {
882
+ const contents = map({
942
883
  $metadata: deserializeMetadata(output),
943
- };
884
+ });
944
885
  await collectBody(output.body, context);
945
- return Promise.resolve(contents);
886
+ return contents;
946
887
  };
947
888
  exports.deserializeAws_restJson1DeletePlaybackKeyPairCommand = deserializeAws_restJson1DeletePlaybackKeyPairCommand;
948
889
  const deserializeAws_restJson1DeletePlaybackKeyPairCommandError = async (output, context) => {
@@ -950,7 +891,6 @@ const deserializeAws_restJson1DeletePlaybackKeyPairCommandError = async (output,
950
891
  ...output,
951
892
  body: await parseBody(output.body, context),
952
893
  };
953
- let response;
954
894
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
955
895
  switch (errorCode) {
956
896
  case "AccessDeniedException":
@@ -967,25 +907,23 @@ const deserializeAws_restJson1DeletePlaybackKeyPairCommandError = async (output,
967
907
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
968
908
  default:
969
909
  const parsedBody = parsedOutput.body;
970
- const $metadata = deserializeMetadata(output);
971
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
972
- response = new IvsServiceException_1.IvsServiceException({
973
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
974
- $fault: "client",
975
- $metadata,
910
+ (0, smithy_client_1.throwDefaultError)({
911
+ output,
912
+ parsedBody,
913
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
914
+ errorCode,
976
915
  });
977
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
978
916
  }
979
917
  };
980
918
  const deserializeAws_restJson1DeleteRecordingConfigurationCommand = async (output, context) => {
981
919
  if (output.statusCode !== 200 && output.statusCode >= 300) {
982
920
  return deserializeAws_restJson1DeleteRecordingConfigurationCommandError(output, context);
983
921
  }
984
- const contents = {
922
+ const contents = map({
985
923
  $metadata: deserializeMetadata(output),
986
- };
924
+ });
987
925
  await collectBody(output.body, context);
988
- return Promise.resolve(contents);
926
+ return contents;
989
927
  };
990
928
  exports.deserializeAws_restJson1DeleteRecordingConfigurationCommand = deserializeAws_restJson1DeleteRecordingConfigurationCommand;
991
929
  const deserializeAws_restJson1DeleteRecordingConfigurationCommandError = async (output, context) => {
@@ -993,7 +931,6 @@ const deserializeAws_restJson1DeleteRecordingConfigurationCommandError = async (
993
931
  ...output,
994
932
  body: await parseBody(output.body, context),
995
933
  };
996
- let response;
997
934
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
998
935
  switch (errorCode) {
999
936
  case "AccessDeniedException":
@@ -1013,25 +950,23 @@ const deserializeAws_restJson1DeleteRecordingConfigurationCommandError = async (
1013
950
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1014
951
  default:
1015
952
  const parsedBody = parsedOutput.body;
1016
- const $metadata = deserializeMetadata(output);
1017
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1018
- response = new IvsServiceException_1.IvsServiceException({
1019
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1020
- $fault: "client",
1021
- $metadata,
953
+ (0, smithy_client_1.throwDefaultError)({
954
+ output,
955
+ parsedBody,
956
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
957
+ errorCode,
1022
958
  });
1023
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1024
959
  }
1025
960
  };
1026
961
  const deserializeAws_restJson1DeleteStreamKeyCommand = async (output, context) => {
1027
962
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1028
963
  return deserializeAws_restJson1DeleteStreamKeyCommandError(output, context);
1029
964
  }
1030
- const contents = {
965
+ const contents = map({
1031
966
  $metadata: deserializeMetadata(output),
1032
- };
967
+ });
1033
968
  await collectBody(output.body, context);
1034
- return Promise.resolve(contents);
969
+ return contents;
1035
970
  };
1036
971
  exports.deserializeAws_restJson1DeleteStreamKeyCommand = deserializeAws_restJson1DeleteStreamKeyCommand;
1037
972
  const deserializeAws_restJson1DeleteStreamKeyCommandError = async (output, context) => {
@@ -1039,7 +974,6 @@ const deserializeAws_restJson1DeleteStreamKeyCommandError = async (output, conte
1039
974
  ...output,
1040
975
  body: await parseBody(output.body, context),
1041
976
  };
1042
- let response;
1043
977
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1044
978
  switch (errorCode) {
1045
979
  case "AccessDeniedException":
@@ -1056,29 +990,26 @@ const deserializeAws_restJson1DeleteStreamKeyCommandError = async (output, conte
1056
990
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1057
991
  default:
1058
992
  const parsedBody = parsedOutput.body;
1059
- const $metadata = deserializeMetadata(output);
1060
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1061
- response = new IvsServiceException_1.IvsServiceException({
1062
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1063
- $fault: "client",
1064
- $metadata,
993
+ (0, smithy_client_1.throwDefaultError)({
994
+ output,
995
+ parsedBody,
996
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
997
+ errorCode,
1065
998
  });
1066
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1067
999
  }
1068
1000
  };
1069
1001
  const deserializeAws_restJson1GetChannelCommand = async (output, context) => {
1070
1002
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1071
1003
  return deserializeAws_restJson1GetChannelCommandError(output, context);
1072
1004
  }
1073
- const contents = {
1005
+ const contents = map({
1074
1006
  $metadata: deserializeMetadata(output),
1075
- channel: undefined,
1076
- };
1007
+ });
1077
1008
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1078
- if (data.channel !== undefined && data.channel !== null) {
1009
+ if (data.channel != null) {
1079
1010
  contents.channel = deserializeAws_restJson1Channel(data.channel, context);
1080
1011
  }
1081
- return Promise.resolve(contents);
1012
+ return contents;
1082
1013
  };
1083
1014
  exports.deserializeAws_restJson1GetChannelCommand = deserializeAws_restJson1GetChannelCommand;
1084
1015
  const deserializeAws_restJson1GetChannelCommandError = async (output, context) => {
@@ -1086,7 +1017,6 @@ const deserializeAws_restJson1GetChannelCommandError = async (output, context) =
1086
1017
  ...output,
1087
1018
  body: await parseBody(output.body, context),
1088
1019
  };
1089
- let response;
1090
1020
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1091
1021
  switch (errorCode) {
1092
1022
  case "AccessDeniedException":
@@ -1100,29 +1030,26 @@ const deserializeAws_restJson1GetChannelCommandError = async (output, context) =
1100
1030
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1101
1031
  default:
1102
1032
  const parsedBody = parsedOutput.body;
1103
- const $metadata = deserializeMetadata(output);
1104
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1105
- response = new IvsServiceException_1.IvsServiceException({
1106
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1107
- $fault: "client",
1108
- $metadata,
1033
+ (0, smithy_client_1.throwDefaultError)({
1034
+ output,
1035
+ parsedBody,
1036
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1037
+ errorCode,
1109
1038
  });
1110
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1111
1039
  }
1112
1040
  };
1113
1041
  const deserializeAws_restJson1GetPlaybackKeyPairCommand = async (output, context) => {
1114
1042
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1115
1043
  return deserializeAws_restJson1GetPlaybackKeyPairCommandError(output, context);
1116
1044
  }
1117
- const contents = {
1045
+ const contents = map({
1118
1046
  $metadata: deserializeMetadata(output),
1119
- keyPair: undefined,
1120
- };
1047
+ });
1121
1048
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1122
- if (data.keyPair !== undefined && data.keyPair !== null) {
1049
+ if (data.keyPair != null) {
1123
1050
  contents.keyPair = deserializeAws_restJson1PlaybackKeyPair(data.keyPair, context);
1124
1051
  }
1125
- return Promise.resolve(contents);
1052
+ return contents;
1126
1053
  };
1127
1054
  exports.deserializeAws_restJson1GetPlaybackKeyPairCommand = deserializeAws_restJson1GetPlaybackKeyPairCommand;
1128
1055
  const deserializeAws_restJson1GetPlaybackKeyPairCommandError = async (output, context) => {
@@ -1130,7 +1057,6 @@ const deserializeAws_restJson1GetPlaybackKeyPairCommandError = async (output, co
1130
1057
  ...output,
1131
1058
  body: await parseBody(output.body, context),
1132
1059
  };
1133
- let response;
1134
1060
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1135
1061
  switch (errorCode) {
1136
1062
  case "AccessDeniedException":
@@ -1144,29 +1070,26 @@ const deserializeAws_restJson1GetPlaybackKeyPairCommandError = async (output, co
1144
1070
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1145
1071
  default:
1146
1072
  const parsedBody = parsedOutput.body;
1147
- const $metadata = deserializeMetadata(output);
1148
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1149
- response = new IvsServiceException_1.IvsServiceException({
1150
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1151
- $fault: "client",
1152
- $metadata,
1073
+ (0, smithy_client_1.throwDefaultError)({
1074
+ output,
1075
+ parsedBody,
1076
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1077
+ errorCode,
1153
1078
  });
1154
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1155
1079
  }
1156
1080
  };
1157
1081
  const deserializeAws_restJson1GetRecordingConfigurationCommand = async (output, context) => {
1158
1082
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1159
1083
  return deserializeAws_restJson1GetRecordingConfigurationCommandError(output, context);
1160
1084
  }
1161
- const contents = {
1085
+ const contents = map({
1162
1086
  $metadata: deserializeMetadata(output),
1163
- recordingConfiguration: undefined,
1164
- };
1087
+ });
1165
1088
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1166
- if (data.recordingConfiguration !== undefined && data.recordingConfiguration !== null) {
1089
+ if (data.recordingConfiguration != null) {
1167
1090
  contents.recordingConfiguration = deserializeAws_restJson1RecordingConfiguration(data.recordingConfiguration, context);
1168
1091
  }
1169
- return Promise.resolve(contents);
1092
+ return contents;
1170
1093
  };
1171
1094
  exports.deserializeAws_restJson1GetRecordingConfigurationCommand = deserializeAws_restJson1GetRecordingConfigurationCommand;
1172
1095
  const deserializeAws_restJson1GetRecordingConfigurationCommandError = async (output, context) => {
@@ -1174,7 +1097,6 @@ const deserializeAws_restJson1GetRecordingConfigurationCommandError = async (out
1174
1097
  ...output,
1175
1098
  body: await parseBody(output.body, context),
1176
1099
  };
1177
- let response;
1178
1100
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1179
1101
  switch (errorCode) {
1180
1102
  case "AccessDeniedException":
@@ -1191,29 +1113,26 @@ const deserializeAws_restJson1GetRecordingConfigurationCommandError = async (out
1191
1113
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1192
1114
  default:
1193
1115
  const parsedBody = parsedOutput.body;
1194
- const $metadata = deserializeMetadata(output);
1195
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1196
- response = new IvsServiceException_1.IvsServiceException({
1197
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1198
- $fault: "client",
1199
- $metadata,
1116
+ (0, smithy_client_1.throwDefaultError)({
1117
+ output,
1118
+ parsedBody,
1119
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1120
+ errorCode,
1200
1121
  });
1201
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1202
1122
  }
1203
1123
  };
1204
1124
  const deserializeAws_restJson1GetStreamCommand = async (output, context) => {
1205
1125
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1206
1126
  return deserializeAws_restJson1GetStreamCommandError(output, context);
1207
1127
  }
1208
- const contents = {
1128
+ const contents = map({
1209
1129
  $metadata: deserializeMetadata(output),
1210
- stream: undefined,
1211
- };
1130
+ });
1212
1131
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1213
- if (data.stream !== undefined && data.stream !== null) {
1132
+ if (data.stream != null) {
1214
1133
  contents.stream = deserializeAws_restJson1_Stream(data.stream, context);
1215
1134
  }
1216
- return Promise.resolve(contents);
1135
+ return contents;
1217
1136
  };
1218
1137
  exports.deserializeAws_restJson1GetStreamCommand = deserializeAws_restJson1GetStreamCommand;
1219
1138
  const deserializeAws_restJson1GetStreamCommandError = async (output, context) => {
@@ -1221,7 +1140,6 @@ const deserializeAws_restJson1GetStreamCommandError = async (output, context) =>
1221
1140
  ...output,
1222
1141
  body: await parseBody(output.body, context),
1223
1142
  };
1224
- let response;
1225
1143
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1226
1144
  switch (errorCode) {
1227
1145
  case "AccessDeniedException":
@@ -1238,29 +1156,26 @@ const deserializeAws_restJson1GetStreamCommandError = async (output, context) =>
1238
1156
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1239
1157
  default:
1240
1158
  const parsedBody = parsedOutput.body;
1241
- const $metadata = deserializeMetadata(output);
1242
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1243
- response = new IvsServiceException_1.IvsServiceException({
1244
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1245
- $fault: "client",
1246
- $metadata,
1159
+ (0, smithy_client_1.throwDefaultError)({
1160
+ output,
1161
+ parsedBody,
1162
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1163
+ errorCode,
1247
1164
  });
1248
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1249
1165
  }
1250
1166
  };
1251
1167
  const deserializeAws_restJson1GetStreamKeyCommand = async (output, context) => {
1252
1168
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1253
1169
  return deserializeAws_restJson1GetStreamKeyCommandError(output, context);
1254
1170
  }
1255
- const contents = {
1171
+ const contents = map({
1256
1172
  $metadata: deserializeMetadata(output),
1257
- streamKey: undefined,
1258
- };
1173
+ });
1259
1174
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1260
- if (data.streamKey !== undefined && data.streamKey !== null) {
1175
+ if (data.streamKey != null) {
1261
1176
  contents.streamKey = deserializeAws_restJson1StreamKey(data.streamKey, context);
1262
1177
  }
1263
- return Promise.resolve(contents);
1178
+ return contents;
1264
1179
  };
1265
1180
  exports.deserializeAws_restJson1GetStreamKeyCommand = deserializeAws_restJson1GetStreamKeyCommand;
1266
1181
  const deserializeAws_restJson1GetStreamKeyCommandError = async (output, context) => {
@@ -1268,7 +1183,6 @@ const deserializeAws_restJson1GetStreamKeyCommandError = async (output, context)
1268
1183
  ...output,
1269
1184
  body: await parseBody(output.body, context),
1270
1185
  };
1271
- let response;
1272
1186
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1273
1187
  switch (errorCode) {
1274
1188
  case "AccessDeniedException":
@@ -1282,29 +1196,26 @@ const deserializeAws_restJson1GetStreamKeyCommandError = async (output, context)
1282
1196
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1283
1197
  default:
1284
1198
  const parsedBody = parsedOutput.body;
1285
- const $metadata = deserializeMetadata(output);
1286
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1287
- response = new IvsServiceException_1.IvsServiceException({
1288
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1289
- $fault: "client",
1290
- $metadata,
1199
+ (0, smithy_client_1.throwDefaultError)({
1200
+ output,
1201
+ parsedBody,
1202
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1203
+ errorCode,
1291
1204
  });
1292
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1293
1205
  }
1294
1206
  };
1295
1207
  const deserializeAws_restJson1GetStreamSessionCommand = async (output, context) => {
1296
1208
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1297
1209
  return deserializeAws_restJson1GetStreamSessionCommandError(output, context);
1298
1210
  }
1299
- const contents = {
1211
+ const contents = map({
1300
1212
  $metadata: deserializeMetadata(output),
1301
- streamSession: undefined,
1302
- };
1213
+ });
1303
1214
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1304
- if (data.streamSession !== undefined && data.streamSession !== null) {
1215
+ if (data.streamSession != null) {
1305
1216
  contents.streamSession = deserializeAws_restJson1StreamSession(data.streamSession, context);
1306
1217
  }
1307
- return Promise.resolve(contents);
1218
+ return contents;
1308
1219
  };
1309
1220
  exports.deserializeAws_restJson1GetStreamSessionCommand = deserializeAws_restJson1GetStreamSessionCommand;
1310
1221
  const deserializeAws_restJson1GetStreamSessionCommandError = async (output, context) => {
@@ -1312,7 +1223,6 @@ const deserializeAws_restJson1GetStreamSessionCommandError = async (output, cont
1312
1223
  ...output,
1313
1224
  body: await parseBody(output.body, context),
1314
1225
  };
1315
- let response;
1316
1226
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1317
1227
  switch (errorCode) {
1318
1228
  case "AccessDeniedException":
@@ -1326,29 +1236,26 @@ const deserializeAws_restJson1GetStreamSessionCommandError = async (output, cont
1326
1236
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1327
1237
  default:
1328
1238
  const parsedBody = parsedOutput.body;
1329
- const $metadata = deserializeMetadata(output);
1330
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1331
- response = new IvsServiceException_1.IvsServiceException({
1332
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1333
- $fault: "client",
1334
- $metadata,
1239
+ (0, smithy_client_1.throwDefaultError)({
1240
+ output,
1241
+ parsedBody,
1242
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1243
+ errorCode,
1335
1244
  });
1336
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1337
1245
  }
1338
1246
  };
1339
1247
  const deserializeAws_restJson1ImportPlaybackKeyPairCommand = async (output, context) => {
1340
1248
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1341
1249
  return deserializeAws_restJson1ImportPlaybackKeyPairCommandError(output, context);
1342
1250
  }
1343
- const contents = {
1251
+ const contents = map({
1344
1252
  $metadata: deserializeMetadata(output),
1345
- keyPair: undefined,
1346
- };
1253
+ });
1347
1254
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1348
- if (data.keyPair !== undefined && data.keyPair !== null) {
1255
+ if (data.keyPair != null) {
1349
1256
  contents.keyPair = deserializeAws_restJson1PlaybackKeyPair(data.keyPair, context);
1350
1257
  }
1351
- return Promise.resolve(contents);
1258
+ return contents;
1352
1259
  };
1353
1260
  exports.deserializeAws_restJson1ImportPlaybackKeyPairCommand = deserializeAws_restJson1ImportPlaybackKeyPairCommand;
1354
1261
  const deserializeAws_restJson1ImportPlaybackKeyPairCommandError = async (output, context) => {
@@ -1356,7 +1263,6 @@ const deserializeAws_restJson1ImportPlaybackKeyPairCommandError = async (output,
1356
1263
  ...output,
1357
1264
  body: await parseBody(output.body, context),
1358
1265
  };
1359
- let response;
1360
1266
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1361
1267
  switch (errorCode) {
1362
1268
  case "AccessDeniedException":
@@ -1376,33 +1282,29 @@ const deserializeAws_restJson1ImportPlaybackKeyPairCommandError = async (output,
1376
1282
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1377
1283
  default:
1378
1284
  const parsedBody = parsedOutput.body;
1379
- const $metadata = deserializeMetadata(output);
1380
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1381
- response = new IvsServiceException_1.IvsServiceException({
1382
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1383
- $fault: "client",
1384
- $metadata,
1285
+ (0, smithy_client_1.throwDefaultError)({
1286
+ output,
1287
+ parsedBody,
1288
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1289
+ errorCode,
1385
1290
  });
1386
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1387
1291
  }
1388
1292
  };
1389
1293
  const deserializeAws_restJson1ListChannelsCommand = async (output, context) => {
1390
1294
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1391
1295
  return deserializeAws_restJson1ListChannelsCommandError(output, context);
1392
1296
  }
1393
- const contents = {
1297
+ const contents = map({
1394
1298
  $metadata: deserializeMetadata(output),
1395
- channels: undefined,
1396
- nextToken: undefined,
1397
- };
1299
+ });
1398
1300
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1399
- if (data.channels !== undefined && data.channels !== null) {
1301
+ if (data.channels != null) {
1400
1302
  contents.channels = deserializeAws_restJson1ChannelList(data.channels, context);
1401
1303
  }
1402
- if (data.nextToken !== undefined && data.nextToken !== null) {
1304
+ if (data.nextToken != null) {
1403
1305
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1404
1306
  }
1405
- return Promise.resolve(contents);
1307
+ return contents;
1406
1308
  };
1407
1309
  exports.deserializeAws_restJson1ListChannelsCommand = deserializeAws_restJson1ListChannelsCommand;
1408
1310
  const deserializeAws_restJson1ListChannelsCommandError = async (output, context) => {
@@ -1410,7 +1312,6 @@ const deserializeAws_restJson1ListChannelsCommandError = async (output, context)
1410
1312
  ...output,
1411
1313
  body: await parseBody(output.body, context),
1412
1314
  };
1413
- let response;
1414
1315
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1415
1316
  switch (errorCode) {
1416
1317
  case "AccessDeniedException":
@@ -1424,33 +1325,29 @@ const deserializeAws_restJson1ListChannelsCommandError = async (output, context)
1424
1325
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1425
1326
  default:
1426
1327
  const parsedBody = parsedOutput.body;
1427
- const $metadata = deserializeMetadata(output);
1428
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1429
- response = new IvsServiceException_1.IvsServiceException({
1430
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1431
- $fault: "client",
1432
- $metadata,
1328
+ (0, smithy_client_1.throwDefaultError)({
1329
+ output,
1330
+ parsedBody,
1331
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1332
+ errorCode,
1433
1333
  });
1434
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1435
1334
  }
1436
1335
  };
1437
1336
  const deserializeAws_restJson1ListPlaybackKeyPairsCommand = async (output, context) => {
1438
1337
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1439
1338
  return deserializeAws_restJson1ListPlaybackKeyPairsCommandError(output, context);
1440
1339
  }
1441
- const contents = {
1340
+ const contents = map({
1442
1341
  $metadata: deserializeMetadata(output),
1443
- keyPairs: undefined,
1444
- nextToken: undefined,
1445
- };
1342
+ });
1446
1343
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1447
- if (data.keyPairs !== undefined && data.keyPairs !== null) {
1344
+ if (data.keyPairs != null) {
1448
1345
  contents.keyPairs = deserializeAws_restJson1PlaybackKeyPairList(data.keyPairs, context);
1449
1346
  }
1450
- if (data.nextToken !== undefined && data.nextToken !== null) {
1347
+ if (data.nextToken != null) {
1451
1348
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1452
1349
  }
1453
- return Promise.resolve(contents);
1350
+ return contents;
1454
1351
  };
1455
1352
  exports.deserializeAws_restJson1ListPlaybackKeyPairsCommand = deserializeAws_restJson1ListPlaybackKeyPairsCommand;
1456
1353
  const deserializeAws_restJson1ListPlaybackKeyPairsCommandError = async (output, context) => {
@@ -1458,7 +1355,6 @@ const deserializeAws_restJson1ListPlaybackKeyPairsCommandError = async (output,
1458
1355
  ...output,
1459
1356
  body: await parseBody(output.body, context),
1460
1357
  };
1461
- let response;
1462
1358
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1463
1359
  switch (errorCode) {
1464
1360
  case "AccessDeniedException":
@@ -1469,33 +1365,29 @@ const deserializeAws_restJson1ListPlaybackKeyPairsCommandError = async (output,
1469
1365
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1470
1366
  default:
1471
1367
  const parsedBody = parsedOutput.body;
1472
- const $metadata = deserializeMetadata(output);
1473
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1474
- response = new IvsServiceException_1.IvsServiceException({
1475
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1476
- $fault: "client",
1477
- $metadata,
1368
+ (0, smithy_client_1.throwDefaultError)({
1369
+ output,
1370
+ parsedBody,
1371
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1372
+ errorCode,
1478
1373
  });
1479
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1480
1374
  }
1481
1375
  };
1482
1376
  const deserializeAws_restJson1ListRecordingConfigurationsCommand = async (output, context) => {
1483
1377
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1484
1378
  return deserializeAws_restJson1ListRecordingConfigurationsCommandError(output, context);
1485
1379
  }
1486
- const contents = {
1380
+ const contents = map({
1487
1381
  $metadata: deserializeMetadata(output),
1488
- nextToken: undefined,
1489
- recordingConfigurations: undefined,
1490
- };
1382
+ });
1491
1383
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1492
- if (data.nextToken !== undefined && data.nextToken !== null) {
1384
+ if (data.nextToken != null) {
1493
1385
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1494
1386
  }
1495
- if (data.recordingConfigurations !== undefined && data.recordingConfigurations !== null) {
1387
+ if (data.recordingConfigurations != null) {
1496
1388
  contents.recordingConfigurations = deserializeAws_restJson1RecordingConfigurationList(data.recordingConfigurations, context);
1497
1389
  }
1498
- return Promise.resolve(contents);
1390
+ return contents;
1499
1391
  };
1500
1392
  exports.deserializeAws_restJson1ListRecordingConfigurationsCommand = deserializeAws_restJson1ListRecordingConfigurationsCommand;
1501
1393
  const deserializeAws_restJson1ListRecordingConfigurationsCommandError = async (output, context) => {
@@ -1503,7 +1395,6 @@ const deserializeAws_restJson1ListRecordingConfigurationsCommandError = async (o
1503
1395
  ...output,
1504
1396
  body: await parseBody(output.body, context),
1505
1397
  };
1506
- let response;
1507
1398
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1508
1399
  switch (errorCode) {
1509
1400
  case "AccessDeniedException":
@@ -1517,33 +1408,29 @@ const deserializeAws_restJson1ListRecordingConfigurationsCommandError = async (o
1517
1408
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1518
1409
  default:
1519
1410
  const parsedBody = parsedOutput.body;
1520
- const $metadata = deserializeMetadata(output);
1521
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1522
- response = new IvsServiceException_1.IvsServiceException({
1523
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1524
- $fault: "client",
1525
- $metadata,
1411
+ (0, smithy_client_1.throwDefaultError)({
1412
+ output,
1413
+ parsedBody,
1414
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1415
+ errorCode,
1526
1416
  });
1527
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1528
1417
  }
1529
1418
  };
1530
1419
  const deserializeAws_restJson1ListStreamKeysCommand = async (output, context) => {
1531
1420
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1532
1421
  return deserializeAws_restJson1ListStreamKeysCommandError(output, context);
1533
1422
  }
1534
- const contents = {
1423
+ const contents = map({
1535
1424
  $metadata: deserializeMetadata(output),
1536
- nextToken: undefined,
1537
- streamKeys: undefined,
1538
- };
1425
+ });
1539
1426
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1540
- if (data.nextToken !== undefined && data.nextToken !== null) {
1427
+ if (data.nextToken != null) {
1541
1428
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1542
1429
  }
1543
- if (data.streamKeys !== undefined && data.streamKeys !== null) {
1430
+ if (data.streamKeys != null) {
1544
1431
  contents.streamKeys = deserializeAws_restJson1StreamKeyList(data.streamKeys, context);
1545
1432
  }
1546
- return Promise.resolve(contents);
1433
+ return contents;
1547
1434
  };
1548
1435
  exports.deserializeAws_restJson1ListStreamKeysCommand = deserializeAws_restJson1ListStreamKeysCommand;
1549
1436
  const deserializeAws_restJson1ListStreamKeysCommandError = async (output, context) => {
@@ -1551,7 +1438,6 @@ const deserializeAws_restJson1ListStreamKeysCommandError = async (output, contex
1551
1438
  ...output,
1552
1439
  body: await parseBody(output.body, context),
1553
1440
  };
1554
- let response;
1555
1441
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1556
1442
  switch (errorCode) {
1557
1443
  case "AccessDeniedException":
@@ -1565,33 +1451,29 @@ const deserializeAws_restJson1ListStreamKeysCommandError = async (output, contex
1565
1451
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1566
1452
  default:
1567
1453
  const parsedBody = parsedOutput.body;
1568
- const $metadata = deserializeMetadata(output);
1569
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1570
- response = new IvsServiceException_1.IvsServiceException({
1571
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1572
- $fault: "client",
1573
- $metadata,
1454
+ (0, smithy_client_1.throwDefaultError)({
1455
+ output,
1456
+ parsedBody,
1457
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1458
+ errorCode,
1574
1459
  });
1575
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1576
1460
  }
1577
1461
  };
1578
1462
  const deserializeAws_restJson1ListStreamsCommand = async (output, context) => {
1579
1463
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1580
1464
  return deserializeAws_restJson1ListStreamsCommandError(output, context);
1581
1465
  }
1582
- const contents = {
1466
+ const contents = map({
1583
1467
  $metadata: deserializeMetadata(output),
1584
- nextToken: undefined,
1585
- streams: undefined,
1586
- };
1468
+ });
1587
1469
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1588
- if (data.nextToken !== undefined && data.nextToken !== null) {
1470
+ if (data.nextToken != null) {
1589
1471
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1590
1472
  }
1591
- if (data.streams !== undefined && data.streams !== null) {
1473
+ if (data.streams != null) {
1592
1474
  contents.streams = deserializeAws_restJson1StreamList(data.streams, context);
1593
1475
  }
1594
- return Promise.resolve(contents);
1476
+ return contents;
1595
1477
  };
1596
1478
  exports.deserializeAws_restJson1ListStreamsCommand = deserializeAws_restJson1ListStreamsCommand;
1597
1479
  const deserializeAws_restJson1ListStreamsCommandError = async (output, context) => {
@@ -1599,7 +1481,6 @@ const deserializeAws_restJson1ListStreamsCommandError = async (output, context)
1599
1481
  ...output,
1600
1482
  body: await parseBody(output.body, context),
1601
1483
  };
1602
- let response;
1603
1484
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1604
1485
  switch (errorCode) {
1605
1486
  case "AccessDeniedException":
@@ -1610,33 +1491,29 @@ const deserializeAws_restJson1ListStreamsCommandError = async (output, context)
1610
1491
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1611
1492
  default:
1612
1493
  const parsedBody = parsedOutput.body;
1613
- const $metadata = deserializeMetadata(output);
1614
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1615
- response = new IvsServiceException_1.IvsServiceException({
1616
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1617
- $fault: "client",
1618
- $metadata,
1494
+ (0, smithy_client_1.throwDefaultError)({
1495
+ output,
1496
+ parsedBody,
1497
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1498
+ errorCode,
1619
1499
  });
1620
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1621
1500
  }
1622
1501
  };
1623
1502
  const deserializeAws_restJson1ListStreamSessionsCommand = async (output, context) => {
1624
1503
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1625
1504
  return deserializeAws_restJson1ListStreamSessionsCommandError(output, context);
1626
1505
  }
1627
- const contents = {
1506
+ const contents = map({
1628
1507
  $metadata: deserializeMetadata(output),
1629
- nextToken: undefined,
1630
- streamSessions: undefined,
1631
- };
1508
+ });
1632
1509
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1633
- if (data.nextToken !== undefined && data.nextToken !== null) {
1510
+ if (data.nextToken != null) {
1634
1511
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1635
1512
  }
1636
- if (data.streamSessions !== undefined && data.streamSessions !== null) {
1513
+ if (data.streamSessions != null) {
1637
1514
  contents.streamSessions = deserializeAws_restJson1StreamSessionList(data.streamSessions, context);
1638
1515
  }
1639
- return Promise.resolve(contents);
1516
+ return contents;
1640
1517
  };
1641
1518
  exports.deserializeAws_restJson1ListStreamSessionsCommand = deserializeAws_restJson1ListStreamSessionsCommand;
1642
1519
  const deserializeAws_restJson1ListStreamSessionsCommandError = async (output, context) => {
@@ -1644,7 +1521,6 @@ const deserializeAws_restJson1ListStreamSessionsCommandError = async (output, co
1644
1521
  ...output,
1645
1522
  body: await parseBody(output.body, context),
1646
1523
  };
1647
- let response;
1648
1524
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1649
1525
  switch (errorCode) {
1650
1526
  case "AccessDeniedException":
@@ -1658,29 +1534,26 @@ const deserializeAws_restJson1ListStreamSessionsCommandError = async (output, co
1658
1534
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1659
1535
  default:
1660
1536
  const parsedBody = parsedOutput.body;
1661
- const $metadata = deserializeMetadata(output);
1662
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1663
- response = new IvsServiceException_1.IvsServiceException({
1664
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1665
- $fault: "client",
1666
- $metadata,
1537
+ (0, smithy_client_1.throwDefaultError)({
1538
+ output,
1539
+ parsedBody,
1540
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1541
+ errorCode,
1667
1542
  });
1668
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1669
1543
  }
1670
1544
  };
1671
1545
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1672
1546
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1673
1547
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1674
1548
  }
1675
- const contents = {
1549
+ const contents = map({
1676
1550
  $metadata: deserializeMetadata(output),
1677
- tags: undefined,
1678
- };
1551
+ });
1679
1552
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1680
- if (data.tags !== undefined && data.tags !== null) {
1553
+ if (data.tags != null) {
1681
1554
  contents.tags = deserializeAws_restJson1Tags(data.tags, context);
1682
1555
  }
1683
- return Promise.resolve(contents);
1556
+ return contents;
1684
1557
  };
1685
1558
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1686
1559
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1688,7 +1561,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1688
1561
  ...output,
1689
1562
  body: await parseBody(output.body, context),
1690
1563
  };
1691
- let response;
1692
1564
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1693
1565
  switch (errorCode) {
1694
1566
  case "InternalServerException":
@@ -1702,25 +1574,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1702
1574
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1703
1575
  default:
1704
1576
  const parsedBody = parsedOutput.body;
1705
- const $metadata = deserializeMetadata(output);
1706
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1707
- response = new IvsServiceException_1.IvsServiceException({
1708
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1709
- $fault: "client",
1710
- $metadata,
1577
+ (0, smithy_client_1.throwDefaultError)({
1578
+ output,
1579
+ parsedBody,
1580
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1581
+ errorCode,
1711
1582
  });
1712
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1713
1583
  }
1714
1584
  };
1715
1585
  const deserializeAws_restJson1PutMetadataCommand = async (output, context) => {
1716
1586
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1717
1587
  return deserializeAws_restJson1PutMetadataCommandError(output, context);
1718
1588
  }
1719
- const contents = {
1589
+ const contents = map({
1720
1590
  $metadata: deserializeMetadata(output),
1721
- };
1591
+ });
1722
1592
  await collectBody(output.body, context);
1723
- return Promise.resolve(contents);
1593
+ return contents;
1724
1594
  };
1725
1595
  exports.deserializeAws_restJson1PutMetadataCommand = deserializeAws_restJson1PutMetadataCommand;
1726
1596
  const deserializeAws_restJson1PutMetadataCommandError = async (output, context) => {
@@ -1728,7 +1598,6 @@ const deserializeAws_restJson1PutMetadataCommandError = async (output, context)
1728
1598
  ...output,
1729
1599
  body: await parseBody(output.body, context),
1730
1600
  };
1731
- let response;
1732
1601
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1733
1602
  switch (errorCode) {
1734
1603
  case "AccessDeniedException":
@@ -1748,25 +1617,23 @@ const deserializeAws_restJson1PutMetadataCommandError = async (output, context)
1748
1617
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1749
1618
  default:
1750
1619
  const parsedBody = parsedOutput.body;
1751
- const $metadata = deserializeMetadata(output);
1752
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1753
- response = new IvsServiceException_1.IvsServiceException({
1754
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1755
- $fault: "client",
1756
- $metadata,
1620
+ (0, smithy_client_1.throwDefaultError)({
1621
+ output,
1622
+ parsedBody,
1623
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1624
+ errorCode,
1757
1625
  });
1758
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1759
1626
  }
1760
1627
  };
1761
1628
  const deserializeAws_restJson1StopStreamCommand = async (output, context) => {
1762
1629
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1763
1630
  return deserializeAws_restJson1StopStreamCommandError(output, context);
1764
1631
  }
1765
- const contents = {
1632
+ const contents = map({
1766
1633
  $metadata: deserializeMetadata(output),
1767
- };
1634
+ });
1768
1635
  await collectBody(output.body, context);
1769
- return Promise.resolve(contents);
1636
+ return contents;
1770
1637
  };
1771
1638
  exports.deserializeAws_restJson1StopStreamCommand = deserializeAws_restJson1StopStreamCommand;
1772
1639
  const deserializeAws_restJson1StopStreamCommandError = async (output, context) => {
@@ -1774,7 +1641,6 @@ const deserializeAws_restJson1StopStreamCommandError = async (output, context) =
1774
1641
  ...output,
1775
1642
  body: await parseBody(output.body, context),
1776
1643
  };
1777
- let response;
1778
1644
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1779
1645
  switch (errorCode) {
1780
1646
  case "AccessDeniedException":
@@ -1794,25 +1660,23 @@ const deserializeAws_restJson1StopStreamCommandError = async (output, context) =
1794
1660
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1795
1661
  default:
1796
1662
  const parsedBody = parsedOutput.body;
1797
- const $metadata = deserializeMetadata(output);
1798
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1799
- response = new IvsServiceException_1.IvsServiceException({
1800
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1801
- $fault: "client",
1802
- $metadata,
1663
+ (0, smithy_client_1.throwDefaultError)({
1664
+ output,
1665
+ parsedBody,
1666
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1667
+ errorCode,
1803
1668
  });
1804
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1805
1669
  }
1806
1670
  };
1807
1671
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1808
1672
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1809
1673
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1810
1674
  }
1811
- const contents = {
1675
+ const contents = map({
1812
1676
  $metadata: deserializeMetadata(output),
1813
- };
1677
+ });
1814
1678
  await collectBody(output.body, context);
1815
- return Promise.resolve(contents);
1679
+ return contents;
1816
1680
  };
1817
1681
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1818
1682
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1820,7 +1684,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1820
1684
  ...output,
1821
1685
  body: await parseBody(output.body, context),
1822
1686
  };
1823
- let response;
1824
1687
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1825
1688
  switch (errorCode) {
1826
1689
  case "InternalServerException":
@@ -1834,25 +1697,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1834
1697
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1835
1698
  default:
1836
1699
  const parsedBody = parsedOutput.body;
1837
- const $metadata = deserializeMetadata(output);
1838
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1839
- response = new IvsServiceException_1.IvsServiceException({
1840
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1841
- $fault: "client",
1842
- $metadata,
1700
+ (0, smithy_client_1.throwDefaultError)({
1701
+ output,
1702
+ parsedBody,
1703
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1704
+ errorCode,
1843
1705
  });
1844
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1845
1706
  }
1846
1707
  };
1847
1708
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1848
1709
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1849
1710
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1850
1711
  }
1851
- const contents = {
1712
+ const contents = map({
1852
1713
  $metadata: deserializeMetadata(output),
1853
- };
1714
+ });
1854
1715
  await collectBody(output.body, context);
1855
- return Promise.resolve(contents);
1716
+ return contents;
1856
1717
  };
1857
1718
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1858
1719
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1860,7 +1721,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1860
1721
  ...output,
1861
1722
  body: await parseBody(output.body, context),
1862
1723
  };
1863
- let response;
1864
1724
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1865
1725
  switch (errorCode) {
1866
1726
  case "InternalServerException":
@@ -1874,29 +1734,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1874
1734
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1875
1735
  default:
1876
1736
  const parsedBody = parsedOutput.body;
1877
- const $metadata = deserializeMetadata(output);
1878
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1879
- response = new IvsServiceException_1.IvsServiceException({
1880
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1881
- $fault: "client",
1882
- $metadata,
1737
+ (0, smithy_client_1.throwDefaultError)({
1738
+ output,
1739
+ parsedBody,
1740
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1741
+ errorCode,
1883
1742
  });
1884
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1885
1743
  }
1886
1744
  };
1887
1745
  const deserializeAws_restJson1UpdateChannelCommand = async (output, context) => {
1888
1746
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1889
1747
  return deserializeAws_restJson1UpdateChannelCommandError(output, context);
1890
1748
  }
1891
- const contents = {
1749
+ const contents = map({
1892
1750
  $metadata: deserializeMetadata(output),
1893
- channel: undefined,
1894
- };
1751
+ });
1895
1752
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1896
- if (data.channel !== undefined && data.channel !== null) {
1753
+ if (data.channel != null) {
1897
1754
  contents.channel = deserializeAws_restJson1Channel(data.channel, context);
1898
1755
  }
1899
- return Promise.resolve(contents);
1756
+ return contents;
1900
1757
  };
1901
1758
  exports.deserializeAws_restJson1UpdateChannelCommand = deserializeAws_restJson1UpdateChannelCommand;
1902
1759
  const deserializeAws_restJson1UpdateChannelCommandError = async (output, context) => {
@@ -1904,7 +1761,6 @@ const deserializeAws_restJson1UpdateChannelCommandError = async (output, context
1904
1761
  ...output,
1905
1762
  body: await parseBody(output.body, context),
1906
1763
  };
1907
- let response;
1908
1764
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1909
1765
  switch (errorCode) {
1910
1766
  case "AccessDeniedException":
@@ -1924,20 +1780,19 @@ const deserializeAws_restJson1UpdateChannelCommandError = async (output, context
1924
1780
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1925
1781
  default:
1926
1782
  const parsedBody = parsedOutput.body;
1927
- const $metadata = deserializeMetadata(output);
1928
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1929
- response = new IvsServiceException_1.IvsServiceException({
1930
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1931
- $fault: "client",
1932
- $metadata,
1783
+ (0, smithy_client_1.throwDefaultError)({
1784
+ output,
1785
+ parsedBody,
1786
+ exceptionCtor: IvsServiceException_1.IvsServiceException,
1787
+ errorCode,
1933
1788
  });
1934
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1935
1789
  }
1936
1790
  };
1791
+ const map = smithy_client_1.map;
1937
1792
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1938
- const contents = {};
1793
+ const contents = map({});
1939
1794
  const data = parsedOutput.body;
1940
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1795
+ if (data.exceptionMessage != null) {
1941
1796
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
1942
1797
  }
1943
1798
  const exception = new models_0_1.AccessDeniedException({
@@ -1947,9 +1802,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
1947
1802
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1948
1803
  };
1949
1804
  const deserializeAws_restJson1ChannelNotBroadcastingResponse = async (parsedOutput, context) => {
1950
- const contents = {};
1805
+ const contents = map({});
1951
1806
  const data = parsedOutput.body;
1952
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1807
+ if (data.exceptionMessage != null) {
1953
1808
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
1954
1809
  }
1955
1810
  const exception = new models_0_1.ChannelNotBroadcasting({
@@ -1959,9 +1814,9 @@ const deserializeAws_restJson1ChannelNotBroadcastingResponse = async (parsedOutp
1959
1814
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1960
1815
  };
1961
1816
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1962
- const contents = {};
1817
+ const contents = map({});
1963
1818
  const data = parsedOutput.body;
1964
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1819
+ if (data.exceptionMessage != null) {
1965
1820
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
1966
1821
  }
1967
1822
  const exception = new models_0_1.ConflictException({
@@ -1971,9 +1826,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1971
1826
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1972
1827
  };
1973
1828
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1974
- const contents = {};
1829
+ const contents = map({});
1975
1830
  const data = parsedOutput.body;
1976
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1831
+ if (data.exceptionMessage != null) {
1977
1832
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
1978
1833
  }
1979
1834
  const exception = new models_0_1.InternalServerException({
@@ -1983,9 +1838,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1983
1838
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1984
1839
  };
1985
1840
  const deserializeAws_restJson1PendingVerificationResponse = async (parsedOutput, context) => {
1986
- const contents = {};
1841
+ const contents = map({});
1987
1842
  const data = parsedOutput.body;
1988
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1843
+ if (data.exceptionMessage != null) {
1989
1844
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
1990
1845
  }
1991
1846
  const exception = new models_0_1.PendingVerification({
@@ -1995,9 +1850,9 @@ const deserializeAws_restJson1PendingVerificationResponse = async (parsedOutput,
1995
1850
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1996
1851
  };
1997
1852
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1998
- const contents = {};
1853
+ const contents = map({});
1999
1854
  const data = parsedOutput.body;
2000
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1855
+ if (data.exceptionMessage != null) {
2001
1856
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
2002
1857
  }
2003
1858
  const exception = new models_0_1.ResourceNotFoundException({
@@ -2007,9 +1862,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
2007
1862
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2008
1863
  };
2009
1864
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2010
- const contents = {};
1865
+ const contents = map({});
2011
1866
  const data = parsedOutput.body;
2012
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1867
+ if (data.exceptionMessage != null) {
2013
1868
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
2014
1869
  }
2015
1870
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -2019,9 +1874,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
2019
1874
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2020
1875
  };
2021
1876
  const deserializeAws_restJson1StreamUnavailableResponse = async (parsedOutput, context) => {
2022
- const contents = {};
1877
+ const contents = map({});
2023
1878
  const data = parsedOutput.body;
2024
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1879
+ if (data.exceptionMessage != null) {
2025
1880
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
2026
1881
  }
2027
1882
  const exception = new models_0_1.StreamUnavailable({
@@ -2031,9 +1886,9 @@ const deserializeAws_restJson1StreamUnavailableResponse = async (parsedOutput, c
2031
1886
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2032
1887
  };
2033
1888
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
2034
- const contents = {};
1889
+ const contents = map({});
2035
1890
  const data = parsedOutput.body;
2036
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1891
+ if (data.exceptionMessage != null) {
2037
1892
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
2038
1893
  }
2039
1894
  const exception = new models_0_1.ThrottlingException({
@@ -2043,9 +1898,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
2043
1898
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2044
1899
  };
2045
1900
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2046
- const contents = {};
1901
+ const contents = map({});
2047
1902
  const data = parsedOutput.body;
2048
- if (data.exceptionMessage !== undefined && data.exceptionMessage !== null) {
1903
+ if (data.exceptionMessage != null) {
2049
1904
  contents.exceptionMessage = (0, smithy_client_1.expectString)(data.exceptionMessage);
2050
1905
  }
2051
1906
  const exception = new models_0_1.ValidationException({
@@ -2058,9 +1913,6 @@ const serializeAws_restJson1ChannelArnList = (input, context) => {
2058
1913
  return input
2059
1914
  .filter((e) => e != null)
2060
1915
  .map((entry) => {
2061
- if (entry === null) {
2062
- return null;
2063
- }
2064
1916
  return entry;
2065
1917
  });
2066
1918
  };
@@ -2083,9 +1935,6 @@ const serializeAws_restJson1StreamKeyArnList = (input, context) => {
2083
1935
  return input
2084
1936
  .filter((e) => e != null)
2085
1937
  .map((entry) => {
2086
- if (entry === null) {
2087
- return null;
2088
- }
2089
1938
  return entry;
2090
1939
  });
2091
1940
  };