@aws-sdk/client-inspector2 3.141.0 → 3.150.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.
@@ -584,16 +584,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
584
584
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
585
585
  const headers = {};
586
586
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
587
- if (input.resourceArn !== undefined) {
588
- const labelValue = input.resourceArn;
589
- if (labelValue.length <= 0) {
590
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
591
- }
592
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
593
- }
594
- else {
595
- throw new Error("No value provided for input HTTP label: resourceArn.");
596
- }
587
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
597
588
  let body;
598
589
  return new protocol_http_1.HttpRequest({
599
590
  protocol,
@@ -637,16 +628,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
637
628
  "content-type": "application/json",
638
629
  };
639
630
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
640
- if (input.resourceArn !== undefined) {
641
- const labelValue = input.resourceArn;
642
- if (labelValue.length <= 0) {
643
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
644
- }
645
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
646
- }
647
- else {
648
- throw new Error("No value provided for input HTTP label: resourceArn.");
649
- }
631
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
650
632
  let body;
651
633
  body = JSON.stringify({
652
634
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -666,19 +648,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
666
648
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
667
649
  const headers = {};
668
650
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
669
- if (input.resourceArn !== undefined) {
670
- const labelValue = input.resourceArn;
671
- if (labelValue.length <= 0) {
672
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
673
- }
674
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
675
- }
676
- else {
677
- throw new Error("No value provided for input HTTP label: resourceArn.");
678
- }
679
- const query = {
680
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
681
- };
651
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
652
+ const query = map({
653
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
654
+ });
682
655
  let body;
683
656
  return new protocol_http_1.HttpRequest({
684
657
  protocol,
@@ -768,15 +741,14 @@ const deserializeAws_restJson1AssociateMemberCommand = async (output, context) =
768
741
  if (output.statusCode !== 200 && output.statusCode >= 300) {
769
742
  return deserializeAws_restJson1AssociateMemberCommandError(output, context);
770
743
  }
771
- const contents = {
744
+ const contents = map({
772
745
  $metadata: deserializeMetadata(output),
773
- accountId: undefined,
774
- };
746
+ });
775
747
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
776
- if (data.accountId !== undefined && data.accountId !== null) {
748
+ if (data.accountId != null) {
777
749
  contents.accountId = (0, smithy_client_1.expectString)(data.accountId);
778
750
  }
779
- return Promise.resolve(contents);
751
+ return contents;
780
752
  };
781
753
  exports.deserializeAws_restJson1AssociateMemberCommand = deserializeAws_restJson1AssociateMemberCommand;
782
754
  const deserializeAws_restJson1AssociateMemberCommandError = async (output, context) => {
@@ -784,7 +756,6 @@ const deserializeAws_restJson1AssociateMemberCommandError = async (output, conte
784
756
  ...output,
785
757
  body: await parseBody(output.body, context),
786
758
  };
787
- let response;
788
759
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
789
760
  switch (errorCode) {
790
761
  case "AccessDeniedException":
@@ -801,33 +772,29 @@ const deserializeAws_restJson1AssociateMemberCommandError = async (output, conte
801
772
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
802
773
  default:
803
774
  const parsedBody = parsedOutput.body;
804
- const $metadata = deserializeMetadata(output);
805
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
806
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
807
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
808
- $fault: "client",
809
- $metadata,
775
+ (0, smithy_client_1.throwDefaultError)({
776
+ output,
777
+ parsedBody,
778
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
779
+ errorCode,
810
780
  });
811
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
812
781
  }
813
782
  };
814
783
  const deserializeAws_restJson1BatchGetAccountStatusCommand = async (output, context) => {
815
784
  if (output.statusCode !== 200 && output.statusCode >= 300) {
816
785
  return deserializeAws_restJson1BatchGetAccountStatusCommandError(output, context);
817
786
  }
818
- const contents = {
787
+ const contents = map({
819
788
  $metadata: deserializeMetadata(output),
820
- accounts: undefined,
821
- failedAccounts: undefined,
822
- };
789
+ });
823
790
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
824
- if (data.accounts !== undefined && data.accounts !== null) {
791
+ if (data.accounts != null) {
825
792
  contents.accounts = deserializeAws_restJson1AccountStateList(data.accounts, context);
826
793
  }
827
- if (data.failedAccounts !== undefined && data.failedAccounts !== null) {
794
+ if (data.failedAccounts != null) {
828
795
  contents.failedAccounts = deserializeAws_restJson1FailedAccountList(data.failedAccounts, context);
829
796
  }
830
- return Promise.resolve(contents);
797
+ return contents;
831
798
  };
832
799
  exports.deserializeAws_restJson1BatchGetAccountStatusCommand = deserializeAws_restJson1BatchGetAccountStatusCommand;
833
800
  const deserializeAws_restJson1BatchGetAccountStatusCommandError = async (output, context) => {
@@ -835,7 +802,6 @@ const deserializeAws_restJson1BatchGetAccountStatusCommandError = async (output,
835
802
  ...output,
836
803
  body: await parseBody(output.body, context),
837
804
  };
838
- let response;
839
805
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
840
806
  switch (errorCode) {
841
807
  case "AccessDeniedException":
@@ -855,33 +821,29 @@ const deserializeAws_restJson1BatchGetAccountStatusCommandError = async (output,
855
821
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
856
822
  default:
857
823
  const parsedBody = parsedOutput.body;
858
- const $metadata = deserializeMetadata(output);
859
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
860
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
861
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
862
- $fault: "client",
863
- $metadata,
824
+ (0, smithy_client_1.throwDefaultError)({
825
+ output,
826
+ parsedBody,
827
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
828
+ errorCode,
864
829
  });
865
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
866
830
  }
867
831
  };
868
832
  const deserializeAws_restJson1BatchGetFreeTrialInfoCommand = async (output, context) => {
869
833
  if (output.statusCode !== 200 && output.statusCode >= 300) {
870
834
  return deserializeAws_restJson1BatchGetFreeTrialInfoCommandError(output, context);
871
835
  }
872
- const contents = {
836
+ const contents = map({
873
837
  $metadata: deserializeMetadata(output),
874
- accounts: undefined,
875
- failedAccounts: undefined,
876
- };
838
+ });
877
839
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
878
- if (data.accounts !== undefined && data.accounts !== null) {
840
+ if (data.accounts != null) {
879
841
  contents.accounts = deserializeAws_restJson1FreeTrialAccountInfoList(data.accounts, context);
880
842
  }
881
- if (data.failedAccounts !== undefined && data.failedAccounts !== null) {
843
+ if (data.failedAccounts != null) {
882
844
  contents.failedAccounts = deserializeAws_restJson1FreeTrialInfoErrorList(data.failedAccounts, context);
883
845
  }
884
- return Promise.resolve(contents);
846
+ return contents;
885
847
  };
886
848
  exports.deserializeAws_restJson1BatchGetFreeTrialInfoCommand = deserializeAws_restJson1BatchGetFreeTrialInfoCommand;
887
849
  const deserializeAws_restJson1BatchGetFreeTrialInfoCommandError = async (output, context) => {
@@ -889,7 +851,6 @@ const deserializeAws_restJson1BatchGetFreeTrialInfoCommandError = async (output,
889
851
  ...output,
890
852
  body: await parseBody(output.body, context),
891
853
  };
892
- let response;
893
854
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
894
855
  switch (errorCode) {
895
856
  case "AccessDeniedException":
@@ -906,29 +867,26 @@ const deserializeAws_restJson1BatchGetFreeTrialInfoCommandError = async (output,
906
867
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
907
868
  default:
908
869
  const parsedBody = parsedOutput.body;
909
- const $metadata = deserializeMetadata(output);
910
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
911
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
912
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
913
- $fault: "client",
914
- $metadata,
870
+ (0, smithy_client_1.throwDefaultError)({
871
+ output,
872
+ parsedBody,
873
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
874
+ errorCode,
915
875
  });
916
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
917
876
  }
918
877
  };
919
878
  const deserializeAws_restJson1CancelFindingsReportCommand = async (output, context) => {
920
879
  if (output.statusCode !== 200 && output.statusCode >= 300) {
921
880
  return deserializeAws_restJson1CancelFindingsReportCommandError(output, context);
922
881
  }
923
- const contents = {
882
+ const contents = map({
924
883
  $metadata: deserializeMetadata(output),
925
- reportId: undefined,
926
- };
884
+ });
927
885
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
928
- if (data.reportId !== undefined && data.reportId !== null) {
886
+ if (data.reportId != null) {
929
887
  contents.reportId = (0, smithy_client_1.expectString)(data.reportId);
930
888
  }
931
- return Promise.resolve(contents);
889
+ return contents;
932
890
  };
933
891
  exports.deserializeAws_restJson1CancelFindingsReportCommand = deserializeAws_restJson1CancelFindingsReportCommand;
934
892
  const deserializeAws_restJson1CancelFindingsReportCommandError = async (output, context) => {
@@ -936,7 +894,6 @@ const deserializeAws_restJson1CancelFindingsReportCommandError = async (output,
936
894
  ...output,
937
895
  body: await parseBody(output.body, context),
938
896
  };
939
- let response;
940
897
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
941
898
  switch (errorCode) {
942
899
  case "AccessDeniedException":
@@ -956,29 +913,26 @@ const deserializeAws_restJson1CancelFindingsReportCommandError = async (output,
956
913
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
957
914
  default:
958
915
  const parsedBody = parsedOutput.body;
959
- const $metadata = deserializeMetadata(output);
960
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
961
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
962
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
963
- $fault: "client",
964
- $metadata,
916
+ (0, smithy_client_1.throwDefaultError)({
917
+ output,
918
+ parsedBody,
919
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
920
+ errorCode,
965
921
  });
966
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
967
922
  }
968
923
  };
969
924
  const deserializeAws_restJson1CreateFilterCommand = async (output, context) => {
970
925
  if (output.statusCode !== 200 && output.statusCode >= 300) {
971
926
  return deserializeAws_restJson1CreateFilterCommandError(output, context);
972
927
  }
973
- const contents = {
928
+ const contents = map({
974
929
  $metadata: deserializeMetadata(output),
975
- arn: undefined,
976
- };
930
+ });
977
931
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
978
- if (data.arn !== undefined && data.arn !== null) {
932
+ if (data.arn != null) {
979
933
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
980
934
  }
981
- return Promise.resolve(contents);
935
+ return contents;
982
936
  };
983
937
  exports.deserializeAws_restJson1CreateFilterCommand = deserializeAws_restJson1CreateFilterCommand;
984
938
  const deserializeAws_restJson1CreateFilterCommandError = async (output, context) => {
@@ -986,7 +940,6 @@ const deserializeAws_restJson1CreateFilterCommandError = async (output, context)
986
940
  ...output,
987
941
  body: await parseBody(output.body, context),
988
942
  };
989
- let response;
990
943
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
991
944
  switch (errorCode) {
992
945
  case "AccessDeniedException":
@@ -1009,29 +962,26 @@ const deserializeAws_restJson1CreateFilterCommandError = async (output, context)
1009
962
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1010
963
  default:
1011
964
  const parsedBody = parsedOutput.body;
1012
- const $metadata = deserializeMetadata(output);
1013
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1014
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1015
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1016
- $fault: "client",
1017
- $metadata,
965
+ (0, smithy_client_1.throwDefaultError)({
966
+ output,
967
+ parsedBody,
968
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
969
+ errorCode,
1018
970
  });
1019
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1020
971
  }
1021
972
  };
1022
973
  const deserializeAws_restJson1CreateFindingsReportCommand = async (output, context) => {
1023
974
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1024
975
  return deserializeAws_restJson1CreateFindingsReportCommandError(output, context);
1025
976
  }
1026
- const contents = {
977
+ const contents = map({
1027
978
  $metadata: deserializeMetadata(output),
1028
- reportId: undefined,
1029
- };
979
+ });
1030
980
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1031
- if (data.reportId !== undefined && data.reportId !== null) {
981
+ if (data.reportId != null) {
1032
982
  contents.reportId = (0, smithy_client_1.expectString)(data.reportId);
1033
983
  }
1034
- return Promise.resolve(contents);
984
+ return contents;
1035
985
  };
1036
986
  exports.deserializeAws_restJson1CreateFindingsReportCommand = deserializeAws_restJson1CreateFindingsReportCommand;
1037
987
  const deserializeAws_restJson1CreateFindingsReportCommandError = async (output, context) => {
@@ -1039,7 +989,6 @@ const deserializeAws_restJson1CreateFindingsReportCommandError = async (output,
1039
989
  ...output,
1040
990
  body: await parseBody(output.body, context),
1041
991
  };
1042
- let response;
1043
992
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1044
993
  switch (errorCode) {
1045
994
  case "AccessDeniedException":
@@ -1059,29 +1008,26 @@ const deserializeAws_restJson1CreateFindingsReportCommandError = async (output,
1059
1008
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1060
1009
  default:
1061
1010
  const parsedBody = parsedOutput.body;
1062
- const $metadata = deserializeMetadata(output);
1063
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1064
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1065
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1066
- $fault: "client",
1067
- $metadata,
1011
+ (0, smithy_client_1.throwDefaultError)({
1012
+ output,
1013
+ parsedBody,
1014
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1015
+ errorCode,
1068
1016
  });
1069
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1070
1017
  }
1071
1018
  };
1072
1019
  const deserializeAws_restJson1DeleteFilterCommand = async (output, context) => {
1073
1020
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1074
1021
  return deserializeAws_restJson1DeleteFilterCommandError(output, context);
1075
1022
  }
1076
- const contents = {
1023
+ const contents = map({
1077
1024
  $metadata: deserializeMetadata(output),
1078
- arn: undefined,
1079
- };
1025
+ });
1080
1026
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1081
- if (data.arn !== undefined && data.arn !== null) {
1027
+ if (data.arn != null) {
1082
1028
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
1083
1029
  }
1084
- return Promise.resolve(contents);
1030
+ return contents;
1085
1031
  };
1086
1032
  exports.deserializeAws_restJson1DeleteFilterCommand = deserializeAws_restJson1DeleteFilterCommand;
1087
1033
  const deserializeAws_restJson1DeleteFilterCommandError = async (output, context) => {
@@ -1089,7 +1035,6 @@ const deserializeAws_restJson1DeleteFilterCommandError = async (output, context)
1089
1035
  ...output,
1090
1036
  body: await parseBody(output.body, context),
1091
1037
  };
1092
- let response;
1093
1038
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1094
1039
  switch (errorCode) {
1095
1040
  case "AccessDeniedException":
@@ -1109,33 +1054,29 @@ const deserializeAws_restJson1DeleteFilterCommandError = async (output, context)
1109
1054
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1110
1055
  default:
1111
1056
  const parsedBody = parsedOutput.body;
1112
- const $metadata = deserializeMetadata(output);
1113
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1114
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1115
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1116
- $fault: "client",
1117
- $metadata,
1057
+ (0, smithy_client_1.throwDefaultError)({
1058
+ output,
1059
+ parsedBody,
1060
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1061
+ errorCode,
1118
1062
  });
1119
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1120
1063
  }
1121
1064
  };
1122
1065
  const deserializeAws_restJson1DescribeOrganizationConfigurationCommand = async (output, context) => {
1123
1066
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1124
1067
  return deserializeAws_restJson1DescribeOrganizationConfigurationCommandError(output, context);
1125
1068
  }
1126
- const contents = {
1069
+ const contents = map({
1127
1070
  $metadata: deserializeMetadata(output),
1128
- autoEnable: undefined,
1129
- maxAccountLimitReached: undefined,
1130
- };
1071
+ });
1131
1072
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1132
- if (data.autoEnable !== undefined && data.autoEnable !== null) {
1073
+ if (data.autoEnable != null) {
1133
1074
  contents.autoEnable = deserializeAws_restJson1AutoEnable(data.autoEnable, context);
1134
1075
  }
1135
- if (data.maxAccountLimitReached !== undefined && data.maxAccountLimitReached !== null) {
1076
+ if (data.maxAccountLimitReached != null) {
1136
1077
  contents.maxAccountLimitReached = (0, smithy_client_1.expectBoolean)(data.maxAccountLimitReached);
1137
1078
  }
1138
- return Promise.resolve(contents);
1079
+ return contents;
1139
1080
  };
1140
1081
  exports.deserializeAws_restJson1DescribeOrganizationConfigurationCommand = deserializeAws_restJson1DescribeOrganizationConfigurationCommand;
1141
1082
  const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = async (output, context) => {
@@ -1143,7 +1084,6 @@ const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = as
1143
1084
  ...output,
1144
1085
  body: await parseBody(output.body, context),
1145
1086
  };
1146
- let response;
1147
1087
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1148
1088
  switch (errorCode) {
1149
1089
  case "AccessDeniedException":
@@ -1160,33 +1100,29 @@ const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = as
1160
1100
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1161
1101
  default:
1162
1102
  const parsedBody = parsedOutput.body;
1163
- const $metadata = deserializeMetadata(output);
1164
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1165
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1166
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1167
- $fault: "client",
1168
- $metadata,
1103
+ (0, smithy_client_1.throwDefaultError)({
1104
+ output,
1105
+ parsedBody,
1106
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1107
+ errorCode,
1169
1108
  });
1170
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1171
1109
  }
1172
1110
  };
1173
1111
  const deserializeAws_restJson1DisableCommand = async (output, context) => {
1174
1112
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1175
1113
  return deserializeAws_restJson1DisableCommandError(output, context);
1176
1114
  }
1177
- const contents = {
1115
+ const contents = map({
1178
1116
  $metadata: deserializeMetadata(output),
1179
- accounts: undefined,
1180
- failedAccounts: undefined,
1181
- };
1117
+ });
1182
1118
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1183
- if (data.accounts !== undefined && data.accounts !== null) {
1119
+ if (data.accounts != null) {
1184
1120
  contents.accounts = deserializeAws_restJson1AccountList(data.accounts, context);
1185
1121
  }
1186
- if (data.failedAccounts !== undefined && data.failedAccounts !== null) {
1122
+ if (data.failedAccounts != null) {
1187
1123
  contents.failedAccounts = deserializeAws_restJson1FailedAccountList(data.failedAccounts, context);
1188
1124
  }
1189
- return Promise.resolve(contents);
1125
+ return contents;
1190
1126
  };
1191
1127
  exports.deserializeAws_restJson1DisableCommand = deserializeAws_restJson1DisableCommand;
1192
1128
  const deserializeAws_restJson1DisableCommandError = async (output, context) => {
@@ -1194,7 +1130,6 @@ const deserializeAws_restJson1DisableCommandError = async (output, context) => {
1194
1130
  ...output,
1195
1131
  body: await parseBody(output.body, context),
1196
1132
  };
1197
- let response;
1198
1133
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1199
1134
  switch (errorCode) {
1200
1135
  case "AccessDeniedException":
@@ -1214,29 +1149,26 @@ const deserializeAws_restJson1DisableCommandError = async (output, context) => {
1214
1149
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1215
1150
  default:
1216
1151
  const parsedBody = parsedOutput.body;
1217
- const $metadata = deserializeMetadata(output);
1218
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1219
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1220
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1221
- $fault: "client",
1222
- $metadata,
1152
+ (0, smithy_client_1.throwDefaultError)({
1153
+ output,
1154
+ parsedBody,
1155
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1156
+ errorCode,
1223
1157
  });
1224
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1225
1158
  }
1226
1159
  };
1227
1160
  const deserializeAws_restJson1DisableDelegatedAdminAccountCommand = async (output, context) => {
1228
1161
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1229
1162
  return deserializeAws_restJson1DisableDelegatedAdminAccountCommandError(output, context);
1230
1163
  }
1231
- const contents = {
1164
+ const contents = map({
1232
1165
  $metadata: deserializeMetadata(output),
1233
- delegatedAdminAccountId: undefined,
1234
- };
1166
+ });
1235
1167
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1236
- if (data.delegatedAdminAccountId !== undefined && data.delegatedAdminAccountId !== null) {
1168
+ if (data.delegatedAdminAccountId != null) {
1237
1169
  contents.delegatedAdminAccountId = (0, smithy_client_1.expectString)(data.delegatedAdminAccountId);
1238
1170
  }
1239
- return Promise.resolve(contents);
1171
+ return contents;
1240
1172
  };
1241
1173
  exports.deserializeAws_restJson1DisableDelegatedAdminAccountCommand = deserializeAws_restJson1DisableDelegatedAdminAccountCommand;
1242
1174
  const deserializeAws_restJson1DisableDelegatedAdminAccountCommandError = async (output, context) => {
@@ -1244,7 +1176,6 @@ const deserializeAws_restJson1DisableDelegatedAdminAccountCommandError = async (
1244
1176
  ...output,
1245
1177
  body: await parseBody(output.body, context),
1246
1178
  };
1247
- let response;
1248
1179
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1249
1180
  switch (errorCode) {
1250
1181
  case "AccessDeniedException":
@@ -1267,29 +1198,26 @@ const deserializeAws_restJson1DisableDelegatedAdminAccountCommandError = async (
1267
1198
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1268
1199
  default:
1269
1200
  const parsedBody = parsedOutput.body;
1270
- const $metadata = deserializeMetadata(output);
1271
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1272
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1273
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1274
- $fault: "client",
1275
- $metadata,
1201
+ (0, smithy_client_1.throwDefaultError)({
1202
+ output,
1203
+ parsedBody,
1204
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1205
+ errorCode,
1276
1206
  });
1277
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1278
1207
  }
1279
1208
  };
1280
1209
  const deserializeAws_restJson1DisassociateMemberCommand = async (output, context) => {
1281
1210
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1282
1211
  return deserializeAws_restJson1DisassociateMemberCommandError(output, context);
1283
1212
  }
1284
- const contents = {
1213
+ const contents = map({
1285
1214
  $metadata: deserializeMetadata(output),
1286
- accountId: undefined,
1287
- };
1215
+ });
1288
1216
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1289
- if (data.accountId !== undefined && data.accountId !== null) {
1217
+ if (data.accountId != null) {
1290
1218
  contents.accountId = (0, smithy_client_1.expectString)(data.accountId);
1291
1219
  }
1292
- return Promise.resolve(contents);
1220
+ return contents;
1293
1221
  };
1294
1222
  exports.deserializeAws_restJson1DisassociateMemberCommand = deserializeAws_restJson1DisassociateMemberCommand;
1295
1223
  const deserializeAws_restJson1DisassociateMemberCommandError = async (output, context) => {
@@ -1297,7 +1225,6 @@ const deserializeAws_restJson1DisassociateMemberCommandError = async (output, co
1297
1225
  ...output,
1298
1226
  body: await parseBody(output.body, context),
1299
1227
  };
1300
- let response;
1301
1228
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1302
1229
  switch (errorCode) {
1303
1230
  case "AccessDeniedException":
@@ -1314,33 +1241,29 @@ const deserializeAws_restJson1DisassociateMemberCommandError = async (output, co
1314
1241
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1315
1242
  default:
1316
1243
  const parsedBody = parsedOutput.body;
1317
- const $metadata = deserializeMetadata(output);
1318
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1319
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1320
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1321
- $fault: "client",
1322
- $metadata,
1244
+ (0, smithy_client_1.throwDefaultError)({
1245
+ output,
1246
+ parsedBody,
1247
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1248
+ errorCode,
1323
1249
  });
1324
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1325
1250
  }
1326
1251
  };
1327
1252
  const deserializeAws_restJson1EnableCommand = async (output, context) => {
1328
1253
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1329
1254
  return deserializeAws_restJson1EnableCommandError(output, context);
1330
1255
  }
1331
- const contents = {
1256
+ const contents = map({
1332
1257
  $metadata: deserializeMetadata(output),
1333
- accounts: undefined,
1334
- failedAccounts: undefined,
1335
- };
1258
+ });
1336
1259
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1337
- if (data.accounts !== undefined && data.accounts !== null) {
1260
+ if (data.accounts != null) {
1338
1261
  contents.accounts = deserializeAws_restJson1AccountList(data.accounts, context);
1339
1262
  }
1340
- if (data.failedAccounts !== undefined && data.failedAccounts !== null) {
1263
+ if (data.failedAccounts != null) {
1341
1264
  contents.failedAccounts = deserializeAws_restJson1FailedAccountList(data.failedAccounts, context);
1342
1265
  }
1343
- return Promise.resolve(contents);
1266
+ return contents;
1344
1267
  };
1345
1268
  exports.deserializeAws_restJson1EnableCommand = deserializeAws_restJson1EnableCommand;
1346
1269
  const deserializeAws_restJson1EnableCommandError = async (output, context) => {
@@ -1348,7 +1271,6 @@ const deserializeAws_restJson1EnableCommandError = async (output, context) => {
1348
1271
  ...output,
1349
1272
  body: await parseBody(output.body, context),
1350
1273
  };
1351
- let response;
1352
1274
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1353
1275
  switch (errorCode) {
1354
1276
  case "AccessDeniedException":
@@ -1368,29 +1290,26 @@ const deserializeAws_restJson1EnableCommandError = async (output, context) => {
1368
1290
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1369
1291
  default:
1370
1292
  const parsedBody = parsedOutput.body;
1371
- const $metadata = deserializeMetadata(output);
1372
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1373
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1374
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1375
- $fault: "client",
1376
- $metadata,
1293
+ (0, smithy_client_1.throwDefaultError)({
1294
+ output,
1295
+ parsedBody,
1296
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1297
+ errorCode,
1377
1298
  });
1378
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1379
1299
  }
1380
1300
  };
1381
1301
  const deserializeAws_restJson1EnableDelegatedAdminAccountCommand = async (output, context) => {
1382
1302
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1383
1303
  return deserializeAws_restJson1EnableDelegatedAdminAccountCommandError(output, context);
1384
1304
  }
1385
- const contents = {
1305
+ const contents = map({
1386
1306
  $metadata: deserializeMetadata(output),
1387
- delegatedAdminAccountId: undefined,
1388
- };
1307
+ });
1389
1308
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1390
- if (data.delegatedAdminAccountId !== undefined && data.delegatedAdminAccountId !== null) {
1309
+ if (data.delegatedAdminAccountId != null) {
1391
1310
  contents.delegatedAdminAccountId = (0, smithy_client_1.expectString)(data.delegatedAdminAccountId);
1392
1311
  }
1393
- return Promise.resolve(contents);
1312
+ return contents;
1394
1313
  };
1395
1314
  exports.deserializeAws_restJson1EnableDelegatedAdminAccountCommand = deserializeAws_restJson1EnableDelegatedAdminAccountCommand;
1396
1315
  const deserializeAws_restJson1EnableDelegatedAdminAccountCommandError = async (output, context) => {
@@ -1398,7 +1317,6 @@ const deserializeAws_restJson1EnableDelegatedAdminAccountCommandError = async (o
1398
1317
  ...output,
1399
1318
  body: await parseBody(output.body, context),
1400
1319
  };
1401
- let response;
1402
1320
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1403
1321
  switch (errorCode) {
1404
1322
  case "AccessDeniedException":
@@ -1421,29 +1339,26 @@ const deserializeAws_restJson1EnableDelegatedAdminAccountCommandError = async (o
1421
1339
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1422
1340
  default:
1423
1341
  const parsedBody = parsedOutput.body;
1424
- const $metadata = deserializeMetadata(output);
1425
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1426
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1427
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1428
- $fault: "client",
1429
- $metadata,
1342
+ (0, smithy_client_1.throwDefaultError)({
1343
+ output,
1344
+ parsedBody,
1345
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1346
+ errorCode,
1430
1347
  });
1431
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1432
1348
  }
1433
1349
  };
1434
1350
  const deserializeAws_restJson1GetConfigurationCommand = async (output, context) => {
1435
1351
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1436
1352
  return deserializeAws_restJson1GetConfigurationCommandError(output, context);
1437
1353
  }
1438
- const contents = {
1354
+ const contents = map({
1439
1355
  $metadata: deserializeMetadata(output),
1440
- ecrConfiguration: undefined,
1441
- };
1356
+ });
1442
1357
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1443
- if (data.ecrConfiguration !== undefined && data.ecrConfiguration !== null) {
1358
+ if (data.ecrConfiguration != null) {
1444
1359
  contents.ecrConfiguration = deserializeAws_restJson1EcrConfigurationState(data.ecrConfiguration, context);
1445
1360
  }
1446
- return Promise.resolve(contents);
1361
+ return contents;
1447
1362
  };
1448
1363
  exports.deserializeAws_restJson1GetConfigurationCommand = deserializeAws_restJson1GetConfigurationCommand;
1449
1364
  const deserializeAws_restJson1GetConfigurationCommandError = async (output, context) => {
@@ -1451,7 +1366,6 @@ const deserializeAws_restJson1GetConfigurationCommandError = async (output, cont
1451
1366
  ...output,
1452
1367
  body: await parseBody(output.body, context),
1453
1368
  };
1454
- let response;
1455
1369
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1456
1370
  switch (errorCode) {
1457
1371
  case "InternalServerException":
@@ -1465,29 +1379,26 @@ const deserializeAws_restJson1GetConfigurationCommandError = async (output, cont
1465
1379
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1466
1380
  default:
1467
1381
  const parsedBody = parsedOutput.body;
1468
- const $metadata = deserializeMetadata(output);
1469
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1470
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1471
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1472
- $fault: "client",
1473
- $metadata,
1382
+ (0, smithy_client_1.throwDefaultError)({
1383
+ output,
1384
+ parsedBody,
1385
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1386
+ errorCode,
1474
1387
  });
1475
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1476
1388
  }
1477
1389
  };
1478
1390
  const deserializeAws_restJson1GetDelegatedAdminAccountCommand = async (output, context) => {
1479
1391
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1480
1392
  return deserializeAws_restJson1GetDelegatedAdminAccountCommandError(output, context);
1481
1393
  }
1482
- const contents = {
1394
+ const contents = map({
1483
1395
  $metadata: deserializeMetadata(output),
1484
- delegatedAdmin: undefined,
1485
- };
1396
+ });
1486
1397
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1487
- if (data.delegatedAdmin !== undefined && data.delegatedAdmin !== null) {
1398
+ if (data.delegatedAdmin != null) {
1488
1399
  contents.delegatedAdmin = deserializeAws_restJson1DelegatedAdmin(data.delegatedAdmin, context);
1489
1400
  }
1490
- return Promise.resolve(contents);
1401
+ return contents;
1491
1402
  };
1492
1403
  exports.deserializeAws_restJson1GetDelegatedAdminAccountCommand = deserializeAws_restJson1GetDelegatedAdminAccountCommand;
1493
1404
  const deserializeAws_restJson1GetDelegatedAdminAccountCommandError = async (output, context) => {
@@ -1495,7 +1406,6 @@ const deserializeAws_restJson1GetDelegatedAdminAccountCommandError = async (outp
1495
1406
  ...output,
1496
1407
  body: await parseBody(output.body, context),
1497
1408
  };
1498
- let response;
1499
1409
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1500
1410
  switch (errorCode) {
1501
1411
  case "AccessDeniedException":
@@ -1515,49 +1425,41 @@ const deserializeAws_restJson1GetDelegatedAdminAccountCommandError = async (outp
1515
1425
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1516
1426
  default:
1517
1427
  const parsedBody = parsedOutput.body;
1518
- const $metadata = deserializeMetadata(output);
1519
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1520
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1521
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1522
- $fault: "client",
1523
- $metadata,
1428
+ (0, smithy_client_1.throwDefaultError)({
1429
+ output,
1430
+ parsedBody,
1431
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1432
+ errorCode,
1524
1433
  });
1525
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1526
1434
  }
1527
1435
  };
1528
1436
  const deserializeAws_restJson1GetFindingsReportStatusCommand = async (output, context) => {
1529
1437
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1530
1438
  return deserializeAws_restJson1GetFindingsReportStatusCommandError(output, context);
1531
1439
  }
1532
- const contents = {
1440
+ const contents = map({
1533
1441
  $metadata: deserializeMetadata(output),
1534
- destination: undefined,
1535
- errorCode: undefined,
1536
- errorMessage: undefined,
1537
- filterCriteria: undefined,
1538
- reportId: undefined,
1539
- status: undefined,
1540
- };
1442
+ });
1541
1443
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1542
- if (data.destination !== undefined && data.destination !== null) {
1444
+ if (data.destination != null) {
1543
1445
  contents.destination = deserializeAws_restJson1Destination(data.destination, context);
1544
1446
  }
1545
- if (data.errorCode !== undefined && data.errorCode !== null) {
1447
+ if (data.errorCode != null) {
1546
1448
  contents.errorCode = (0, smithy_client_1.expectString)(data.errorCode);
1547
1449
  }
1548
- if (data.errorMessage !== undefined && data.errorMessage !== null) {
1450
+ if (data.errorMessage != null) {
1549
1451
  contents.errorMessage = (0, smithy_client_1.expectString)(data.errorMessage);
1550
1452
  }
1551
- if (data.filterCriteria !== undefined && data.filterCriteria !== null) {
1453
+ if (data.filterCriteria != null) {
1552
1454
  contents.filterCriteria = deserializeAws_restJson1FilterCriteria(data.filterCriteria, context);
1553
1455
  }
1554
- if (data.reportId !== undefined && data.reportId !== null) {
1456
+ if (data.reportId != null) {
1555
1457
  contents.reportId = (0, smithy_client_1.expectString)(data.reportId);
1556
1458
  }
1557
- if (data.status !== undefined && data.status !== null) {
1459
+ if (data.status != null) {
1558
1460
  contents.status = (0, smithy_client_1.expectString)(data.status);
1559
1461
  }
1560
- return Promise.resolve(contents);
1462
+ return contents;
1561
1463
  };
1562
1464
  exports.deserializeAws_restJson1GetFindingsReportStatusCommand = deserializeAws_restJson1GetFindingsReportStatusCommand;
1563
1465
  const deserializeAws_restJson1GetFindingsReportStatusCommandError = async (output, context) => {
@@ -1565,7 +1467,6 @@ const deserializeAws_restJson1GetFindingsReportStatusCommandError = async (outpu
1565
1467
  ...output,
1566
1468
  body: await parseBody(output.body, context),
1567
1469
  };
1568
- let response;
1569
1470
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1570
1471
  switch (errorCode) {
1571
1472
  case "AccessDeniedException":
@@ -1585,29 +1486,26 @@ const deserializeAws_restJson1GetFindingsReportStatusCommandError = async (outpu
1585
1486
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1586
1487
  default:
1587
1488
  const parsedBody = parsedOutput.body;
1588
- const $metadata = deserializeMetadata(output);
1589
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1590
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1591
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1592
- $fault: "client",
1593
- $metadata,
1489
+ (0, smithy_client_1.throwDefaultError)({
1490
+ output,
1491
+ parsedBody,
1492
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1493
+ errorCode,
1594
1494
  });
1595
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1596
1495
  }
1597
1496
  };
1598
1497
  const deserializeAws_restJson1GetMemberCommand = async (output, context) => {
1599
1498
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1600
1499
  return deserializeAws_restJson1GetMemberCommandError(output, context);
1601
1500
  }
1602
- const contents = {
1501
+ const contents = map({
1603
1502
  $metadata: deserializeMetadata(output),
1604
- member: undefined,
1605
- };
1503
+ });
1606
1504
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1607
- if (data.member !== undefined && data.member !== null) {
1505
+ if (data.member != null) {
1608
1506
  contents.member = deserializeAws_restJson1Member(data.member, context);
1609
1507
  }
1610
- return Promise.resolve(contents);
1508
+ return contents;
1611
1509
  };
1612
1510
  exports.deserializeAws_restJson1GetMemberCommand = deserializeAws_restJson1GetMemberCommand;
1613
1511
  const deserializeAws_restJson1GetMemberCommandError = async (output, context) => {
@@ -1615,7 +1513,6 @@ const deserializeAws_restJson1GetMemberCommandError = async (output, context) =>
1615
1513
  ...output,
1616
1514
  body: await parseBody(output.body, context),
1617
1515
  };
1618
- let response;
1619
1516
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1620
1517
  switch (errorCode) {
1621
1518
  case "AccessDeniedException":
@@ -1635,33 +1532,29 @@ const deserializeAws_restJson1GetMemberCommandError = async (output, context) =>
1635
1532
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1636
1533
  default:
1637
1534
  const parsedBody = parsedOutput.body;
1638
- const $metadata = deserializeMetadata(output);
1639
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1640
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1641
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1642
- $fault: "client",
1643
- $metadata,
1535
+ (0, smithy_client_1.throwDefaultError)({
1536
+ output,
1537
+ parsedBody,
1538
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1539
+ errorCode,
1644
1540
  });
1645
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1646
1541
  }
1647
1542
  };
1648
1543
  const deserializeAws_restJson1ListAccountPermissionsCommand = async (output, context) => {
1649
1544
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1650
1545
  return deserializeAws_restJson1ListAccountPermissionsCommandError(output, context);
1651
1546
  }
1652
- const contents = {
1547
+ const contents = map({
1653
1548
  $metadata: deserializeMetadata(output),
1654
- nextToken: undefined,
1655
- permissions: undefined,
1656
- };
1549
+ });
1657
1550
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1658
- if (data.nextToken !== undefined && data.nextToken !== null) {
1551
+ if (data.nextToken != null) {
1659
1552
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1660
1553
  }
1661
- if (data.permissions !== undefined && data.permissions !== null) {
1554
+ if (data.permissions != null) {
1662
1555
  contents.permissions = deserializeAws_restJson1Permissions(data.permissions, context);
1663
1556
  }
1664
- return Promise.resolve(contents);
1557
+ return contents;
1665
1558
  };
1666
1559
  exports.deserializeAws_restJson1ListAccountPermissionsCommand = deserializeAws_restJson1ListAccountPermissionsCommand;
1667
1560
  const deserializeAws_restJson1ListAccountPermissionsCommandError = async (output, context) => {
@@ -1669,7 +1562,6 @@ const deserializeAws_restJson1ListAccountPermissionsCommandError = async (output
1669
1562
  ...output,
1670
1563
  body: await parseBody(output.body, context),
1671
1564
  };
1672
- let response;
1673
1565
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1674
1566
  switch (errorCode) {
1675
1567
  case "AccessDeniedException":
@@ -1686,33 +1578,29 @@ const deserializeAws_restJson1ListAccountPermissionsCommandError = async (output
1686
1578
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1687
1579
  default:
1688
1580
  const parsedBody = parsedOutput.body;
1689
- const $metadata = deserializeMetadata(output);
1690
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1691
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1692
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1693
- $fault: "client",
1694
- $metadata,
1581
+ (0, smithy_client_1.throwDefaultError)({
1582
+ output,
1583
+ parsedBody,
1584
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1585
+ errorCode,
1695
1586
  });
1696
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1697
1587
  }
1698
1588
  };
1699
1589
  const deserializeAws_restJson1ListCoverageCommand = async (output, context) => {
1700
1590
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1701
1591
  return deserializeAws_restJson1ListCoverageCommandError(output, context);
1702
1592
  }
1703
- const contents = {
1593
+ const contents = map({
1704
1594
  $metadata: deserializeMetadata(output),
1705
- coveredResources: undefined,
1706
- nextToken: undefined,
1707
- };
1595
+ });
1708
1596
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1709
- if (data.coveredResources !== undefined && data.coveredResources !== null) {
1597
+ if (data.coveredResources != null) {
1710
1598
  contents.coveredResources = deserializeAws_restJson1CoveredResources(data.coveredResources, context);
1711
1599
  }
1712
- if (data.nextToken !== undefined && data.nextToken !== null) {
1600
+ if (data.nextToken != null) {
1713
1601
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1714
1602
  }
1715
- return Promise.resolve(contents);
1603
+ return contents;
1716
1604
  };
1717
1605
  exports.deserializeAws_restJson1ListCoverageCommand = deserializeAws_restJson1ListCoverageCommand;
1718
1606
  const deserializeAws_restJson1ListCoverageCommandError = async (output, context) => {
@@ -1720,7 +1608,6 @@ const deserializeAws_restJson1ListCoverageCommandError = async (output, context)
1720
1608
  ...output,
1721
1609
  body: await parseBody(output.body, context),
1722
1610
  };
1723
- let response;
1724
1611
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1725
1612
  switch (errorCode) {
1726
1613
  case "InternalServerException":
@@ -1734,37 +1621,32 @@ const deserializeAws_restJson1ListCoverageCommandError = async (output, context)
1734
1621
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1735
1622
  default:
1736
1623
  const parsedBody = parsedOutput.body;
1737
- const $metadata = deserializeMetadata(output);
1738
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1739
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1740
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1741
- $fault: "client",
1742
- $metadata,
1624
+ (0, smithy_client_1.throwDefaultError)({
1625
+ output,
1626
+ parsedBody,
1627
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1628
+ errorCode,
1743
1629
  });
1744
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1745
1630
  }
1746
1631
  };
1747
1632
  const deserializeAws_restJson1ListCoverageStatisticsCommand = async (output, context) => {
1748
1633
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1749
1634
  return deserializeAws_restJson1ListCoverageStatisticsCommandError(output, context);
1750
1635
  }
1751
- const contents = {
1636
+ const contents = map({
1752
1637
  $metadata: deserializeMetadata(output),
1753
- countsByGroup: undefined,
1754
- nextToken: undefined,
1755
- totalCounts: undefined,
1756
- };
1638
+ });
1757
1639
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1758
- if (data.countsByGroup !== undefined && data.countsByGroup !== null) {
1640
+ if (data.countsByGroup != null) {
1759
1641
  contents.countsByGroup = deserializeAws_restJson1CountsList(data.countsByGroup, context);
1760
1642
  }
1761
- if (data.nextToken !== undefined && data.nextToken !== null) {
1643
+ if (data.nextToken != null) {
1762
1644
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1763
1645
  }
1764
- if (data.totalCounts !== undefined && data.totalCounts !== null) {
1646
+ if (data.totalCounts != null) {
1765
1647
  contents.totalCounts = (0, smithy_client_1.expectLong)(data.totalCounts);
1766
1648
  }
1767
- return Promise.resolve(contents);
1649
+ return contents;
1768
1650
  };
1769
1651
  exports.deserializeAws_restJson1ListCoverageStatisticsCommand = deserializeAws_restJson1ListCoverageStatisticsCommand;
1770
1652
  const deserializeAws_restJson1ListCoverageStatisticsCommandError = async (output, context) => {
@@ -1772,7 +1654,6 @@ const deserializeAws_restJson1ListCoverageStatisticsCommandError = async (output
1772
1654
  ...output,
1773
1655
  body: await parseBody(output.body, context),
1774
1656
  };
1775
- let response;
1776
1657
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1777
1658
  switch (errorCode) {
1778
1659
  case "InternalServerException":
@@ -1786,33 +1667,29 @@ const deserializeAws_restJson1ListCoverageStatisticsCommandError = async (output
1786
1667
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1787
1668
  default:
1788
1669
  const parsedBody = parsedOutput.body;
1789
- const $metadata = deserializeMetadata(output);
1790
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1791
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1792
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1793
- $fault: "client",
1794
- $metadata,
1670
+ (0, smithy_client_1.throwDefaultError)({
1671
+ output,
1672
+ parsedBody,
1673
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1674
+ errorCode,
1795
1675
  });
1796
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1797
1676
  }
1798
1677
  };
1799
1678
  const deserializeAws_restJson1ListDelegatedAdminAccountsCommand = async (output, context) => {
1800
1679
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1801
1680
  return deserializeAws_restJson1ListDelegatedAdminAccountsCommandError(output, context);
1802
1681
  }
1803
- const contents = {
1682
+ const contents = map({
1804
1683
  $metadata: deserializeMetadata(output),
1805
- delegatedAdminAccounts: undefined,
1806
- nextToken: undefined,
1807
- };
1684
+ });
1808
1685
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1809
- if (data.delegatedAdminAccounts !== undefined && data.delegatedAdminAccounts !== null) {
1686
+ if (data.delegatedAdminAccounts != null) {
1810
1687
  contents.delegatedAdminAccounts = deserializeAws_restJson1DelegatedAdminAccountList(data.delegatedAdminAccounts, context);
1811
1688
  }
1812
- if (data.nextToken !== undefined && data.nextToken !== null) {
1689
+ if (data.nextToken != null) {
1813
1690
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1814
1691
  }
1815
- return Promise.resolve(contents);
1692
+ return contents;
1816
1693
  };
1817
1694
  exports.deserializeAws_restJson1ListDelegatedAdminAccountsCommand = deserializeAws_restJson1ListDelegatedAdminAccountsCommand;
1818
1695
  const deserializeAws_restJson1ListDelegatedAdminAccountsCommandError = async (output, context) => {
@@ -1820,7 +1697,6 @@ const deserializeAws_restJson1ListDelegatedAdminAccountsCommandError = async (ou
1820
1697
  ...output,
1821
1698
  body: await parseBody(output.body, context),
1822
1699
  };
1823
- let response;
1824
1700
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1825
1701
  switch (errorCode) {
1826
1702
  case "AccessDeniedException":
@@ -1837,33 +1713,29 @@ const deserializeAws_restJson1ListDelegatedAdminAccountsCommandError = async (ou
1837
1713
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1838
1714
  default:
1839
1715
  const parsedBody = parsedOutput.body;
1840
- const $metadata = deserializeMetadata(output);
1841
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1842
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1843
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1844
- $fault: "client",
1845
- $metadata,
1716
+ (0, smithy_client_1.throwDefaultError)({
1717
+ output,
1718
+ parsedBody,
1719
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1720
+ errorCode,
1846
1721
  });
1847
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1848
1722
  }
1849
1723
  };
1850
1724
  const deserializeAws_restJson1ListFiltersCommand = async (output, context) => {
1851
1725
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1852
1726
  return deserializeAws_restJson1ListFiltersCommandError(output, context);
1853
1727
  }
1854
- const contents = {
1728
+ const contents = map({
1855
1729
  $metadata: deserializeMetadata(output),
1856
- filters: undefined,
1857
- nextToken: undefined,
1858
- };
1730
+ });
1859
1731
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1860
- if (data.filters !== undefined && data.filters !== null) {
1732
+ if (data.filters != null) {
1861
1733
  contents.filters = deserializeAws_restJson1FilterList(data.filters, context);
1862
1734
  }
1863
- if (data.nextToken !== undefined && data.nextToken !== null) {
1735
+ if (data.nextToken != null) {
1864
1736
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1865
1737
  }
1866
- return Promise.resolve(contents);
1738
+ return contents;
1867
1739
  };
1868
1740
  exports.deserializeAws_restJson1ListFiltersCommand = deserializeAws_restJson1ListFiltersCommand;
1869
1741
  const deserializeAws_restJson1ListFiltersCommandError = async (output, context) => {
@@ -1871,7 +1743,6 @@ const deserializeAws_restJson1ListFiltersCommandError = async (output, context)
1871
1743
  ...output,
1872
1744
  body: await parseBody(output.body, context),
1873
1745
  };
1874
- let response;
1875
1746
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1876
1747
  switch (errorCode) {
1877
1748
  case "AccessDeniedException":
@@ -1888,37 +1759,32 @@ const deserializeAws_restJson1ListFiltersCommandError = async (output, context)
1888
1759
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1889
1760
  default:
1890
1761
  const parsedBody = parsedOutput.body;
1891
- const $metadata = deserializeMetadata(output);
1892
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1893
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1894
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1895
- $fault: "client",
1896
- $metadata,
1762
+ (0, smithy_client_1.throwDefaultError)({
1763
+ output,
1764
+ parsedBody,
1765
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1766
+ errorCode,
1897
1767
  });
1898
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1899
1768
  }
1900
1769
  };
1901
1770
  const deserializeAws_restJson1ListFindingAggregationsCommand = async (output, context) => {
1902
1771
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1903
1772
  return deserializeAws_restJson1ListFindingAggregationsCommandError(output, context);
1904
1773
  }
1905
- const contents = {
1774
+ const contents = map({
1906
1775
  $metadata: deserializeMetadata(output),
1907
- aggregationType: undefined,
1908
- nextToken: undefined,
1909
- responses: undefined,
1910
- };
1776
+ });
1911
1777
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1912
- if (data.aggregationType !== undefined && data.aggregationType !== null) {
1778
+ if (data.aggregationType != null) {
1913
1779
  contents.aggregationType = (0, smithy_client_1.expectString)(data.aggregationType);
1914
1780
  }
1915
- if (data.nextToken !== undefined && data.nextToken !== null) {
1781
+ if (data.nextToken != null) {
1916
1782
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1917
1783
  }
1918
- if (data.responses !== undefined && data.responses !== null) {
1784
+ if (data.responses != null) {
1919
1785
  contents.responses = deserializeAws_restJson1AggregationResponseList(data.responses, context);
1920
1786
  }
1921
- return Promise.resolve(contents);
1787
+ return contents;
1922
1788
  };
1923
1789
  exports.deserializeAws_restJson1ListFindingAggregationsCommand = deserializeAws_restJson1ListFindingAggregationsCommand;
1924
1790
  const deserializeAws_restJson1ListFindingAggregationsCommandError = async (output, context) => {
@@ -1926,7 +1792,6 @@ const deserializeAws_restJson1ListFindingAggregationsCommandError = async (outpu
1926
1792
  ...output,
1927
1793
  body: await parseBody(output.body, context),
1928
1794
  };
1929
- let response;
1930
1795
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1931
1796
  switch (errorCode) {
1932
1797
  case "InternalServerException":
@@ -1940,33 +1805,29 @@ const deserializeAws_restJson1ListFindingAggregationsCommandError = async (outpu
1940
1805
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1941
1806
  default:
1942
1807
  const parsedBody = parsedOutput.body;
1943
- const $metadata = deserializeMetadata(output);
1944
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1945
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1946
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1947
- $fault: "client",
1948
- $metadata,
1808
+ (0, smithy_client_1.throwDefaultError)({
1809
+ output,
1810
+ parsedBody,
1811
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1812
+ errorCode,
1949
1813
  });
1950
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1951
1814
  }
1952
1815
  };
1953
1816
  const deserializeAws_restJson1ListFindingsCommand = async (output, context) => {
1954
1817
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1955
1818
  return deserializeAws_restJson1ListFindingsCommandError(output, context);
1956
1819
  }
1957
- const contents = {
1820
+ const contents = map({
1958
1821
  $metadata: deserializeMetadata(output),
1959
- findings: undefined,
1960
- nextToken: undefined,
1961
- };
1822
+ });
1962
1823
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1963
- if (data.findings !== undefined && data.findings !== null) {
1824
+ if (data.findings != null) {
1964
1825
  contents.findings = deserializeAws_restJson1FindingList(data.findings, context);
1965
1826
  }
1966
- if (data.nextToken !== undefined && data.nextToken !== null) {
1827
+ if (data.nextToken != null) {
1967
1828
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1968
1829
  }
1969
- return Promise.resolve(contents);
1830
+ return contents;
1970
1831
  };
1971
1832
  exports.deserializeAws_restJson1ListFindingsCommand = deserializeAws_restJson1ListFindingsCommand;
1972
1833
  const deserializeAws_restJson1ListFindingsCommandError = async (output, context) => {
@@ -1974,7 +1835,6 @@ const deserializeAws_restJson1ListFindingsCommandError = async (output, context)
1974
1835
  ...output,
1975
1836
  body: await parseBody(output.body, context),
1976
1837
  };
1977
- let response;
1978
1838
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1979
1839
  switch (errorCode) {
1980
1840
  case "InternalServerException":
@@ -1988,33 +1848,29 @@ const deserializeAws_restJson1ListFindingsCommandError = async (output, context)
1988
1848
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1989
1849
  default:
1990
1850
  const parsedBody = parsedOutput.body;
1991
- const $metadata = deserializeMetadata(output);
1992
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1993
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
1994
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1995
- $fault: "client",
1996
- $metadata,
1851
+ (0, smithy_client_1.throwDefaultError)({
1852
+ output,
1853
+ parsedBody,
1854
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1855
+ errorCode,
1997
1856
  });
1998
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1999
1857
  }
2000
1858
  };
2001
1859
  const deserializeAws_restJson1ListMembersCommand = async (output, context) => {
2002
1860
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2003
1861
  return deserializeAws_restJson1ListMembersCommandError(output, context);
2004
1862
  }
2005
- const contents = {
1863
+ const contents = map({
2006
1864
  $metadata: deserializeMetadata(output),
2007
- members: undefined,
2008
- nextToken: undefined,
2009
- };
1865
+ });
2010
1866
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2011
- if (data.members !== undefined && data.members !== null) {
1867
+ if (data.members != null) {
2012
1868
  contents.members = deserializeAws_restJson1MemberList(data.members, context);
2013
1869
  }
2014
- if (data.nextToken !== undefined && data.nextToken !== null) {
1870
+ if (data.nextToken != null) {
2015
1871
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2016
1872
  }
2017
- return Promise.resolve(contents);
1873
+ return contents;
2018
1874
  };
2019
1875
  exports.deserializeAws_restJson1ListMembersCommand = deserializeAws_restJson1ListMembersCommand;
2020
1876
  const deserializeAws_restJson1ListMembersCommandError = async (output, context) => {
@@ -2022,7 +1878,6 @@ const deserializeAws_restJson1ListMembersCommandError = async (output, context)
2022
1878
  ...output,
2023
1879
  body: await parseBody(output.body, context),
2024
1880
  };
2025
- let response;
2026
1881
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2027
1882
  switch (errorCode) {
2028
1883
  case "AccessDeniedException":
@@ -2039,29 +1894,26 @@ const deserializeAws_restJson1ListMembersCommandError = async (output, context)
2039
1894
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2040
1895
  default:
2041
1896
  const parsedBody = parsedOutput.body;
2042
- const $metadata = deserializeMetadata(output);
2043
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2044
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
2045
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2046
- $fault: "client",
2047
- $metadata,
1897
+ (0, smithy_client_1.throwDefaultError)({
1898
+ output,
1899
+ parsedBody,
1900
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1901
+ errorCode,
2048
1902
  });
2049
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2050
1903
  }
2051
1904
  };
2052
1905
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2053
1906
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2054
1907
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2055
1908
  }
2056
- const contents = {
1909
+ const contents = map({
2057
1910
  $metadata: deserializeMetadata(output),
2058
- tags: undefined,
2059
- };
1911
+ });
2060
1912
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2061
- if (data.tags !== undefined && data.tags !== null) {
1913
+ if (data.tags != null) {
2062
1914
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
2063
1915
  }
2064
- return Promise.resolve(contents);
1916
+ return contents;
2065
1917
  };
2066
1918
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2067
1919
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -2069,7 +1921,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2069
1921
  ...output,
2070
1922
  body: await parseBody(output.body, context),
2071
1923
  };
2072
- let response;
2073
1924
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2074
1925
  switch (errorCode) {
2075
1926
  case "InternalServerException":
@@ -2086,33 +1937,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2086
1937
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2087
1938
  default:
2088
1939
  const parsedBody = parsedOutput.body;
2089
- const $metadata = deserializeMetadata(output);
2090
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2091
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
2092
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2093
- $fault: "client",
2094
- $metadata,
1940
+ (0, smithy_client_1.throwDefaultError)({
1941
+ output,
1942
+ parsedBody,
1943
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1944
+ errorCode,
2095
1945
  });
2096
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2097
1946
  }
2098
1947
  };
2099
1948
  const deserializeAws_restJson1ListUsageTotalsCommand = async (output, context) => {
2100
1949
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2101
1950
  return deserializeAws_restJson1ListUsageTotalsCommandError(output, context);
2102
1951
  }
2103
- const contents = {
1952
+ const contents = map({
2104
1953
  $metadata: deserializeMetadata(output),
2105
- nextToken: undefined,
2106
- totals: undefined,
2107
- };
1954
+ });
2108
1955
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2109
- if (data.nextToken !== undefined && data.nextToken !== null) {
1956
+ if (data.nextToken != null) {
2110
1957
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2111
1958
  }
2112
- if (data.totals !== undefined && data.totals !== null) {
1959
+ if (data.totals != null) {
2113
1960
  contents.totals = deserializeAws_restJson1UsageTotalList(data.totals, context);
2114
1961
  }
2115
- return Promise.resolve(contents);
1962
+ return contents;
2116
1963
  };
2117
1964
  exports.deserializeAws_restJson1ListUsageTotalsCommand = deserializeAws_restJson1ListUsageTotalsCommand;
2118
1965
  const deserializeAws_restJson1ListUsageTotalsCommandError = async (output, context) => {
@@ -2120,7 +1967,6 @@ const deserializeAws_restJson1ListUsageTotalsCommandError = async (output, conte
2120
1967
  ...output,
2121
1968
  body: await parseBody(output.body, context),
2122
1969
  };
2123
- let response;
2124
1970
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2125
1971
  switch (errorCode) {
2126
1972
  case "AccessDeniedException":
@@ -2137,25 +1983,23 @@ const deserializeAws_restJson1ListUsageTotalsCommandError = async (output, conte
2137
1983
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2138
1984
  default:
2139
1985
  const parsedBody = parsedOutput.body;
2140
- const $metadata = deserializeMetadata(output);
2141
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2142
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
2143
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2144
- $fault: "client",
2145
- $metadata,
1986
+ (0, smithy_client_1.throwDefaultError)({
1987
+ output,
1988
+ parsedBody,
1989
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
1990
+ errorCode,
2146
1991
  });
2147
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2148
1992
  }
2149
1993
  };
2150
1994
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2151
1995
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2152
1996
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2153
1997
  }
2154
- const contents = {
1998
+ const contents = map({
2155
1999
  $metadata: deserializeMetadata(output),
2156
- };
2000
+ });
2157
2001
  await collectBody(output.body, context);
2158
- return Promise.resolve(contents);
2002
+ return contents;
2159
2003
  };
2160
2004
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2161
2005
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2163,7 +2007,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2163
2007
  ...output,
2164
2008
  body: await parseBody(output.body, context),
2165
2009
  };
2166
- let response;
2167
2010
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2168
2011
  switch (errorCode) {
2169
2012
  case "BadRequestException":
@@ -2183,25 +2026,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2183
2026
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2184
2027
  default:
2185
2028
  const parsedBody = parsedOutput.body;
2186
- const $metadata = deserializeMetadata(output);
2187
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2188
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
2189
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2190
- $fault: "client",
2191
- $metadata,
2029
+ (0, smithy_client_1.throwDefaultError)({
2030
+ output,
2031
+ parsedBody,
2032
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
2033
+ errorCode,
2192
2034
  });
2193
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2194
2035
  }
2195
2036
  };
2196
2037
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2197
2038
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2198
2039
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2199
2040
  }
2200
- const contents = {
2041
+ const contents = map({
2201
2042
  $metadata: deserializeMetadata(output),
2202
- };
2043
+ });
2203
2044
  await collectBody(output.body, context);
2204
- return Promise.resolve(contents);
2045
+ return contents;
2205
2046
  };
2206
2047
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2207
2048
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2209,7 +2050,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2209
2050
  ...output,
2210
2051
  body: await parseBody(output.body, context),
2211
2052
  };
2212
- let response;
2213
2053
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2214
2054
  switch (errorCode) {
2215
2055
  case "InternalServerException":
@@ -2226,25 +2066,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2226
2066
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2227
2067
  default:
2228
2068
  const parsedBody = parsedOutput.body;
2229
- const $metadata = deserializeMetadata(output);
2230
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2231
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
2232
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2233
- $fault: "client",
2234
- $metadata,
2069
+ (0, smithy_client_1.throwDefaultError)({
2070
+ output,
2071
+ parsedBody,
2072
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
2073
+ errorCode,
2235
2074
  });
2236
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2237
2075
  }
2238
2076
  };
2239
2077
  const deserializeAws_restJson1UpdateConfigurationCommand = async (output, context) => {
2240
2078
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2241
2079
  return deserializeAws_restJson1UpdateConfigurationCommandError(output, context);
2242
2080
  }
2243
- const contents = {
2081
+ const contents = map({
2244
2082
  $metadata: deserializeMetadata(output),
2245
- };
2083
+ });
2246
2084
  await collectBody(output.body, context);
2247
- return Promise.resolve(contents);
2085
+ return contents;
2248
2086
  };
2249
2087
  exports.deserializeAws_restJson1UpdateConfigurationCommand = deserializeAws_restJson1UpdateConfigurationCommand;
2250
2088
  const deserializeAws_restJson1UpdateConfigurationCommandError = async (output, context) => {
@@ -2252,7 +2090,6 @@ const deserializeAws_restJson1UpdateConfigurationCommandError = async (output, c
2252
2090
  ...output,
2253
2091
  body: await parseBody(output.body, context),
2254
2092
  };
2255
- let response;
2256
2093
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2257
2094
  switch (errorCode) {
2258
2095
  case "AccessDeniedException":
@@ -2269,29 +2106,26 @@ const deserializeAws_restJson1UpdateConfigurationCommandError = async (output, c
2269
2106
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2270
2107
  default:
2271
2108
  const parsedBody = parsedOutput.body;
2272
- const $metadata = deserializeMetadata(output);
2273
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2274
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
2275
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2276
- $fault: "client",
2277
- $metadata,
2109
+ (0, smithy_client_1.throwDefaultError)({
2110
+ output,
2111
+ parsedBody,
2112
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
2113
+ errorCode,
2278
2114
  });
2279
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2280
2115
  }
2281
2116
  };
2282
2117
  const deserializeAws_restJson1UpdateFilterCommand = async (output, context) => {
2283
2118
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2284
2119
  return deserializeAws_restJson1UpdateFilterCommandError(output, context);
2285
2120
  }
2286
- const contents = {
2121
+ const contents = map({
2287
2122
  $metadata: deserializeMetadata(output),
2288
- arn: undefined,
2289
- };
2123
+ });
2290
2124
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2291
- if (data.arn !== undefined && data.arn !== null) {
2125
+ if (data.arn != null) {
2292
2126
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
2293
2127
  }
2294
- return Promise.resolve(contents);
2128
+ return contents;
2295
2129
  };
2296
2130
  exports.deserializeAws_restJson1UpdateFilterCommand = deserializeAws_restJson1UpdateFilterCommand;
2297
2131
  const deserializeAws_restJson1UpdateFilterCommandError = async (output, context) => {
@@ -2299,7 +2133,6 @@ const deserializeAws_restJson1UpdateFilterCommandError = async (output, context)
2299
2133
  ...output,
2300
2134
  body: await parseBody(output.body, context),
2301
2135
  };
2302
- let response;
2303
2136
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2304
2137
  switch (errorCode) {
2305
2138
  case "AccessDeniedException":
@@ -2319,29 +2152,26 @@ const deserializeAws_restJson1UpdateFilterCommandError = async (output, context)
2319
2152
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2320
2153
  default:
2321
2154
  const parsedBody = parsedOutput.body;
2322
- const $metadata = deserializeMetadata(output);
2323
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2324
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
2325
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2326
- $fault: "client",
2327
- $metadata,
2155
+ (0, smithy_client_1.throwDefaultError)({
2156
+ output,
2157
+ parsedBody,
2158
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
2159
+ errorCode,
2328
2160
  });
2329
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2330
2161
  }
2331
2162
  };
2332
2163
  const deserializeAws_restJson1UpdateOrganizationConfigurationCommand = async (output, context) => {
2333
2164
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2334
2165
  return deserializeAws_restJson1UpdateOrganizationConfigurationCommandError(output, context);
2335
2166
  }
2336
- const contents = {
2167
+ const contents = map({
2337
2168
  $metadata: deserializeMetadata(output),
2338
- autoEnable: undefined,
2339
- };
2169
+ });
2340
2170
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2341
- if (data.autoEnable !== undefined && data.autoEnable !== null) {
2171
+ if (data.autoEnable != null) {
2342
2172
  contents.autoEnable = deserializeAws_restJson1AutoEnable(data.autoEnable, context);
2343
2173
  }
2344
- return Promise.resolve(contents);
2174
+ return contents;
2345
2175
  };
2346
2176
  exports.deserializeAws_restJson1UpdateOrganizationConfigurationCommand = deserializeAws_restJson1UpdateOrganizationConfigurationCommand;
2347
2177
  const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = async (output, context) => {
@@ -2349,7 +2179,6 @@ const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = asyn
2349
2179
  ...output,
2350
2180
  body: await parseBody(output.body, context),
2351
2181
  };
2352
- let response;
2353
2182
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2354
2183
  switch (errorCode) {
2355
2184
  case "AccessDeniedException":
@@ -2366,20 +2195,19 @@ const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = asyn
2366
2195
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2367
2196
  default:
2368
2197
  const parsedBody = parsedOutput.body;
2369
- const $metadata = deserializeMetadata(output);
2370
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2371
- response = new Inspector2ServiceException_1.Inspector2ServiceException({
2372
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2373
- $fault: "client",
2374
- $metadata,
2198
+ (0, smithy_client_1.throwDefaultError)({
2199
+ output,
2200
+ parsedBody,
2201
+ exceptionCtor: Inspector2ServiceException_1.Inspector2ServiceException,
2202
+ errorCode,
2375
2203
  });
2376
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2377
2204
  }
2378
2205
  };
2206
+ const map = smithy_client_1.map;
2379
2207
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2380
- const contents = {};
2208
+ const contents = map({});
2381
2209
  const data = parsedOutput.body;
2382
- if (data.message !== undefined && data.message !== null) {
2210
+ if (data.message != null) {
2383
2211
  contents.message = (0, smithy_client_1.expectString)(data.message);
2384
2212
  }
2385
2213
  const exception = new models_0_1.AccessDeniedException({
@@ -2389,9 +2217,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
2389
2217
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2390
2218
  };
2391
2219
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
2392
- const contents = {};
2220
+ const contents = map({});
2393
2221
  const data = parsedOutput.body;
2394
- if (data.message !== undefined && data.message !== null) {
2222
+ if (data.message != null) {
2395
2223
  contents.message = (0, smithy_client_1.expectString)(data.message);
2396
2224
  }
2397
2225
  const exception = new models_0_1.BadRequestException({
@@ -2401,15 +2229,15 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
2401
2229
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2402
2230
  };
2403
2231
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2404
- const contents = {};
2232
+ const contents = map({});
2405
2233
  const data = parsedOutput.body;
2406
- if (data.message !== undefined && data.message !== null) {
2234
+ if (data.message != null) {
2407
2235
  contents.message = (0, smithy_client_1.expectString)(data.message);
2408
2236
  }
2409
- if (data.resourceId !== undefined && data.resourceId !== null) {
2237
+ if (data.resourceId != null) {
2410
2238
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2411
2239
  }
2412
- if (data.resourceType !== undefined && data.resourceType !== null) {
2240
+ if (data.resourceType != null) {
2413
2241
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2414
2242
  }
2415
2243
  const exception = new models_0_1.ConflictException({
@@ -2419,12 +2247,14 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2419
2247
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2420
2248
  };
2421
2249
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
2422
- const contents = {};
2423
- if (parsedOutput.headers["retry-after"] !== undefined) {
2424
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
2425
- }
2250
+ const contents = map({
2251
+ retryAfterSeconds: [
2252
+ () => void 0 !== parsedOutput.headers["retry-after"],
2253
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
2254
+ ],
2255
+ });
2426
2256
  const data = parsedOutput.body;
2427
- if (data.message !== undefined && data.message !== null) {
2257
+ if (data.message != null) {
2428
2258
  contents.message = (0, smithy_client_1.expectString)(data.message);
2429
2259
  }
2430
2260
  const exception = new models_0_1.InternalServerException({
@@ -2434,9 +2264,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
2434
2264
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2435
2265
  };
2436
2266
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2437
- const contents = {};
2267
+ const contents = map({});
2438
2268
  const data = parsedOutput.body;
2439
- if (data.message !== undefined && data.message !== null) {
2269
+ if (data.message != null) {
2440
2270
  contents.message = (0, smithy_client_1.expectString)(data.message);
2441
2271
  }
2442
2272
  const exception = new models_0_1.ResourceNotFoundException({
@@ -2446,12 +2276,12 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
2446
2276
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2447
2277
  };
2448
2278
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2449
- const contents = {};
2279
+ const contents = map({});
2450
2280
  const data = parsedOutput.body;
2451
- if (data.message !== undefined && data.message !== null) {
2281
+ if (data.message != null) {
2452
2282
  contents.message = (0, smithy_client_1.expectString)(data.message);
2453
2283
  }
2454
- if (data.resourceId !== undefined && data.resourceId !== null) {
2284
+ if (data.resourceId != null) {
2455
2285
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2456
2286
  }
2457
2287
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -2461,9 +2291,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
2461
2291
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2462
2292
  };
2463
2293
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
2464
- const contents = {};
2294
+ const contents = map({});
2465
2295
  const data = parsedOutput.body;
2466
- if (data.message !== undefined && data.message !== null) {
2296
+ if (data.message != null) {
2467
2297
  contents.message = (0, smithy_client_1.expectString)(data.message);
2468
2298
  }
2469
2299
  const exception = new models_0_1.ThrottlingException({
@@ -2473,15 +2303,15 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
2473
2303
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2474
2304
  };
2475
2305
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2476
- const contents = {};
2306
+ const contents = map({});
2477
2307
  const data = parsedOutput.body;
2478
- if (data.fields !== undefined && data.fields !== null) {
2308
+ if (data.fields != null) {
2479
2309
  contents.fields = deserializeAws_restJson1ValidationExceptionFields(data.fields, context);
2480
2310
  }
2481
- if (data.message !== undefined && data.message !== null) {
2311
+ if (data.message != null) {
2482
2312
  contents.message = (0, smithy_client_1.expectString)(data.message);
2483
2313
  }
2484
- if (data.reason !== undefined && data.reason !== null) {
2314
+ if (data.reason != null) {
2485
2315
  contents.reason = (0, smithy_client_1.expectString)(data.reason);
2486
2316
  }
2487
2317
  const exception = new models_0_1.ValidationException({
@@ -2502,9 +2332,6 @@ const serializeAws_restJson1AccountIdSet = (input, context) => {
2502
2332
  return input
2503
2333
  .filter((e) => e != null)
2504
2334
  .map((entry) => {
2505
- if (entry === null) {
2506
- return null;
2507
- }
2508
2335
  return entry;
2509
2336
  });
2510
2337
  };
@@ -2604,9 +2431,6 @@ const serializeAws_restJson1CoverageMapFilterList = (input, context) => {
2604
2431
  return input
2605
2432
  .filter((e) => e != null)
2606
2433
  .map((entry) => {
2607
- if (entry === null) {
2608
- return null;
2609
- }
2610
2434
  return serializeAws_restJson1CoverageMapFilter(entry, context);
2611
2435
  });
2612
2436
  };
@@ -2620,9 +2444,6 @@ const serializeAws_restJson1CoverageStringFilterList = (input, context) => {
2620
2444
  return input
2621
2445
  .filter((e) => e != null)
2622
2446
  .map((entry) => {
2623
- if (entry === null) {
2624
- return null;
2625
- }
2626
2447
  return serializeAws_restJson1CoverageStringFilter(entry, context);
2627
2448
  });
2628
2449
  };
@@ -2636,9 +2457,6 @@ const serializeAws_restJson1DateFilterList = (input, context) => {
2636
2457
  return input
2637
2458
  .filter((e) => e != null)
2638
2459
  .map((entry) => {
2639
- if (entry === null) {
2640
- return null;
2641
- }
2642
2460
  return serializeAws_restJson1DateFilter(entry, context);
2643
2461
  });
2644
2462
  };
@@ -2653,9 +2471,6 @@ const serializeAws_restJson1DisableResourceTypeList = (input, context) => {
2653
2471
  return input
2654
2472
  .filter((e) => e != null)
2655
2473
  .map((entry) => {
2656
- if (entry === null) {
2657
- return null;
2658
- }
2659
2474
  return entry;
2660
2475
  });
2661
2476
  };
@@ -2684,9 +2499,6 @@ const serializeAws_restJson1EnableResourceTypeList = (input, context) => {
2684
2499
  return input
2685
2500
  .filter((e) => e != null)
2686
2501
  .map((entry) => {
2687
- if (entry === null) {
2688
- return null;
2689
- }
2690
2502
  return entry;
2691
2503
  });
2692
2504
  };
@@ -2694,9 +2506,6 @@ const serializeAws_restJson1FilterArnList = (input, context) => {
2694
2506
  return input
2695
2507
  .filter((e) => e != null)
2696
2508
  .map((entry) => {
2697
- if (entry === null) {
2698
- return null;
2699
- }
2700
2509
  return entry;
2701
2510
  });
2702
2511
  };
@@ -2819,9 +2628,6 @@ const serializeAws_restJson1MapFilterList = (input, context) => {
2819
2628
  return input
2820
2629
  .filter((e) => e != null)
2821
2630
  .map((entry) => {
2822
- if (entry === null) {
2823
- return null;
2824
- }
2825
2631
  return serializeAws_restJson1MapFilter(entry, context);
2826
2632
  });
2827
2633
  };
@@ -2829,9 +2635,6 @@ const serializeAws_restJson1MeteringAccountIdList = (input, context) => {
2829
2635
  return input
2830
2636
  .filter((e) => e != null)
2831
2637
  .map((entry) => {
2832
- if (entry === null) {
2833
- return null;
2834
- }
2835
2638
  return entry;
2836
2639
  });
2837
2640
  };
@@ -2845,9 +2648,6 @@ const serializeAws_restJson1NumberFilterList = (input, context) => {
2845
2648
  return input
2846
2649
  .filter((e) => e != null)
2847
2650
  .map((entry) => {
2848
- if (entry === null) {
2849
- return null;
2850
- }
2851
2651
  return serializeAws_restJson1NumberFilter(entry, context);
2852
2652
  });
2853
2653
  };
@@ -2878,9 +2678,6 @@ const serializeAws_restJson1PackageFilterList = (input, context) => {
2878
2678
  return input
2879
2679
  .filter((e) => e != null)
2880
2680
  .map((entry) => {
2881
- if (entry === null) {
2882
- return null;
2883
- }
2884
2681
  return serializeAws_restJson1PackageFilter(entry, context);
2885
2682
  });
2886
2683
  };
@@ -2894,9 +2691,6 @@ const serializeAws_restJson1PortRangeFilterList = (input, context) => {
2894
2691
  return input
2895
2692
  .filter((e) => e != null)
2896
2693
  .map((entry) => {
2897
- if (entry === null) {
2898
- return null;
2899
- }
2900
2694
  return serializeAws_restJson1PortRangeFilter(entry, context);
2901
2695
  });
2902
2696
  };
@@ -2925,9 +2719,6 @@ const serializeAws_restJson1StringFilterList = (input, context) => {
2925
2719
  return input
2926
2720
  .filter((e) => e != null)
2927
2721
  .map((entry) => {
2928
- if (entry === null) {
2929
- return null;
2930
- }
2931
2722
  return serializeAws_restJson1StringFilter(entry, context);
2932
2723
  });
2933
2724
  };
@@ -2957,9 +2748,6 @@ const serializeAws_restJson1UsageAccountIdList = (input, context) => {
2957
2748
  return input
2958
2749
  .filter((e) => e != null)
2959
2750
  .map((entry) => {
2960
- if (entry === null) {
2961
- return null;
2962
- }
2963
2751
  return entry;
2964
2752
  });
2965
2753
  };
@@ -3010,47 +2798,47 @@ const deserializeAws_restJson1AccountStateList = (output, context) => {
3010
2798
  return retVal;
3011
2799
  };
3012
2800
  const deserializeAws_restJson1AggregationResponse = (output, context) => {
3013
- if (output.accountAggregation !== undefined && output.accountAggregation !== null) {
2801
+ if (output.accountAggregation != null) {
3014
2802
  return {
3015
2803
  accountAggregation: deserializeAws_restJson1AccountAggregationResponse(output.accountAggregation, context),
3016
2804
  };
3017
2805
  }
3018
- if (output.amiAggregation !== undefined && output.amiAggregation !== null) {
2806
+ if (output.amiAggregation != null) {
3019
2807
  return {
3020
2808
  amiAggregation: deserializeAws_restJson1AmiAggregationResponse(output.amiAggregation, context),
3021
2809
  };
3022
2810
  }
3023
- if (output.awsEcrContainerAggregation !== undefined && output.awsEcrContainerAggregation !== null) {
2811
+ if (output.awsEcrContainerAggregation != null) {
3024
2812
  return {
3025
2813
  awsEcrContainerAggregation: deserializeAws_restJson1AwsEcrContainerAggregationResponse(output.awsEcrContainerAggregation, context),
3026
2814
  };
3027
2815
  }
3028
- if (output.ec2InstanceAggregation !== undefined && output.ec2InstanceAggregation !== null) {
2816
+ if (output.ec2InstanceAggregation != null) {
3029
2817
  return {
3030
2818
  ec2InstanceAggregation: deserializeAws_restJson1Ec2InstanceAggregationResponse(output.ec2InstanceAggregation, context),
3031
2819
  };
3032
2820
  }
3033
- if (output.findingTypeAggregation !== undefined && output.findingTypeAggregation !== null) {
2821
+ if (output.findingTypeAggregation != null) {
3034
2822
  return {
3035
2823
  findingTypeAggregation: deserializeAws_restJson1FindingTypeAggregationResponse(output.findingTypeAggregation, context),
3036
2824
  };
3037
2825
  }
3038
- if (output.imageLayerAggregation !== undefined && output.imageLayerAggregation !== null) {
2826
+ if (output.imageLayerAggregation != null) {
3039
2827
  return {
3040
2828
  imageLayerAggregation: deserializeAws_restJson1ImageLayerAggregationResponse(output.imageLayerAggregation, context),
3041
2829
  };
3042
2830
  }
3043
- if (output.packageAggregation !== undefined && output.packageAggregation !== null) {
2831
+ if (output.packageAggregation != null) {
3044
2832
  return {
3045
2833
  packageAggregation: deserializeAws_restJson1PackageAggregationResponse(output.packageAggregation, context),
3046
2834
  };
3047
2835
  }
3048
- if (output.repositoryAggregation !== undefined && output.repositoryAggregation !== null) {
2836
+ if (output.repositoryAggregation != null) {
3049
2837
  return {
3050
2838
  repositoryAggregation: deserializeAws_restJson1RepositoryAggregationResponse(output.repositoryAggregation, context),
3051
2839
  };
3052
2840
  }
3053
- if (output.titleAggregation !== undefined && output.titleAggregation !== null) {
2841
+ if (output.titleAggregation != null) {
3054
2842
  return {
3055
2843
  titleAggregation: deserializeAws_restJson1TitleAggregationResponse(output.titleAggregation, context),
3056
2844
  };