@aws-sdk/client-resiliencehub 3.137.0 → 3.145.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.
@@ -395,18 +395,19 @@ const serializeAws_restJson1ListAppAssessmentsCommand = async (input, context) =
395
395
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
396
396
  const headers = {};
397
397
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-app-assessments";
398
- const query = {
399
- ...(input.appArn !== undefined && { appArn: input.appArn }),
400
- ...(input.assessmentName !== undefined && { assessmentName: input.assessmentName }),
401
- ...(input.assessmentStatus !== undefined && {
402
- assessmentStatus: (input.assessmentStatus || []).map((_entry) => _entry),
403
- }),
404
- ...(input.complianceStatus !== undefined && { complianceStatus: input.complianceStatus }),
405
- ...(input.invoker !== undefined && { invoker: input.invoker }),
406
- ...(input.reverseOrder !== undefined && { reverseOrder: input.reverseOrder.toString() }),
407
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
408
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
409
- };
398
+ const query = map({
399
+ appArn: [, input.appArn],
400
+ assessmentName: [, input.assessmentName],
401
+ assessmentStatus: [
402
+ () => input.assessmentStatus !== void 0,
403
+ () => (input.assessmentStatus || []).map((_entry) => _entry),
404
+ ],
405
+ complianceStatus: [, input.complianceStatus],
406
+ invoker: [, input.invoker],
407
+ reverseOrder: [() => input.reverseOrder !== void 0, () => input.reverseOrder.toString()],
408
+ nextToken: [, input.nextToken],
409
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
410
+ });
410
411
  let body;
411
412
  return new protocol_http_1.HttpRequest({
412
413
  protocol,
@@ -470,12 +471,12 @@ const serializeAws_restJson1ListAppsCommand = async (input, context) => {
470
471
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
471
472
  const headers = {};
472
473
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-apps";
473
- const query = {
474
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
475
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
476
- ...(input.name !== undefined && { name: input.name }),
477
- ...(input.appArn !== undefined && { appArn: input.appArn }),
478
- };
474
+ const query = map({
475
+ nextToken: [, input.nextToken],
476
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
477
+ name: [, input.name],
478
+ appArn: [, input.appArn],
479
+ });
479
480
  let body;
480
481
  return new protocol_http_1.HttpRequest({
481
482
  protocol,
@@ -565,17 +566,15 @@ const serializeAws_restJson1ListRecommendationTemplatesCommand = async (input, c
565
566
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
566
567
  const headers = {};
567
568
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-recommendation-templates";
568
- const query = {
569
- ...(input.assessmentArn !== undefined && { assessmentArn: input.assessmentArn }),
570
- ...(input.reverseOrder !== undefined && { reverseOrder: input.reverseOrder.toString() }),
571
- ...(input.status !== undefined && { status: (input.status || []).map((_entry) => _entry) }),
572
- ...(input.recommendationTemplateArn !== undefined && {
573
- recommendationTemplateArn: input.recommendationTemplateArn,
574
- }),
575
- ...(input.name !== undefined && { name: input.name }),
576
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
577
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
578
- };
569
+ const query = map({
570
+ assessmentArn: [, input.assessmentArn],
571
+ reverseOrder: [() => input.reverseOrder !== void 0, () => input.reverseOrder.toString()],
572
+ status: [() => input.status !== void 0, () => (input.status || []).map((_entry) => _entry)],
573
+ recommendationTemplateArn: [, input.recommendationTemplateArn],
574
+ name: [, input.name],
575
+ nextToken: [, input.nextToken],
576
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
577
+ });
579
578
  let body;
580
579
  return new protocol_http_1.HttpRequest({
581
580
  protocol,
@@ -593,11 +592,11 @@ const serializeAws_restJson1ListResiliencyPoliciesCommand = async (input, contex
593
592
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
594
593
  const headers = {};
595
594
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-resiliency-policies";
596
- const query = {
597
- ...(input.policyName !== undefined && { policyName: input.policyName }),
598
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
599
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
600
- };
595
+ const query = map({
596
+ policyName: [, input.policyName],
597
+ nextToken: [, input.nextToken],
598
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
599
+ });
601
600
  let body;
602
601
  return new protocol_http_1.HttpRequest({
603
602
  protocol,
@@ -638,10 +637,10 @@ const serializeAws_restJson1ListSuggestedResiliencyPoliciesCommand = async (inpu
638
637
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
639
638
  const headers = {};
640
639
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-suggested-resiliency-policies";
641
- const query = {
642
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
643
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
644
- };
640
+ const query = map({
641
+ nextToken: [, input.nextToken],
642
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
643
+ });
645
644
  let body;
646
645
  return new protocol_http_1.HttpRequest({
647
646
  protocol,
@@ -659,16 +658,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
659
658
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
660
659
  const headers = {};
661
660
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
662
- if (input.resourceArn !== undefined) {
663
- const labelValue = input.resourceArn;
664
- if (labelValue.length <= 0) {
665
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
666
- }
667
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
668
- }
669
- else {
670
- throw new Error("No value provided for input HTTP label: resourceArn.");
671
- }
661
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
672
662
  let body;
673
663
  return new protocol_http_1.HttpRequest({
674
664
  protocol,
@@ -863,16 +853,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
863
853
  "content-type": "application/json",
864
854
  };
865
855
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
866
- if (input.resourceArn !== undefined) {
867
- const labelValue = input.resourceArn;
868
- if (labelValue.length <= 0) {
869
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
870
- }
871
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
872
- }
873
- else {
874
- throw new Error("No value provided for input HTTP label: resourceArn.");
875
- }
856
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
876
857
  let body;
877
858
  body = JSON.stringify({
878
859
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -892,19 +873,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
892
873
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
893
874
  const headers = {};
894
875
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
895
- if (input.resourceArn !== undefined) {
896
- const labelValue = input.resourceArn;
897
- if (labelValue.length <= 0) {
898
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
899
- }
900
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
901
- }
902
- else {
903
- throw new Error("No value provided for input HTTP label: resourceArn.");
904
- }
905
- const query = {
906
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
907
- };
876
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
877
+ const query = map({
878
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
879
+ });
908
880
  let body;
909
881
  return new protocol_http_1.HttpRequest({
910
882
  protocol,
@@ -973,23 +945,20 @@ const deserializeAws_restJson1AddDraftAppVersionResourceMappingsCommand = async
973
945
  if (output.statusCode !== 200 && output.statusCode >= 300) {
974
946
  return deserializeAws_restJson1AddDraftAppVersionResourceMappingsCommandError(output, context);
975
947
  }
976
- const contents = {
948
+ const contents = map({
977
949
  $metadata: deserializeMetadata(output),
978
- appArn: undefined,
979
- appVersion: undefined,
980
- resourceMappings: undefined,
981
- };
950
+ });
982
951
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
983
- if (data.appArn !== undefined && data.appArn !== null) {
952
+ if (data.appArn != null) {
984
953
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
985
954
  }
986
- if (data.appVersion !== undefined && data.appVersion !== null) {
955
+ if (data.appVersion != null) {
987
956
  contents.appVersion = (0, smithy_client_1.expectString)(data.appVersion);
988
957
  }
989
- if (data.resourceMappings !== undefined && data.resourceMappings !== null) {
958
+ if (data.resourceMappings != null) {
990
959
  contents.resourceMappings = deserializeAws_restJson1ResourceMappingList(data.resourceMappings, context);
991
960
  }
992
- return Promise.resolve(contents);
961
+ return contents;
993
962
  };
994
963
  exports.deserializeAws_restJson1AddDraftAppVersionResourceMappingsCommand = deserializeAws_restJson1AddDraftAppVersionResourceMappingsCommand;
995
964
  const deserializeAws_restJson1AddDraftAppVersionResourceMappingsCommandError = async (output, context) => {
@@ -997,7 +966,6 @@ const deserializeAws_restJson1AddDraftAppVersionResourceMappingsCommandError = a
997
966
  ...output,
998
967
  body: await parseBody(output.body, context),
999
968
  };
1000
- let response;
1001
969
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1002
970
  switch (errorCode) {
1003
971
  case "AccessDeniedException":
@@ -1020,29 +988,26 @@ const deserializeAws_restJson1AddDraftAppVersionResourceMappingsCommandError = a
1020
988
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1021
989
  default:
1022
990
  const parsedBody = parsedOutput.body;
1023
- const $metadata = deserializeMetadata(output);
1024
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1025
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1026
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1027
- $fault: "client",
1028
- $metadata,
991
+ (0, smithy_client_1.throwDefaultError)({
992
+ output,
993
+ parsedBody,
994
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
995
+ errorCode,
1029
996
  });
1030
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1031
997
  }
1032
998
  };
1033
999
  const deserializeAws_restJson1CreateAppCommand = async (output, context) => {
1034
1000
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1035
1001
  return deserializeAws_restJson1CreateAppCommandError(output, context);
1036
1002
  }
1037
- const contents = {
1003
+ const contents = map({
1038
1004
  $metadata: deserializeMetadata(output),
1039
- app: undefined,
1040
- };
1005
+ });
1041
1006
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1042
- if (data.app !== undefined && data.app !== null) {
1007
+ if (data.app != null) {
1043
1008
  contents.app = deserializeAws_restJson1App(data.app, context);
1044
1009
  }
1045
- return Promise.resolve(contents);
1010
+ return contents;
1046
1011
  };
1047
1012
  exports.deserializeAws_restJson1CreateAppCommand = deserializeAws_restJson1CreateAppCommand;
1048
1013
  const deserializeAws_restJson1CreateAppCommandError = async (output, context) => {
@@ -1050,7 +1015,6 @@ const deserializeAws_restJson1CreateAppCommandError = async (output, context) =>
1050
1015
  ...output,
1051
1016
  body: await parseBody(output.body, context),
1052
1017
  };
1053
- let response;
1054
1018
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1055
1019
  switch (errorCode) {
1056
1020
  case "AccessDeniedException":
@@ -1076,29 +1040,26 @@ const deserializeAws_restJson1CreateAppCommandError = async (output, context) =>
1076
1040
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1077
1041
  default:
1078
1042
  const parsedBody = parsedOutput.body;
1079
- const $metadata = deserializeMetadata(output);
1080
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1081
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1082
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1083
- $fault: "client",
1084
- $metadata,
1043
+ (0, smithy_client_1.throwDefaultError)({
1044
+ output,
1045
+ parsedBody,
1046
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1047
+ errorCode,
1085
1048
  });
1086
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1087
1049
  }
1088
1050
  };
1089
1051
  const deserializeAws_restJson1CreateRecommendationTemplateCommand = async (output, context) => {
1090
1052
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1091
1053
  return deserializeAws_restJson1CreateRecommendationTemplateCommandError(output, context);
1092
1054
  }
1093
- const contents = {
1055
+ const contents = map({
1094
1056
  $metadata: deserializeMetadata(output),
1095
- recommendationTemplate: undefined,
1096
- };
1057
+ });
1097
1058
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1098
- if (data.recommendationTemplate !== undefined && data.recommendationTemplate !== null) {
1059
+ if (data.recommendationTemplate != null) {
1099
1060
  contents.recommendationTemplate = deserializeAws_restJson1RecommendationTemplate(data.recommendationTemplate, context);
1100
1061
  }
1101
- return Promise.resolve(contents);
1062
+ return contents;
1102
1063
  };
1103
1064
  exports.deserializeAws_restJson1CreateRecommendationTemplateCommand = deserializeAws_restJson1CreateRecommendationTemplateCommand;
1104
1065
  const deserializeAws_restJson1CreateRecommendationTemplateCommandError = async (output, context) => {
@@ -1106,7 +1067,6 @@ const deserializeAws_restJson1CreateRecommendationTemplateCommandError = async (
1106
1067
  ...output,
1107
1068
  body: await parseBody(output.body, context),
1108
1069
  };
1109
- let response;
1110
1070
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1111
1071
  switch (errorCode) {
1112
1072
  case "AccessDeniedException":
@@ -1129,29 +1089,26 @@ const deserializeAws_restJson1CreateRecommendationTemplateCommandError = async (
1129
1089
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1130
1090
  default:
1131
1091
  const parsedBody = parsedOutput.body;
1132
- const $metadata = deserializeMetadata(output);
1133
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1134
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1135
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1136
- $fault: "client",
1137
- $metadata,
1092
+ (0, smithy_client_1.throwDefaultError)({
1093
+ output,
1094
+ parsedBody,
1095
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1096
+ errorCode,
1138
1097
  });
1139
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1140
1098
  }
1141
1099
  };
1142
1100
  const deserializeAws_restJson1CreateResiliencyPolicyCommand = async (output, context) => {
1143
1101
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1144
1102
  return deserializeAws_restJson1CreateResiliencyPolicyCommandError(output, context);
1145
1103
  }
1146
- const contents = {
1104
+ const contents = map({
1147
1105
  $metadata: deserializeMetadata(output),
1148
- policy: undefined,
1149
- };
1106
+ });
1150
1107
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1151
- if (data.policy !== undefined && data.policy !== null) {
1108
+ if (data.policy != null) {
1152
1109
  contents.policy = deserializeAws_restJson1ResiliencyPolicy(data.policy, context);
1153
1110
  }
1154
- return Promise.resolve(contents);
1111
+ return contents;
1155
1112
  };
1156
1113
  exports.deserializeAws_restJson1CreateResiliencyPolicyCommand = deserializeAws_restJson1CreateResiliencyPolicyCommand;
1157
1114
  const deserializeAws_restJson1CreateResiliencyPolicyCommandError = async (output, context) => {
@@ -1159,7 +1116,6 @@ const deserializeAws_restJson1CreateResiliencyPolicyCommandError = async (output
1159
1116
  ...output,
1160
1117
  body: await parseBody(output.body, context),
1161
1118
  };
1162
- let response;
1163
1119
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1164
1120
  switch (errorCode) {
1165
1121
  case "AccessDeniedException":
@@ -1182,29 +1138,26 @@ const deserializeAws_restJson1CreateResiliencyPolicyCommandError = async (output
1182
1138
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1183
1139
  default:
1184
1140
  const parsedBody = parsedOutput.body;
1185
- const $metadata = deserializeMetadata(output);
1186
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1187
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1188
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1189
- $fault: "client",
1190
- $metadata,
1141
+ (0, smithy_client_1.throwDefaultError)({
1142
+ output,
1143
+ parsedBody,
1144
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1145
+ errorCode,
1191
1146
  });
1192
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1193
1147
  }
1194
1148
  };
1195
1149
  const deserializeAws_restJson1DeleteAppCommand = async (output, context) => {
1196
1150
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1197
1151
  return deserializeAws_restJson1DeleteAppCommandError(output, context);
1198
1152
  }
1199
- const contents = {
1153
+ const contents = map({
1200
1154
  $metadata: deserializeMetadata(output),
1201
- appArn: undefined,
1202
- };
1155
+ });
1203
1156
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1204
- if (data.appArn !== undefined && data.appArn !== null) {
1157
+ if (data.appArn != null) {
1205
1158
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
1206
1159
  }
1207
- return Promise.resolve(contents);
1160
+ return contents;
1208
1161
  };
1209
1162
  exports.deserializeAws_restJson1DeleteAppCommand = deserializeAws_restJson1DeleteAppCommand;
1210
1163
  const deserializeAws_restJson1DeleteAppCommandError = async (output, context) => {
@@ -1212,7 +1165,6 @@ const deserializeAws_restJson1DeleteAppCommandError = async (output, context) =>
1212
1165
  ...output,
1213
1166
  body: await parseBody(output.body, context),
1214
1167
  };
1215
- let response;
1216
1168
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1217
1169
  switch (errorCode) {
1218
1170
  case "ConflictException":
@@ -1232,33 +1184,29 @@ const deserializeAws_restJson1DeleteAppCommandError = async (output, context) =>
1232
1184
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1233
1185
  default:
1234
1186
  const parsedBody = parsedOutput.body;
1235
- const $metadata = deserializeMetadata(output);
1236
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1237
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1238
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1239
- $fault: "client",
1240
- $metadata,
1187
+ (0, smithy_client_1.throwDefaultError)({
1188
+ output,
1189
+ parsedBody,
1190
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1191
+ errorCode,
1241
1192
  });
1242
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1243
1193
  }
1244
1194
  };
1245
1195
  const deserializeAws_restJson1DeleteAppAssessmentCommand = async (output, context) => {
1246
1196
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1247
1197
  return deserializeAws_restJson1DeleteAppAssessmentCommandError(output, context);
1248
1198
  }
1249
- const contents = {
1199
+ const contents = map({
1250
1200
  $metadata: deserializeMetadata(output),
1251
- assessmentArn: undefined,
1252
- assessmentStatus: undefined,
1253
- };
1201
+ });
1254
1202
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1255
- if (data.assessmentArn !== undefined && data.assessmentArn !== null) {
1203
+ if (data.assessmentArn != null) {
1256
1204
  contents.assessmentArn = (0, smithy_client_1.expectString)(data.assessmentArn);
1257
1205
  }
1258
- if (data.assessmentStatus !== undefined && data.assessmentStatus !== null) {
1206
+ if (data.assessmentStatus != null) {
1259
1207
  contents.assessmentStatus = (0, smithy_client_1.expectString)(data.assessmentStatus);
1260
1208
  }
1261
- return Promise.resolve(contents);
1209
+ return contents;
1262
1210
  };
1263
1211
  exports.deserializeAws_restJson1DeleteAppAssessmentCommand = deserializeAws_restJson1DeleteAppAssessmentCommand;
1264
1212
  const deserializeAws_restJson1DeleteAppAssessmentCommandError = async (output, context) => {
@@ -1266,7 +1214,6 @@ const deserializeAws_restJson1DeleteAppAssessmentCommandError = async (output, c
1266
1214
  ...output,
1267
1215
  body: await parseBody(output.body, context),
1268
1216
  };
1269
- let response;
1270
1217
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1271
1218
  switch (errorCode) {
1272
1219
  case "AccessDeniedException":
@@ -1289,33 +1236,29 @@ const deserializeAws_restJson1DeleteAppAssessmentCommandError = async (output, c
1289
1236
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1290
1237
  default:
1291
1238
  const parsedBody = parsedOutput.body;
1292
- const $metadata = deserializeMetadata(output);
1293
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1294
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1295
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1296
- $fault: "client",
1297
- $metadata,
1239
+ (0, smithy_client_1.throwDefaultError)({
1240
+ output,
1241
+ parsedBody,
1242
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1243
+ errorCode,
1298
1244
  });
1299
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1300
1245
  }
1301
1246
  };
1302
1247
  const deserializeAws_restJson1DeleteRecommendationTemplateCommand = async (output, context) => {
1303
1248
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1304
1249
  return deserializeAws_restJson1DeleteRecommendationTemplateCommandError(output, context);
1305
1250
  }
1306
- const contents = {
1251
+ const contents = map({
1307
1252
  $metadata: deserializeMetadata(output),
1308
- recommendationTemplateArn: undefined,
1309
- status: undefined,
1310
- };
1253
+ });
1311
1254
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1312
- if (data.recommendationTemplateArn !== undefined && data.recommendationTemplateArn !== null) {
1255
+ if (data.recommendationTemplateArn != null) {
1313
1256
  contents.recommendationTemplateArn = (0, smithy_client_1.expectString)(data.recommendationTemplateArn);
1314
1257
  }
1315
- if (data.status !== undefined && data.status !== null) {
1258
+ if (data.status != null) {
1316
1259
  contents.status = (0, smithy_client_1.expectString)(data.status);
1317
1260
  }
1318
- return Promise.resolve(contents);
1261
+ return contents;
1319
1262
  };
1320
1263
  exports.deserializeAws_restJson1DeleteRecommendationTemplateCommand = deserializeAws_restJson1DeleteRecommendationTemplateCommand;
1321
1264
  const deserializeAws_restJson1DeleteRecommendationTemplateCommandError = async (output, context) => {
@@ -1323,7 +1266,6 @@ const deserializeAws_restJson1DeleteRecommendationTemplateCommandError = async (
1323
1266
  ...output,
1324
1267
  body: await parseBody(output.body, context),
1325
1268
  };
1326
- let response;
1327
1269
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1328
1270
  switch (errorCode) {
1329
1271
  case "AccessDeniedException":
@@ -1343,29 +1285,26 @@ const deserializeAws_restJson1DeleteRecommendationTemplateCommandError = async (
1343
1285
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1344
1286
  default:
1345
1287
  const parsedBody = parsedOutput.body;
1346
- const $metadata = deserializeMetadata(output);
1347
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1348
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1349
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1350
- $fault: "client",
1351
- $metadata,
1288
+ (0, smithy_client_1.throwDefaultError)({
1289
+ output,
1290
+ parsedBody,
1291
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1292
+ errorCode,
1352
1293
  });
1353
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1354
1294
  }
1355
1295
  };
1356
1296
  const deserializeAws_restJson1DeleteResiliencyPolicyCommand = async (output, context) => {
1357
1297
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1358
1298
  return deserializeAws_restJson1DeleteResiliencyPolicyCommandError(output, context);
1359
1299
  }
1360
- const contents = {
1300
+ const contents = map({
1361
1301
  $metadata: deserializeMetadata(output),
1362
- policyArn: undefined,
1363
- };
1302
+ });
1364
1303
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1365
- if (data.policyArn !== undefined && data.policyArn !== null) {
1304
+ if (data.policyArn != null) {
1366
1305
  contents.policyArn = (0, smithy_client_1.expectString)(data.policyArn);
1367
1306
  }
1368
- return Promise.resolve(contents);
1307
+ return contents;
1369
1308
  };
1370
1309
  exports.deserializeAws_restJson1DeleteResiliencyPolicyCommand = deserializeAws_restJson1DeleteResiliencyPolicyCommand;
1371
1310
  const deserializeAws_restJson1DeleteResiliencyPolicyCommandError = async (output, context) => {
@@ -1373,7 +1312,6 @@ const deserializeAws_restJson1DeleteResiliencyPolicyCommandError = async (output
1373
1312
  ...output,
1374
1313
  body: await parseBody(output.body, context),
1375
1314
  };
1376
- let response;
1377
1315
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1378
1316
  switch (errorCode) {
1379
1317
  case "AccessDeniedException":
@@ -1396,29 +1334,26 @@ const deserializeAws_restJson1DeleteResiliencyPolicyCommandError = async (output
1396
1334
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1397
1335
  default:
1398
1336
  const parsedBody = parsedOutput.body;
1399
- const $metadata = deserializeMetadata(output);
1400
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1401
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1402
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1403
- $fault: "client",
1404
- $metadata,
1337
+ (0, smithy_client_1.throwDefaultError)({
1338
+ output,
1339
+ parsedBody,
1340
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1341
+ errorCode,
1405
1342
  });
1406
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1407
1343
  }
1408
1344
  };
1409
1345
  const deserializeAws_restJson1DescribeAppCommand = async (output, context) => {
1410
1346
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1411
1347
  return deserializeAws_restJson1DescribeAppCommandError(output, context);
1412
1348
  }
1413
- const contents = {
1349
+ const contents = map({
1414
1350
  $metadata: deserializeMetadata(output),
1415
- app: undefined,
1416
- };
1351
+ });
1417
1352
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1418
- if (data.app !== undefined && data.app !== null) {
1353
+ if (data.app != null) {
1419
1354
  contents.app = deserializeAws_restJson1App(data.app, context);
1420
1355
  }
1421
- return Promise.resolve(contents);
1356
+ return contents;
1422
1357
  };
1423
1358
  exports.deserializeAws_restJson1DescribeAppCommand = deserializeAws_restJson1DescribeAppCommand;
1424
1359
  const deserializeAws_restJson1DescribeAppCommandError = async (output, context) => {
@@ -1426,7 +1361,6 @@ const deserializeAws_restJson1DescribeAppCommandError = async (output, context)
1426
1361
  ...output,
1427
1362
  body: await parseBody(output.body, context),
1428
1363
  };
1429
- let response;
1430
1364
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1431
1365
  switch (errorCode) {
1432
1366
  case "AccessDeniedException":
@@ -1446,29 +1380,26 @@ const deserializeAws_restJson1DescribeAppCommandError = async (output, context)
1446
1380
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1447
1381
  default:
1448
1382
  const parsedBody = parsedOutput.body;
1449
- const $metadata = deserializeMetadata(output);
1450
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1451
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1452
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1453
- $fault: "client",
1454
- $metadata,
1383
+ (0, smithy_client_1.throwDefaultError)({
1384
+ output,
1385
+ parsedBody,
1386
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1387
+ errorCode,
1455
1388
  });
1456
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1457
1389
  }
1458
1390
  };
1459
1391
  const deserializeAws_restJson1DescribeAppAssessmentCommand = async (output, context) => {
1460
1392
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1461
1393
  return deserializeAws_restJson1DescribeAppAssessmentCommandError(output, context);
1462
1394
  }
1463
- const contents = {
1395
+ const contents = map({
1464
1396
  $metadata: deserializeMetadata(output),
1465
- assessment: undefined,
1466
- };
1397
+ });
1467
1398
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1468
- if (data.assessment !== undefined && data.assessment !== null) {
1399
+ if (data.assessment != null) {
1469
1400
  contents.assessment = deserializeAws_restJson1AppAssessment(data.assessment, context);
1470
1401
  }
1471
- return Promise.resolve(contents);
1402
+ return contents;
1472
1403
  };
1473
1404
  exports.deserializeAws_restJson1DescribeAppAssessmentCommand = deserializeAws_restJson1DescribeAppAssessmentCommand;
1474
1405
  const deserializeAws_restJson1DescribeAppAssessmentCommandError = async (output, context) => {
@@ -1476,7 +1407,6 @@ const deserializeAws_restJson1DescribeAppAssessmentCommandError = async (output,
1476
1407
  ...output,
1477
1408
  body: await parseBody(output.body, context),
1478
1409
  };
1479
- let response;
1480
1410
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1481
1411
  switch (errorCode) {
1482
1412
  case "AccessDeniedException":
@@ -1496,45 +1426,38 @@ const deserializeAws_restJson1DescribeAppAssessmentCommandError = async (output,
1496
1426
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1497
1427
  default:
1498
1428
  const parsedBody = parsedOutput.body;
1499
- const $metadata = deserializeMetadata(output);
1500
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1501
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1502
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1503
- $fault: "client",
1504
- $metadata,
1429
+ (0, smithy_client_1.throwDefaultError)({
1430
+ output,
1431
+ parsedBody,
1432
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1433
+ errorCode,
1505
1434
  });
1506
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1507
1435
  }
1508
1436
  };
1509
1437
  const deserializeAws_restJson1DescribeAppVersionResourcesResolutionStatusCommand = async (output, context) => {
1510
1438
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1511
1439
  return deserializeAws_restJson1DescribeAppVersionResourcesResolutionStatusCommandError(output, context);
1512
1440
  }
1513
- const contents = {
1441
+ const contents = map({
1514
1442
  $metadata: deserializeMetadata(output),
1515
- appArn: undefined,
1516
- appVersion: undefined,
1517
- errorMessage: undefined,
1518
- resolutionId: undefined,
1519
- status: undefined,
1520
- };
1443
+ });
1521
1444
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1522
- if (data.appArn !== undefined && data.appArn !== null) {
1445
+ if (data.appArn != null) {
1523
1446
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
1524
1447
  }
1525
- if (data.appVersion !== undefined && data.appVersion !== null) {
1448
+ if (data.appVersion != null) {
1526
1449
  contents.appVersion = (0, smithy_client_1.expectString)(data.appVersion);
1527
1450
  }
1528
- if (data.errorMessage !== undefined && data.errorMessage !== null) {
1451
+ if (data.errorMessage != null) {
1529
1452
  contents.errorMessage = (0, smithy_client_1.expectString)(data.errorMessage);
1530
1453
  }
1531
- if (data.resolutionId !== undefined && data.resolutionId !== null) {
1454
+ if (data.resolutionId != null) {
1532
1455
  contents.resolutionId = (0, smithy_client_1.expectString)(data.resolutionId);
1533
1456
  }
1534
- if (data.status !== undefined && data.status !== null) {
1457
+ if (data.status != null) {
1535
1458
  contents.status = (0, smithy_client_1.expectString)(data.status);
1536
1459
  }
1537
- return Promise.resolve(contents);
1460
+ return contents;
1538
1461
  };
1539
1462
  exports.deserializeAws_restJson1DescribeAppVersionResourcesResolutionStatusCommand = deserializeAws_restJson1DescribeAppVersionResourcesResolutionStatusCommand;
1540
1463
  const deserializeAws_restJson1DescribeAppVersionResourcesResolutionStatusCommandError = async (output, context) => {
@@ -1542,7 +1465,6 @@ const deserializeAws_restJson1DescribeAppVersionResourcesResolutionStatusCommand
1542
1465
  ...output,
1543
1466
  body: await parseBody(output.body, context),
1544
1467
  };
1545
- let response;
1546
1468
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1547
1469
  switch (errorCode) {
1548
1470
  case "AccessDeniedException":
@@ -1562,37 +1484,32 @@ const deserializeAws_restJson1DescribeAppVersionResourcesResolutionStatusCommand
1562
1484
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1563
1485
  default:
1564
1486
  const parsedBody = parsedOutput.body;
1565
- const $metadata = deserializeMetadata(output);
1566
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1567
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1568
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1569
- $fault: "client",
1570
- $metadata,
1487
+ (0, smithy_client_1.throwDefaultError)({
1488
+ output,
1489
+ parsedBody,
1490
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1491
+ errorCode,
1571
1492
  });
1572
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1573
1493
  }
1574
1494
  };
1575
1495
  const deserializeAws_restJson1DescribeAppVersionTemplateCommand = async (output, context) => {
1576
1496
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1577
1497
  return deserializeAws_restJson1DescribeAppVersionTemplateCommandError(output, context);
1578
1498
  }
1579
- const contents = {
1499
+ const contents = map({
1580
1500
  $metadata: deserializeMetadata(output),
1581
- appArn: undefined,
1582
- appTemplateBody: undefined,
1583
- appVersion: undefined,
1584
- };
1501
+ });
1585
1502
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1586
- if (data.appArn !== undefined && data.appArn !== null) {
1503
+ if (data.appArn != null) {
1587
1504
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
1588
1505
  }
1589
- if (data.appTemplateBody !== undefined && data.appTemplateBody !== null) {
1506
+ if (data.appTemplateBody != null) {
1590
1507
  contents.appTemplateBody = (0, smithy_client_1.expectString)(data.appTemplateBody);
1591
1508
  }
1592
- if (data.appVersion !== undefined && data.appVersion !== null) {
1509
+ if (data.appVersion != null) {
1593
1510
  contents.appVersion = (0, smithy_client_1.expectString)(data.appVersion);
1594
1511
  }
1595
- return Promise.resolve(contents);
1512
+ return contents;
1596
1513
  };
1597
1514
  exports.deserializeAws_restJson1DescribeAppVersionTemplateCommand = deserializeAws_restJson1DescribeAppVersionTemplateCommand;
1598
1515
  const deserializeAws_restJson1DescribeAppVersionTemplateCommandError = async (output, context) => {
@@ -1600,7 +1517,6 @@ const deserializeAws_restJson1DescribeAppVersionTemplateCommandError = async (ou
1600
1517
  ...output,
1601
1518
  body: await parseBody(output.body, context),
1602
1519
  };
1603
- let response;
1604
1520
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1605
1521
  switch (errorCode) {
1606
1522
  case "AccessDeniedException":
@@ -1620,45 +1536,38 @@ const deserializeAws_restJson1DescribeAppVersionTemplateCommandError = async (ou
1620
1536
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1621
1537
  default:
1622
1538
  const parsedBody = parsedOutput.body;
1623
- const $metadata = deserializeMetadata(output);
1624
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1625
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1626
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1627
- $fault: "client",
1628
- $metadata,
1539
+ (0, smithy_client_1.throwDefaultError)({
1540
+ output,
1541
+ parsedBody,
1542
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1543
+ errorCode,
1629
1544
  });
1630
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1631
1545
  }
1632
1546
  };
1633
1547
  const deserializeAws_restJson1DescribeDraftAppVersionResourcesImportStatusCommand = async (output, context) => {
1634
1548
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1635
1549
  return deserializeAws_restJson1DescribeDraftAppVersionResourcesImportStatusCommandError(output, context);
1636
1550
  }
1637
- const contents = {
1551
+ const contents = map({
1638
1552
  $metadata: deserializeMetadata(output),
1639
- appArn: undefined,
1640
- appVersion: undefined,
1641
- errorMessage: undefined,
1642
- status: undefined,
1643
- statusChangeTime: undefined,
1644
- };
1553
+ });
1645
1554
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1646
- if (data.appArn !== undefined && data.appArn !== null) {
1555
+ if (data.appArn != null) {
1647
1556
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
1648
1557
  }
1649
- if (data.appVersion !== undefined && data.appVersion !== null) {
1558
+ if (data.appVersion != null) {
1650
1559
  contents.appVersion = (0, smithy_client_1.expectString)(data.appVersion);
1651
1560
  }
1652
- if (data.errorMessage !== undefined && data.errorMessage !== null) {
1561
+ if (data.errorMessage != null) {
1653
1562
  contents.errorMessage = (0, smithy_client_1.expectString)(data.errorMessage);
1654
1563
  }
1655
- if (data.status !== undefined && data.status !== null) {
1564
+ if (data.status != null) {
1656
1565
  contents.status = (0, smithy_client_1.expectString)(data.status);
1657
1566
  }
1658
- if (data.statusChangeTime !== undefined && data.statusChangeTime !== null) {
1567
+ if (data.statusChangeTime != null) {
1659
1568
  contents.statusChangeTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.statusChangeTime)));
1660
1569
  }
1661
- return Promise.resolve(contents);
1570
+ return contents;
1662
1571
  };
1663
1572
  exports.deserializeAws_restJson1DescribeDraftAppVersionResourcesImportStatusCommand = deserializeAws_restJson1DescribeDraftAppVersionResourcesImportStatusCommand;
1664
1573
  const deserializeAws_restJson1DescribeDraftAppVersionResourcesImportStatusCommandError = async (output, context) => {
@@ -1666,7 +1575,6 @@ const deserializeAws_restJson1DescribeDraftAppVersionResourcesImportStatusComman
1666
1575
  ...output,
1667
1576
  body: await parseBody(output.body, context),
1668
1577
  };
1669
- let response;
1670
1578
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1671
1579
  switch (errorCode) {
1672
1580
  case "AccessDeniedException":
@@ -1686,29 +1594,26 @@ const deserializeAws_restJson1DescribeDraftAppVersionResourcesImportStatusComman
1686
1594
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1687
1595
  default:
1688
1596
  const parsedBody = parsedOutput.body;
1689
- const $metadata = deserializeMetadata(output);
1690
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1691
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1692
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1693
- $fault: "client",
1694
- $metadata,
1597
+ (0, smithy_client_1.throwDefaultError)({
1598
+ output,
1599
+ parsedBody,
1600
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1601
+ errorCode,
1695
1602
  });
1696
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1697
1603
  }
1698
1604
  };
1699
1605
  const deserializeAws_restJson1DescribeResiliencyPolicyCommand = async (output, context) => {
1700
1606
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1701
1607
  return deserializeAws_restJson1DescribeResiliencyPolicyCommandError(output, context);
1702
1608
  }
1703
- const contents = {
1609
+ const contents = map({
1704
1610
  $metadata: deserializeMetadata(output),
1705
- policy: undefined,
1706
- };
1611
+ });
1707
1612
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1708
- if (data.policy !== undefined && data.policy !== null) {
1613
+ if (data.policy != null) {
1709
1614
  contents.policy = deserializeAws_restJson1ResiliencyPolicy(data.policy, context);
1710
1615
  }
1711
- return Promise.resolve(contents);
1616
+ return contents;
1712
1617
  };
1713
1618
  exports.deserializeAws_restJson1DescribeResiliencyPolicyCommand = deserializeAws_restJson1DescribeResiliencyPolicyCommand;
1714
1619
  const deserializeAws_restJson1DescribeResiliencyPolicyCommandError = async (output, context) => {
@@ -1716,7 +1621,6 @@ const deserializeAws_restJson1DescribeResiliencyPolicyCommandError = async (outp
1716
1621
  ...output,
1717
1622
  body: await parseBody(output.body, context),
1718
1623
  };
1719
- let response;
1720
1624
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1721
1625
  switch (errorCode) {
1722
1626
  case "AccessDeniedException":
@@ -1736,45 +1640,38 @@ const deserializeAws_restJson1DescribeResiliencyPolicyCommandError = async (outp
1736
1640
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1737
1641
  default:
1738
1642
  const parsedBody = parsedOutput.body;
1739
- const $metadata = deserializeMetadata(output);
1740
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1741
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1742
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1743
- $fault: "client",
1744
- $metadata,
1643
+ (0, smithy_client_1.throwDefaultError)({
1644
+ output,
1645
+ parsedBody,
1646
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1647
+ errorCode,
1745
1648
  });
1746
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1747
1649
  }
1748
1650
  };
1749
1651
  const deserializeAws_restJson1ImportResourcesToDraftAppVersionCommand = async (output, context) => {
1750
1652
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1751
1653
  return deserializeAws_restJson1ImportResourcesToDraftAppVersionCommandError(output, context);
1752
1654
  }
1753
- const contents = {
1655
+ const contents = map({
1754
1656
  $metadata: deserializeMetadata(output),
1755
- appArn: undefined,
1756
- appVersion: undefined,
1757
- sourceArns: undefined,
1758
- status: undefined,
1759
- terraformSources: undefined,
1760
- };
1657
+ });
1761
1658
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1762
- if (data.appArn !== undefined && data.appArn !== null) {
1659
+ if (data.appArn != null) {
1763
1660
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
1764
1661
  }
1765
- if (data.appVersion !== undefined && data.appVersion !== null) {
1662
+ if (data.appVersion != null) {
1766
1663
  contents.appVersion = (0, smithy_client_1.expectString)(data.appVersion);
1767
1664
  }
1768
- if (data.sourceArns !== undefined && data.sourceArns !== null) {
1665
+ if (data.sourceArns != null) {
1769
1666
  contents.sourceArns = deserializeAws_restJson1ArnList(data.sourceArns, context);
1770
1667
  }
1771
- if (data.status !== undefined && data.status !== null) {
1668
+ if (data.status != null) {
1772
1669
  contents.status = (0, smithy_client_1.expectString)(data.status);
1773
1670
  }
1774
- if (data.terraformSources !== undefined && data.terraformSources !== null) {
1671
+ if (data.terraformSources != null) {
1775
1672
  contents.terraformSources = deserializeAws_restJson1TerraformSourceList(data.terraformSources, context);
1776
1673
  }
1777
- return Promise.resolve(contents);
1674
+ return contents;
1778
1675
  };
1779
1676
  exports.deserializeAws_restJson1ImportResourcesToDraftAppVersionCommand = deserializeAws_restJson1ImportResourcesToDraftAppVersionCommand;
1780
1677
  const deserializeAws_restJson1ImportResourcesToDraftAppVersionCommandError = async (output, context) => {
@@ -1782,7 +1679,6 @@ const deserializeAws_restJson1ImportResourcesToDraftAppVersionCommandError = asy
1782
1679
  ...output,
1783
1680
  body: await parseBody(output.body, context),
1784
1681
  };
1785
- let response;
1786
1682
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1787
1683
  switch (errorCode) {
1788
1684
  case "AccessDeniedException":
@@ -1805,33 +1701,29 @@ const deserializeAws_restJson1ImportResourcesToDraftAppVersionCommandError = asy
1805
1701
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1806
1702
  default:
1807
1703
  const parsedBody = parsedOutput.body;
1808
- const $metadata = deserializeMetadata(output);
1809
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1810
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1811
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1812
- $fault: "client",
1813
- $metadata,
1704
+ (0, smithy_client_1.throwDefaultError)({
1705
+ output,
1706
+ parsedBody,
1707
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1708
+ errorCode,
1814
1709
  });
1815
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1816
1710
  }
1817
1711
  };
1818
1712
  const deserializeAws_restJson1ListAlarmRecommendationsCommand = async (output, context) => {
1819
1713
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1820
1714
  return deserializeAws_restJson1ListAlarmRecommendationsCommandError(output, context);
1821
1715
  }
1822
- const contents = {
1716
+ const contents = map({
1823
1717
  $metadata: deserializeMetadata(output),
1824
- alarmRecommendations: undefined,
1825
- nextToken: undefined,
1826
- };
1718
+ });
1827
1719
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1828
- if (data.alarmRecommendations !== undefined && data.alarmRecommendations !== null) {
1720
+ if (data.alarmRecommendations != null) {
1829
1721
  contents.alarmRecommendations = deserializeAws_restJson1AlarmRecommendationList(data.alarmRecommendations, context);
1830
1722
  }
1831
- if (data.nextToken !== undefined && data.nextToken !== null) {
1723
+ if (data.nextToken != null) {
1832
1724
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1833
1725
  }
1834
- return Promise.resolve(contents);
1726
+ return contents;
1835
1727
  };
1836
1728
  exports.deserializeAws_restJson1ListAlarmRecommendationsCommand = deserializeAws_restJson1ListAlarmRecommendationsCommand;
1837
1729
  const deserializeAws_restJson1ListAlarmRecommendationsCommandError = async (output, context) => {
@@ -1839,7 +1731,6 @@ const deserializeAws_restJson1ListAlarmRecommendationsCommandError = async (outp
1839
1731
  ...output,
1840
1732
  body: await parseBody(output.body, context),
1841
1733
  };
1842
- let response;
1843
1734
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1844
1735
  switch (errorCode) {
1845
1736
  case "AccessDeniedException":
@@ -1859,33 +1750,29 @@ const deserializeAws_restJson1ListAlarmRecommendationsCommandError = async (outp
1859
1750
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1860
1751
  default:
1861
1752
  const parsedBody = parsedOutput.body;
1862
- const $metadata = deserializeMetadata(output);
1863
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1864
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1865
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1866
- $fault: "client",
1867
- $metadata,
1753
+ (0, smithy_client_1.throwDefaultError)({
1754
+ output,
1755
+ parsedBody,
1756
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1757
+ errorCode,
1868
1758
  });
1869
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1870
1759
  }
1871
1760
  };
1872
1761
  const deserializeAws_restJson1ListAppAssessmentsCommand = async (output, context) => {
1873
1762
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1874
1763
  return deserializeAws_restJson1ListAppAssessmentsCommandError(output, context);
1875
1764
  }
1876
- const contents = {
1765
+ const contents = map({
1877
1766
  $metadata: deserializeMetadata(output),
1878
- assessmentSummaries: undefined,
1879
- nextToken: undefined,
1880
- };
1767
+ });
1881
1768
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1882
- if (data.assessmentSummaries !== undefined && data.assessmentSummaries !== null) {
1769
+ if (data.assessmentSummaries != null) {
1883
1770
  contents.assessmentSummaries = deserializeAws_restJson1AppAssessmentSummaryList(data.assessmentSummaries, context);
1884
1771
  }
1885
- if (data.nextToken !== undefined && data.nextToken !== null) {
1772
+ if (data.nextToken != null) {
1886
1773
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1887
1774
  }
1888
- return Promise.resolve(contents);
1775
+ return contents;
1889
1776
  };
1890
1777
  exports.deserializeAws_restJson1ListAppAssessmentsCommand = deserializeAws_restJson1ListAppAssessmentsCommand;
1891
1778
  const deserializeAws_restJson1ListAppAssessmentsCommandError = async (output, context) => {
@@ -1893,7 +1780,6 @@ const deserializeAws_restJson1ListAppAssessmentsCommandError = async (output, co
1893
1780
  ...output,
1894
1781
  body: await parseBody(output.body, context),
1895
1782
  };
1896
- let response;
1897
1783
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1898
1784
  switch (errorCode) {
1899
1785
  case "AccessDeniedException":
@@ -1913,33 +1799,29 @@ const deserializeAws_restJson1ListAppAssessmentsCommandError = async (output, co
1913
1799
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1914
1800
  default:
1915
1801
  const parsedBody = parsedOutput.body;
1916
- const $metadata = deserializeMetadata(output);
1917
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1918
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1919
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1920
- $fault: "client",
1921
- $metadata,
1802
+ (0, smithy_client_1.throwDefaultError)({
1803
+ output,
1804
+ parsedBody,
1805
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1806
+ errorCode,
1922
1807
  });
1923
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1924
1808
  }
1925
1809
  };
1926
1810
  const deserializeAws_restJson1ListAppComponentCompliancesCommand = async (output, context) => {
1927
1811
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1928
1812
  return deserializeAws_restJson1ListAppComponentCompliancesCommandError(output, context);
1929
1813
  }
1930
- const contents = {
1814
+ const contents = map({
1931
1815
  $metadata: deserializeMetadata(output),
1932
- componentCompliances: undefined,
1933
- nextToken: undefined,
1934
- };
1816
+ });
1935
1817
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1936
- if (data.componentCompliances !== undefined && data.componentCompliances !== null) {
1818
+ if (data.componentCompliances != null) {
1937
1819
  contents.componentCompliances = deserializeAws_restJson1ComponentCompliancesList(data.componentCompliances, context);
1938
1820
  }
1939
- if (data.nextToken !== undefined && data.nextToken !== null) {
1821
+ if (data.nextToken != null) {
1940
1822
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1941
1823
  }
1942
- return Promise.resolve(contents);
1824
+ return contents;
1943
1825
  };
1944
1826
  exports.deserializeAws_restJson1ListAppComponentCompliancesCommand = deserializeAws_restJson1ListAppComponentCompliancesCommand;
1945
1827
  const deserializeAws_restJson1ListAppComponentCompliancesCommandError = async (output, context) => {
@@ -1947,7 +1829,6 @@ const deserializeAws_restJson1ListAppComponentCompliancesCommandError = async (o
1947
1829
  ...output,
1948
1830
  body: await parseBody(output.body, context),
1949
1831
  };
1950
- let response;
1951
1832
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1952
1833
  switch (errorCode) {
1953
1834
  case "AccessDeniedException":
@@ -1967,33 +1848,29 @@ const deserializeAws_restJson1ListAppComponentCompliancesCommandError = async (o
1967
1848
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1968
1849
  default:
1969
1850
  const parsedBody = parsedOutput.body;
1970
- const $metadata = deserializeMetadata(output);
1971
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1972
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
1973
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1974
- $fault: "client",
1975
- $metadata,
1851
+ (0, smithy_client_1.throwDefaultError)({
1852
+ output,
1853
+ parsedBody,
1854
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1855
+ errorCode,
1976
1856
  });
1977
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1978
1857
  }
1979
1858
  };
1980
1859
  const deserializeAws_restJson1ListAppComponentRecommendationsCommand = async (output, context) => {
1981
1860
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1982
1861
  return deserializeAws_restJson1ListAppComponentRecommendationsCommandError(output, context);
1983
1862
  }
1984
- const contents = {
1863
+ const contents = map({
1985
1864
  $metadata: deserializeMetadata(output),
1986
- componentRecommendations: undefined,
1987
- nextToken: undefined,
1988
- };
1865
+ });
1989
1866
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1990
- if (data.componentRecommendations !== undefined && data.componentRecommendations !== null) {
1867
+ if (data.componentRecommendations != null) {
1991
1868
  contents.componentRecommendations = deserializeAws_restJson1ComponentRecommendationList(data.componentRecommendations, context);
1992
1869
  }
1993
- if (data.nextToken !== undefined && data.nextToken !== null) {
1870
+ if (data.nextToken != null) {
1994
1871
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1995
1872
  }
1996
- return Promise.resolve(contents);
1873
+ return contents;
1997
1874
  };
1998
1875
  exports.deserializeAws_restJson1ListAppComponentRecommendationsCommand = deserializeAws_restJson1ListAppComponentRecommendationsCommand;
1999
1876
  const deserializeAws_restJson1ListAppComponentRecommendationsCommandError = async (output, context) => {
@@ -2001,7 +1878,6 @@ const deserializeAws_restJson1ListAppComponentRecommendationsCommandError = asyn
2001
1878
  ...output,
2002
1879
  body: await parseBody(output.body, context),
2003
1880
  };
2004
- let response;
2005
1881
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2006
1882
  switch (errorCode) {
2007
1883
  case "AccessDeniedException":
@@ -2021,33 +1897,29 @@ const deserializeAws_restJson1ListAppComponentRecommendationsCommandError = asyn
2021
1897
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2022
1898
  default:
2023
1899
  const parsedBody = parsedOutput.body;
2024
- const $metadata = deserializeMetadata(output);
2025
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2026
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2027
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2028
- $fault: "client",
2029
- $metadata,
1900
+ (0, smithy_client_1.throwDefaultError)({
1901
+ output,
1902
+ parsedBody,
1903
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1904
+ errorCode,
2030
1905
  });
2031
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2032
1906
  }
2033
1907
  };
2034
1908
  const deserializeAws_restJson1ListAppsCommand = async (output, context) => {
2035
1909
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2036
1910
  return deserializeAws_restJson1ListAppsCommandError(output, context);
2037
1911
  }
2038
- const contents = {
1912
+ const contents = map({
2039
1913
  $metadata: deserializeMetadata(output),
2040
- appSummaries: undefined,
2041
- nextToken: undefined,
2042
- };
1914
+ });
2043
1915
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2044
- if (data.appSummaries !== undefined && data.appSummaries !== null) {
1916
+ if (data.appSummaries != null) {
2045
1917
  contents.appSummaries = deserializeAws_restJson1AppSummaryList(data.appSummaries, context);
2046
1918
  }
2047
- if (data.nextToken !== undefined && data.nextToken !== null) {
1919
+ if (data.nextToken != null) {
2048
1920
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2049
1921
  }
2050
- return Promise.resolve(contents);
1922
+ return contents;
2051
1923
  };
2052
1924
  exports.deserializeAws_restJson1ListAppsCommand = deserializeAws_restJson1ListAppsCommand;
2053
1925
  const deserializeAws_restJson1ListAppsCommandError = async (output, context) => {
@@ -2055,7 +1927,6 @@ const deserializeAws_restJson1ListAppsCommandError = async (output, context) =>
2055
1927
  ...output,
2056
1928
  body: await parseBody(output.body, context),
2057
1929
  };
2058
- let response;
2059
1930
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2060
1931
  switch (errorCode) {
2061
1932
  case "AccessDeniedException":
@@ -2072,33 +1943,29 @@ const deserializeAws_restJson1ListAppsCommandError = async (output, context) =>
2072
1943
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2073
1944
  default:
2074
1945
  const parsedBody = parsedOutput.body;
2075
- const $metadata = deserializeMetadata(output);
2076
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2077
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2078
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2079
- $fault: "client",
2080
- $metadata,
1946
+ (0, smithy_client_1.throwDefaultError)({
1947
+ output,
1948
+ parsedBody,
1949
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1950
+ errorCode,
2081
1951
  });
2082
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2083
1952
  }
2084
1953
  };
2085
1954
  const deserializeAws_restJson1ListAppVersionResourceMappingsCommand = async (output, context) => {
2086
1955
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2087
1956
  return deserializeAws_restJson1ListAppVersionResourceMappingsCommandError(output, context);
2088
1957
  }
2089
- const contents = {
1958
+ const contents = map({
2090
1959
  $metadata: deserializeMetadata(output),
2091
- nextToken: undefined,
2092
- resourceMappings: undefined,
2093
- };
1960
+ });
2094
1961
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2095
- if (data.nextToken !== undefined && data.nextToken !== null) {
1962
+ if (data.nextToken != null) {
2096
1963
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2097
1964
  }
2098
- if (data.resourceMappings !== undefined && data.resourceMappings !== null) {
1965
+ if (data.resourceMappings != null) {
2099
1966
  contents.resourceMappings = deserializeAws_restJson1ResourceMappingList(data.resourceMappings, context);
2100
1967
  }
2101
- return Promise.resolve(contents);
1968
+ return contents;
2102
1969
  };
2103
1970
  exports.deserializeAws_restJson1ListAppVersionResourceMappingsCommand = deserializeAws_restJson1ListAppVersionResourceMappingsCommand;
2104
1971
  const deserializeAws_restJson1ListAppVersionResourceMappingsCommandError = async (output, context) => {
@@ -2106,7 +1973,6 @@ const deserializeAws_restJson1ListAppVersionResourceMappingsCommandError = async
2106
1973
  ...output,
2107
1974
  body: await parseBody(output.body, context),
2108
1975
  };
2109
- let response;
2110
1976
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2111
1977
  switch (errorCode) {
2112
1978
  case "AccessDeniedException":
@@ -2126,37 +1992,32 @@ const deserializeAws_restJson1ListAppVersionResourceMappingsCommandError = async
2126
1992
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2127
1993
  default:
2128
1994
  const parsedBody = parsedOutput.body;
2129
- const $metadata = deserializeMetadata(output);
2130
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2131
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2132
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2133
- $fault: "client",
2134
- $metadata,
1995
+ (0, smithy_client_1.throwDefaultError)({
1996
+ output,
1997
+ parsedBody,
1998
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
1999
+ errorCode,
2135
2000
  });
2136
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2137
2001
  }
2138
2002
  };
2139
2003
  const deserializeAws_restJson1ListAppVersionResourcesCommand = async (output, context) => {
2140
2004
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2141
2005
  return deserializeAws_restJson1ListAppVersionResourcesCommandError(output, context);
2142
2006
  }
2143
- const contents = {
2007
+ const contents = map({
2144
2008
  $metadata: deserializeMetadata(output),
2145
- nextToken: undefined,
2146
- physicalResources: undefined,
2147
- resolutionId: undefined,
2148
- };
2009
+ });
2149
2010
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2150
- if (data.nextToken !== undefined && data.nextToken !== null) {
2011
+ if (data.nextToken != null) {
2151
2012
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2152
2013
  }
2153
- if (data.physicalResources !== undefined && data.physicalResources !== null) {
2014
+ if (data.physicalResources != null) {
2154
2015
  contents.physicalResources = deserializeAws_restJson1PhysicalResourceList(data.physicalResources, context);
2155
2016
  }
2156
- if (data.resolutionId !== undefined && data.resolutionId !== null) {
2017
+ if (data.resolutionId != null) {
2157
2018
  contents.resolutionId = (0, smithy_client_1.expectString)(data.resolutionId);
2158
2019
  }
2159
- return Promise.resolve(contents);
2020
+ return contents;
2160
2021
  };
2161
2022
  exports.deserializeAws_restJson1ListAppVersionResourcesCommand = deserializeAws_restJson1ListAppVersionResourcesCommand;
2162
2023
  const deserializeAws_restJson1ListAppVersionResourcesCommandError = async (output, context) => {
@@ -2164,7 +2025,6 @@ const deserializeAws_restJson1ListAppVersionResourcesCommandError = async (outpu
2164
2025
  ...output,
2165
2026
  body: await parseBody(output.body, context),
2166
2027
  };
2167
- let response;
2168
2028
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2169
2029
  switch (errorCode) {
2170
2030
  case "AccessDeniedException":
@@ -2187,33 +2047,29 @@ const deserializeAws_restJson1ListAppVersionResourcesCommandError = async (outpu
2187
2047
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2188
2048
  default:
2189
2049
  const parsedBody = parsedOutput.body;
2190
- const $metadata = deserializeMetadata(output);
2191
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2192
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2193
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2194
- $fault: "client",
2195
- $metadata,
2050
+ (0, smithy_client_1.throwDefaultError)({
2051
+ output,
2052
+ parsedBody,
2053
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2054
+ errorCode,
2196
2055
  });
2197
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2198
2056
  }
2199
2057
  };
2200
2058
  const deserializeAws_restJson1ListAppVersionsCommand = async (output, context) => {
2201
2059
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2202
2060
  return deserializeAws_restJson1ListAppVersionsCommandError(output, context);
2203
2061
  }
2204
- const contents = {
2062
+ const contents = map({
2205
2063
  $metadata: deserializeMetadata(output),
2206
- appVersions: undefined,
2207
- nextToken: undefined,
2208
- };
2064
+ });
2209
2065
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2210
- if (data.appVersions !== undefined && data.appVersions !== null) {
2066
+ if (data.appVersions != null) {
2211
2067
  contents.appVersions = deserializeAws_restJson1AppVersionList(data.appVersions, context);
2212
2068
  }
2213
- if (data.nextToken !== undefined && data.nextToken !== null) {
2069
+ if (data.nextToken != null) {
2214
2070
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2215
2071
  }
2216
- return Promise.resolve(contents);
2072
+ return contents;
2217
2073
  };
2218
2074
  exports.deserializeAws_restJson1ListAppVersionsCommand = deserializeAws_restJson1ListAppVersionsCommand;
2219
2075
  const deserializeAws_restJson1ListAppVersionsCommandError = async (output, context) => {
@@ -2221,7 +2077,6 @@ const deserializeAws_restJson1ListAppVersionsCommandError = async (output, conte
2221
2077
  ...output,
2222
2078
  body: await parseBody(output.body, context),
2223
2079
  };
2224
- let response;
2225
2080
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2226
2081
  switch (errorCode) {
2227
2082
  case "AccessDeniedException":
@@ -2238,33 +2093,29 @@ const deserializeAws_restJson1ListAppVersionsCommandError = async (output, conte
2238
2093
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2239
2094
  default:
2240
2095
  const parsedBody = parsedOutput.body;
2241
- const $metadata = deserializeMetadata(output);
2242
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2243
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2244
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2245
- $fault: "client",
2246
- $metadata,
2096
+ (0, smithy_client_1.throwDefaultError)({
2097
+ output,
2098
+ parsedBody,
2099
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2100
+ errorCode,
2247
2101
  });
2248
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2249
2102
  }
2250
2103
  };
2251
2104
  const deserializeAws_restJson1ListRecommendationTemplatesCommand = async (output, context) => {
2252
2105
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2253
2106
  return deserializeAws_restJson1ListRecommendationTemplatesCommandError(output, context);
2254
2107
  }
2255
- const contents = {
2108
+ const contents = map({
2256
2109
  $metadata: deserializeMetadata(output),
2257
- nextToken: undefined,
2258
- recommendationTemplates: undefined,
2259
- };
2110
+ });
2260
2111
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2261
- if (data.nextToken !== undefined && data.nextToken !== null) {
2112
+ if (data.nextToken != null) {
2262
2113
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2263
2114
  }
2264
- if (data.recommendationTemplates !== undefined && data.recommendationTemplates !== null) {
2115
+ if (data.recommendationTemplates != null) {
2265
2116
  contents.recommendationTemplates = deserializeAws_restJson1RecommendationTemplateList(data.recommendationTemplates, context);
2266
2117
  }
2267
- return Promise.resolve(contents);
2118
+ return contents;
2268
2119
  };
2269
2120
  exports.deserializeAws_restJson1ListRecommendationTemplatesCommand = deserializeAws_restJson1ListRecommendationTemplatesCommand;
2270
2121
  const deserializeAws_restJson1ListRecommendationTemplatesCommandError = async (output, context) => {
@@ -2272,7 +2123,6 @@ const deserializeAws_restJson1ListRecommendationTemplatesCommandError = async (o
2272
2123
  ...output,
2273
2124
  body: await parseBody(output.body, context),
2274
2125
  };
2275
- let response;
2276
2126
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2277
2127
  switch (errorCode) {
2278
2128
  case "AccessDeniedException":
@@ -2289,33 +2139,29 @@ const deserializeAws_restJson1ListRecommendationTemplatesCommandError = async (o
2289
2139
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2290
2140
  default:
2291
2141
  const parsedBody = parsedOutput.body;
2292
- const $metadata = deserializeMetadata(output);
2293
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2294
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2295
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2296
- $fault: "client",
2297
- $metadata,
2142
+ (0, smithy_client_1.throwDefaultError)({
2143
+ output,
2144
+ parsedBody,
2145
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2146
+ errorCode,
2298
2147
  });
2299
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2300
2148
  }
2301
2149
  };
2302
2150
  const deserializeAws_restJson1ListResiliencyPoliciesCommand = async (output, context) => {
2303
2151
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2304
2152
  return deserializeAws_restJson1ListResiliencyPoliciesCommandError(output, context);
2305
2153
  }
2306
- const contents = {
2154
+ const contents = map({
2307
2155
  $metadata: deserializeMetadata(output),
2308
- nextToken: undefined,
2309
- resiliencyPolicies: undefined,
2310
- };
2156
+ });
2311
2157
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2312
- if (data.nextToken !== undefined && data.nextToken !== null) {
2158
+ if (data.nextToken != null) {
2313
2159
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2314
2160
  }
2315
- if (data.resiliencyPolicies !== undefined && data.resiliencyPolicies !== null) {
2161
+ if (data.resiliencyPolicies != null) {
2316
2162
  contents.resiliencyPolicies = deserializeAws_restJson1ResiliencyPolicies(data.resiliencyPolicies, context);
2317
2163
  }
2318
- return Promise.resolve(contents);
2164
+ return contents;
2319
2165
  };
2320
2166
  exports.deserializeAws_restJson1ListResiliencyPoliciesCommand = deserializeAws_restJson1ListResiliencyPoliciesCommand;
2321
2167
  const deserializeAws_restJson1ListResiliencyPoliciesCommandError = async (output, context) => {
@@ -2323,7 +2169,6 @@ const deserializeAws_restJson1ListResiliencyPoliciesCommandError = async (output
2323
2169
  ...output,
2324
2170
  body: await parseBody(output.body, context),
2325
2171
  };
2326
- let response;
2327
2172
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2328
2173
  switch (errorCode) {
2329
2174
  case "AccessDeniedException":
@@ -2343,33 +2188,29 @@ const deserializeAws_restJson1ListResiliencyPoliciesCommandError = async (output
2343
2188
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2344
2189
  default:
2345
2190
  const parsedBody = parsedOutput.body;
2346
- const $metadata = deserializeMetadata(output);
2347
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2348
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2349
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2350
- $fault: "client",
2351
- $metadata,
2191
+ (0, smithy_client_1.throwDefaultError)({
2192
+ output,
2193
+ parsedBody,
2194
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2195
+ errorCode,
2352
2196
  });
2353
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2354
2197
  }
2355
2198
  };
2356
2199
  const deserializeAws_restJson1ListSopRecommendationsCommand = async (output, context) => {
2357
2200
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2358
2201
  return deserializeAws_restJson1ListSopRecommendationsCommandError(output, context);
2359
2202
  }
2360
- const contents = {
2203
+ const contents = map({
2361
2204
  $metadata: deserializeMetadata(output),
2362
- nextToken: undefined,
2363
- sopRecommendations: undefined,
2364
- };
2205
+ });
2365
2206
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2366
- if (data.nextToken !== undefined && data.nextToken !== null) {
2207
+ if (data.nextToken != null) {
2367
2208
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2368
2209
  }
2369
- if (data.sopRecommendations !== undefined && data.sopRecommendations !== null) {
2210
+ if (data.sopRecommendations != null) {
2370
2211
  contents.sopRecommendations = deserializeAws_restJson1SopRecommendationList(data.sopRecommendations, context);
2371
2212
  }
2372
- return Promise.resolve(contents);
2213
+ return contents;
2373
2214
  };
2374
2215
  exports.deserializeAws_restJson1ListSopRecommendationsCommand = deserializeAws_restJson1ListSopRecommendationsCommand;
2375
2216
  const deserializeAws_restJson1ListSopRecommendationsCommandError = async (output, context) => {
@@ -2377,7 +2218,6 @@ const deserializeAws_restJson1ListSopRecommendationsCommandError = async (output
2377
2218
  ...output,
2378
2219
  body: await parseBody(output.body, context),
2379
2220
  };
2380
- let response;
2381
2221
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2382
2222
  switch (errorCode) {
2383
2223
  case "AccessDeniedException":
@@ -2400,33 +2240,29 @@ const deserializeAws_restJson1ListSopRecommendationsCommandError = async (output
2400
2240
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2401
2241
  default:
2402
2242
  const parsedBody = parsedOutput.body;
2403
- const $metadata = deserializeMetadata(output);
2404
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2405
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2406
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2407
- $fault: "client",
2408
- $metadata,
2243
+ (0, smithy_client_1.throwDefaultError)({
2244
+ output,
2245
+ parsedBody,
2246
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2247
+ errorCode,
2409
2248
  });
2410
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2411
2249
  }
2412
2250
  };
2413
2251
  const deserializeAws_restJson1ListSuggestedResiliencyPoliciesCommand = async (output, context) => {
2414
2252
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2415
2253
  return deserializeAws_restJson1ListSuggestedResiliencyPoliciesCommandError(output, context);
2416
2254
  }
2417
- const contents = {
2255
+ const contents = map({
2418
2256
  $metadata: deserializeMetadata(output),
2419
- nextToken: undefined,
2420
- resiliencyPolicies: undefined,
2421
- };
2257
+ });
2422
2258
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2423
- if (data.nextToken !== undefined && data.nextToken !== null) {
2259
+ if (data.nextToken != null) {
2424
2260
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2425
2261
  }
2426
- if (data.resiliencyPolicies !== undefined && data.resiliencyPolicies !== null) {
2262
+ if (data.resiliencyPolicies != null) {
2427
2263
  contents.resiliencyPolicies = deserializeAws_restJson1ResiliencyPolicies(data.resiliencyPolicies, context);
2428
2264
  }
2429
- return Promise.resolve(contents);
2265
+ return contents;
2430
2266
  };
2431
2267
  exports.deserializeAws_restJson1ListSuggestedResiliencyPoliciesCommand = deserializeAws_restJson1ListSuggestedResiliencyPoliciesCommand;
2432
2268
  const deserializeAws_restJson1ListSuggestedResiliencyPoliciesCommandError = async (output, context) => {
@@ -2434,7 +2270,6 @@ const deserializeAws_restJson1ListSuggestedResiliencyPoliciesCommandError = asyn
2434
2270
  ...output,
2435
2271
  body: await parseBody(output.body, context),
2436
2272
  };
2437
- let response;
2438
2273
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2439
2274
  switch (errorCode) {
2440
2275
  case "AccessDeniedException":
@@ -2454,29 +2289,26 @@ const deserializeAws_restJson1ListSuggestedResiliencyPoliciesCommandError = asyn
2454
2289
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2455
2290
  default:
2456
2291
  const parsedBody = parsedOutput.body;
2457
- const $metadata = deserializeMetadata(output);
2458
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2459
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2460
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2461
- $fault: "client",
2462
- $metadata,
2292
+ (0, smithy_client_1.throwDefaultError)({
2293
+ output,
2294
+ parsedBody,
2295
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2296
+ errorCode,
2463
2297
  });
2464
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2465
2298
  }
2466
2299
  };
2467
2300
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2468
2301
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2469
2302
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2470
2303
  }
2471
- const contents = {
2304
+ const contents = map({
2472
2305
  $metadata: deserializeMetadata(output),
2473
- tags: undefined,
2474
- };
2306
+ });
2475
2307
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2476
- if (data.tags !== undefined && data.tags !== null) {
2308
+ if (data.tags != null) {
2477
2309
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
2478
2310
  }
2479
- return Promise.resolve(contents);
2311
+ return contents;
2480
2312
  };
2481
2313
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2482
2314
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -2484,7 +2316,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2484
2316
  ...output,
2485
2317
  body: await parseBody(output.body, context),
2486
2318
  };
2487
- let response;
2488
2319
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2489
2320
  switch (errorCode) {
2490
2321
  case "AccessDeniedException":
@@ -2504,33 +2335,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2504
2335
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2505
2336
  default:
2506
2337
  const parsedBody = parsedOutput.body;
2507
- const $metadata = deserializeMetadata(output);
2508
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2509
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2510
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2511
- $fault: "client",
2512
- $metadata,
2338
+ (0, smithy_client_1.throwDefaultError)({
2339
+ output,
2340
+ parsedBody,
2341
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2342
+ errorCode,
2513
2343
  });
2514
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2515
2344
  }
2516
2345
  };
2517
2346
  const deserializeAws_restJson1ListTestRecommendationsCommand = async (output, context) => {
2518
2347
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2519
2348
  return deserializeAws_restJson1ListTestRecommendationsCommandError(output, context);
2520
2349
  }
2521
- const contents = {
2350
+ const contents = map({
2522
2351
  $metadata: deserializeMetadata(output),
2523
- nextToken: undefined,
2524
- testRecommendations: undefined,
2525
- };
2352
+ });
2526
2353
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2527
- if (data.nextToken !== undefined && data.nextToken !== null) {
2354
+ if (data.nextToken != null) {
2528
2355
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2529
2356
  }
2530
- if (data.testRecommendations !== undefined && data.testRecommendations !== null) {
2357
+ if (data.testRecommendations != null) {
2531
2358
  contents.testRecommendations = deserializeAws_restJson1TestRecommendationList(data.testRecommendations, context);
2532
2359
  }
2533
- return Promise.resolve(contents);
2360
+ return contents;
2534
2361
  };
2535
2362
  exports.deserializeAws_restJson1ListTestRecommendationsCommand = deserializeAws_restJson1ListTestRecommendationsCommand;
2536
2363
  const deserializeAws_restJson1ListTestRecommendationsCommandError = async (output, context) => {
@@ -2538,7 +2365,6 @@ const deserializeAws_restJson1ListTestRecommendationsCommandError = async (outpu
2538
2365
  ...output,
2539
2366
  body: await parseBody(output.body, context),
2540
2367
  };
2541
- let response;
2542
2368
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2543
2369
  switch (errorCode) {
2544
2370
  case "AccessDeniedException":
@@ -2561,37 +2387,32 @@ const deserializeAws_restJson1ListTestRecommendationsCommandError = async (outpu
2561
2387
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2562
2388
  default:
2563
2389
  const parsedBody = parsedOutput.body;
2564
- const $metadata = deserializeMetadata(output);
2565
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2566
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2567
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2568
- $fault: "client",
2569
- $metadata,
2390
+ (0, smithy_client_1.throwDefaultError)({
2391
+ output,
2392
+ parsedBody,
2393
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2394
+ errorCode,
2570
2395
  });
2571
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2572
2396
  }
2573
2397
  };
2574
2398
  const deserializeAws_restJson1ListUnsupportedAppVersionResourcesCommand = async (output, context) => {
2575
2399
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2576
2400
  return deserializeAws_restJson1ListUnsupportedAppVersionResourcesCommandError(output, context);
2577
2401
  }
2578
- const contents = {
2402
+ const contents = map({
2579
2403
  $metadata: deserializeMetadata(output),
2580
- nextToken: undefined,
2581
- resolutionId: undefined,
2582
- unsupportedResources: undefined,
2583
- };
2404
+ });
2584
2405
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2585
- if (data.nextToken !== undefined && data.nextToken !== null) {
2406
+ if (data.nextToken != null) {
2586
2407
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2587
2408
  }
2588
- if (data.resolutionId !== undefined && data.resolutionId !== null) {
2409
+ if (data.resolutionId != null) {
2589
2410
  contents.resolutionId = (0, smithy_client_1.expectString)(data.resolutionId);
2590
2411
  }
2591
- if (data.unsupportedResources !== undefined && data.unsupportedResources !== null) {
2412
+ if (data.unsupportedResources != null) {
2592
2413
  contents.unsupportedResources = deserializeAws_restJson1UnsupportedResourceList(data.unsupportedResources, context);
2593
2414
  }
2594
- return Promise.resolve(contents);
2415
+ return contents;
2595
2416
  };
2596
2417
  exports.deserializeAws_restJson1ListUnsupportedAppVersionResourcesCommand = deserializeAws_restJson1ListUnsupportedAppVersionResourcesCommand;
2597
2418
  const deserializeAws_restJson1ListUnsupportedAppVersionResourcesCommandError = async (output, context) => {
@@ -2599,7 +2420,6 @@ const deserializeAws_restJson1ListUnsupportedAppVersionResourcesCommandError = a
2599
2420
  ...output,
2600
2421
  body: await parseBody(output.body, context),
2601
2422
  };
2602
- let response;
2603
2423
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2604
2424
  switch (errorCode) {
2605
2425
  case "AccessDeniedException":
@@ -2622,33 +2442,29 @@ const deserializeAws_restJson1ListUnsupportedAppVersionResourcesCommandError = a
2622
2442
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2623
2443
  default:
2624
2444
  const parsedBody = parsedOutput.body;
2625
- const $metadata = deserializeMetadata(output);
2626
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2627
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2628
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2629
- $fault: "client",
2630
- $metadata,
2445
+ (0, smithy_client_1.throwDefaultError)({
2446
+ output,
2447
+ parsedBody,
2448
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2449
+ errorCode,
2631
2450
  });
2632
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2633
2451
  }
2634
2452
  };
2635
2453
  const deserializeAws_restJson1PublishAppVersionCommand = async (output, context) => {
2636
2454
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2637
2455
  return deserializeAws_restJson1PublishAppVersionCommandError(output, context);
2638
2456
  }
2639
- const contents = {
2457
+ const contents = map({
2640
2458
  $metadata: deserializeMetadata(output),
2641
- appArn: undefined,
2642
- appVersion: undefined,
2643
- };
2459
+ });
2644
2460
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2645
- if (data.appArn !== undefined && data.appArn !== null) {
2461
+ if (data.appArn != null) {
2646
2462
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
2647
2463
  }
2648
- if (data.appVersion !== undefined && data.appVersion !== null) {
2464
+ if (data.appVersion != null) {
2649
2465
  contents.appVersion = (0, smithy_client_1.expectString)(data.appVersion);
2650
2466
  }
2651
- return Promise.resolve(contents);
2467
+ return contents;
2652
2468
  };
2653
2469
  exports.deserializeAws_restJson1PublishAppVersionCommand = deserializeAws_restJson1PublishAppVersionCommand;
2654
2470
  const deserializeAws_restJson1PublishAppVersionCommandError = async (output, context) => {
@@ -2656,7 +2472,6 @@ const deserializeAws_restJson1PublishAppVersionCommandError = async (output, con
2656
2472
  ...output,
2657
2473
  body: await parseBody(output.body, context),
2658
2474
  };
2659
- let response;
2660
2475
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2661
2476
  switch (errorCode) {
2662
2477
  case "AccessDeniedException":
@@ -2679,33 +2494,29 @@ const deserializeAws_restJson1PublishAppVersionCommandError = async (output, con
2679
2494
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2680
2495
  default:
2681
2496
  const parsedBody = parsedOutput.body;
2682
- const $metadata = deserializeMetadata(output);
2683
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2684
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2685
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2686
- $fault: "client",
2687
- $metadata,
2497
+ (0, smithy_client_1.throwDefaultError)({
2498
+ output,
2499
+ parsedBody,
2500
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2501
+ errorCode,
2688
2502
  });
2689
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2690
2503
  }
2691
2504
  };
2692
2505
  const deserializeAws_restJson1PutDraftAppVersionTemplateCommand = async (output, context) => {
2693
2506
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2694
2507
  return deserializeAws_restJson1PutDraftAppVersionTemplateCommandError(output, context);
2695
2508
  }
2696
- const contents = {
2509
+ const contents = map({
2697
2510
  $metadata: deserializeMetadata(output),
2698
- appArn: undefined,
2699
- appVersion: undefined,
2700
- };
2511
+ });
2701
2512
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2702
- if (data.appArn !== undefined && data.appArn !== null) {
2513
+ if (data.appArn != null) {
2703
2514
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
2704
2515
  }
2705
- if (data.appVersion !== undefined && data.appVersion !== null) {
2516
+ if (data.appVersion != null) {
2706
2517
  contents.appVersion = (0, smithy_client_1.expectString)(data.appVersion);
2707
2518
  }
2708
- return Promise.resolve(contents);
2519
+ return contents;
2709
2520
  };
2710
2521
  exports.deserializeAws_restJson1PutDraftAppVersionTemplateCommand = deserializeAws_restJson1PutDraftAppVersionTemplateCommand;
2711
2522
  const deserializeAws_restJson1PutDraftAppVersionTemplateCommandError = async (output, context) => {
@@ -2713,7 +2524,6 @@ const deserializeAws_restJson1PutDraftAppVersionTemplateCommandError = async (ou
2713
2524
  ...output,
2714
2525
  body: await parseBody(output.body, context),
2715
2526
  };
2716
- let response;
2717
2527
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2718
2528
  switch (errorCode) {
2719
2529
  case "AccessDeniedException":
@@ -2736,33 +2546,29 @@ const deserializeAws_restJson1PutDraftAppVersionTemplateCommandError = async (ou
2736
2546
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2737
2547
  default:
2738
2548
  const parsedBody = parsedOutput.body;
2739
- const $metadata = deserializeMetadata(output);
2740
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2741
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2742
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2743
- $fault: "client",
2744
- $metadata,
2549
+ (0, smithy_client_1.throwDefaultError)({
2550
+ output,
2551
+ parsedBody,
2552
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2553
+ errorCode,
2745
2554
  });
2746
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2747
2555
  }
2748
2556
  };
2749
2557
  const deserializeAws_restJson1RemoveDraftAppVersionResourceMappingsCommand = async (output, context) => {
2750
2558
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2751
2559
  return deserializeAws_restJson1RemoveDraftAppVersionResourceMappingsCommandError(output, context);
2752
2560
  }
2753
- const contents = {
2561
+ const contents = map({
2754
2562
  $metadata: deserializeMetadata(output),
2755
- appArn: undefined,
2756
- appVersion: undefined,
2757
- };
2563
+ });
2758
2564
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2759
- if (data.appArn !== undefined && data.appArn !== null) {
2565
+ if (data.appArn != null) {
2760
2566
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
2761
2567
  }
2762
- if (data.appVersion !== undefined && data.appVersion !== null) {
2568
+ if (data.appVersion != null) {
2763
2569
  contents.appVersion = (0, smithy_client_1.expectString)(data.appVersion);
2764
2570
  }
2765
- return Promise.resolve(contents);
2571
+ return contents;
2766
2572
  };
2767
2573
  exports.deserializeAws_restJson1RemoveDraftAppVersionResourceMappingsCommand = deserializeAws_restJson1RemoveDraftAppVersionResourceMappingsCommand;
2768
2574
  const deserializeAws_restJson1RemoveDraftAppVersionResourceMappingsCommandError = async (output, context) => {
@@ -2770,7 +2576,6 @@ const deserializeAws_restJson1RemoveDraftAppVersionResourceMappingsCommandError
2770
2576
  ...output,
2771
2577
  body: await parseBody(output.body, context),
2772
2578
  };
2773
- let response;
2774
2579
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2775
2580
  switch (errorCode) {
2776
2581
  case "AccessDeniedException":
@@ -2793,41 +2598,35 @@ const deserializeAws_restJson1RemoveDraftAppVersionResourceMappingsCommandError
2793
2598
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2794
2599
  default:
2795
2600
  const parsedBody = parsedOutput.body;
2796
- const $metadata = deserializeMetadata(output);
2797
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2798
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2799
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2800
- $fault: "client",
2801
- $metadata,
2601
+ (0, smithy_client_1.throwDefaultError)({
2602
+ output,
2603
+ parsedBody,
2604
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2605
+ errorCode,
2802
2606
  });
2803
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2804
2607
  }
2805
2608
  };
2806
2609
  const deserializeAws_restJson1ResolveAppVersionResourcesCommand = async (output, context) => {
2807
2610
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2808
2611
  return deserializeAws_restJson1ResolveAppVersionResourcesCommandError(output, context);
2809
2612
  }
2810
- const contents = {
2613
+ const contents = map({
2811
2614
  $metadata: deserializeMetadata(output),
2812
- appArn: undefined,
2813
- appVersion: undefined,
2814
- resolutionId: undefined,
2815
- status: undefined,
2816
- };
2615
+ });
2817
2616
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2818
- if (data.appArn !== undefined && data.appArn !== null) {
2617
+ if (data.appArn != null) {
2819
2618
  contents.appArn = (0, smithy_client_1.expectString)(data.appArn);
2820
2619
  }
2821
- if (data.appVersion !== undefined && data.appVersion !== null) {
2620
+ if (data.appVersion != null) {
2822
2621
  contents.appVersion = (0, smithy_client_1.expectString)(data.appVersion);
2823
2622
  }
2824
- if (data.resolutionId !== undefined && data.resolutionId !== null) {
2623
+ if (data.resolutionId != null) {
2825
2624
  contents.resolutionId = (0, smithy_client_1.expectString)(data.resolutionId);
2826
2625
  }
2827
- if (data.status !== undefined && data.status !== null) {
2626
+ if (data.status != null) {
2828
2627
  contents.status = (0, smithy_client_1.expectString)(data.status);
2829
2628
  }
2830
- return Promise.resolve(contents);
2629
+ return contents;
2831
2630
  };
2832
2631
  exports.deserializeAws_restJson1ResolveAppVersionResourcesCommand = deserializeAws_restJson1ResolveAppVersionResourcesCommand;
2833
2632
  const deserializeAws_restJson1ResolveAppVersionResourcesCommandError = async (output, context) => {
@@ -2835,7 +2634,6 @@ const deserializeAws_restJson1ResolveAppVersionResourcesCommandError = async (ou
2835
2634
  ...output,
2836
2635
  body: await parseBody(output.body, context),
2837
2636
  };
2838
- let response;
2839
2637
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2840
2638
  switch (errorCode) {
2841
2639
  case "AccessDeniedException":
@@ -2858,29 +2656,26 @@ const deserializeAws_restJson1ResolveAppVersionResourcesCommandError = async (ou
2858
2656
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2859
2657
  default:
2860
2658
  const parsedBody = parsedOutput.body;
2861
- const $metadata = deserializeMetadata(output);
2862
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2863
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2864
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2865
- $fault: "client",
2866
- $metadata,
2659
+ (0, smithy_client_1.throwDefaultError)({
2660
+ output,
2661
+ parsedBody,
2662
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2663
+ errorCode,
2867
2664
  });
2868
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2869
2665
  }
2870
2666
  };
2871
2667
  const deserializeAws_restJson1StartAppAssessmentCommand = async (output, context) => {
2872
2668
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2873
2669
  return deserializeAws_restJson1StartAppAssessmentCommandError(output, context);
2874
2670
  }
2875
- const contents = {
2671
+ const contents = map({
2876
2672
  $metadata: deserializeMetadata(output),
2877
- assessment: undefined,
2878
- };
2673
+ });
2879
2674
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2880
- if (data.assessment !== undefined && data.assessment !== null) {
2675
+ if (data.assessment != null) {
2881
2676
  contents.assessment = deserializeAws_restJson1AppAssessment(data.assessment, context);
2882
2677
  }
2883
- return Promise.resolve(contents);
2678
+ return contents;
2884
2679
  };
2885
2680
  exports.deserializeAws_restJson1StartAppAssessmentCommand = deserializeAws_restJson1StartAppAssessmentCommand;
2886
2681
  const deserializeAws_restJson1StartAppAssessmentCommandError = async (output, context) => {
@@ -2888,7 +2683,6 @@ const deserializeAws_restJson1StartAppAssessmentCommandError = async (output, co
2888
2683
  ...output,
2889
2684
  body: await parseBody(output.body, context),
2890
2685
  };
2891
- let response;
2892
2686
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2893
2687
  switch (errorCode) {
2894
2688
  case "AccessDeniedException":
@@ -2914,25 +2708,23 @@ const deserializeAws_restJson1StartAppAssessmentCommandError = async (output, co
2914
2708
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2915
2709
  default:
2916
2710
  const parsedBody = parsedOutput.body;
2917
- const $metadata = deserializeMetadata(output);
2918
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2919
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2920
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2921
- $fault: "client",
2922
- $metadata,
2711
+ (0, smithy_client_1.throwDefaultError)({
2712
+ output,
2713
+ parsedBody,
2714
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2715
+ errorCode,
2923
2716
  });
2924
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2925
2717
  }
2926
2718
  };
2927
2719
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2928
2720
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2929
2721
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2930
2722
  }
2931
- const contents = {
2723
+ const contents = map({
2932
2724
  $metadata: deserializeMetadata(output),
2933
- };
2725
+ });
2934
2726
  await collectBody(output.body, context);
2935
- return Promise.resolve(contents);
2727
+ return contents;
2936
2728
  };
2937
2729
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2938
2730
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2940,7 +2732,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2940
2732
  ...output,
2941
2733
  body: await parseBody(output.body, context),
2942
2734
  };
2943
- let response;
2944
2735
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2945
2736
  switch (errorCode) {
2946
2737
  case "AccessDeniedException":
@@ -2960,25 +2751,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2960
2751
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2961
2752
  default:
2962
2753
  const parsedBody = parsedOutput.body;
2963
- const $metadata = deserializeMetadata(output);
2964
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2965
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
2966
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2967
- $fault: "client",
2968
- $metadata,
2754
+ (0, smithy_client_1.throwDefaultError)({
2755
+ output,
2756
+ parsedBody,
2757
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2758
+ errorCode,
2969
2759
  });
2970
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2971
2760
  }
2972
2761
  };
2973
2762
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2974
2763
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2975
2764
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2976
2765
  }
2977
- const contents = {
2766
+ const contents = map({
2978
2767
  $metadata: deserializeMetadata(output),
2979
- };
2768
+ });
2980
2769
  await collectBody(output.body, context);
2981
- return Promise.resolve(contents);
2770
+ return contents;
2982
2771
  };
2983
2772
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2984
2773
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2986,7 +2775,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2986
2775
  ...output,
2987
2776
  body: await parseBody(output.body, context),
2988
2777
  };
2989
- let response;
2990
2778
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2991
2779
  switch (errorCode) {
2992
2780
  case "AccessDeniedException":
@@ -3006,29 +2794,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3006
2794
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3007
2795
  default:
3008
2796
  const parsedBody = parsedOutput.body;
3009
- const $metadata = deserializeMetadata(output);
3010
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3011
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
3012
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3013
- $fault: "client",
3014
- $metadata,
2797
+ (0, smithy_client_1.throwDefaultError)({
2798
+ output,
2799
+ parsedBody,
2800
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2801
+ errorCode,
3015
2802
  });
3016
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3017
2803
  }
3018
2804
  };
3019
2805
  const deserializeAws_restJson1UpdateAppCommand = async (output, context) => {
3020
2806
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3021
2807
  return deserializeAws_restJson1UpdateAppCommandError(output, context);
3022
2808
  }
3023
- const contents = {
2809
+ const contents = map({
3024
2810
  $metadata: deserializeMetadata(output),
3025
- app: undefined,
3026
- };
2811
+ });
3027
2812
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3028
- if (data.app !== undefined && data.app !== null) {
2813
+ if (data.app != null) {
3029
2814
  contents.app = deserializeAws_restJson1App(data.app, context);
3030
2815
  }
3031
- return Promise.resolve(contents);
2816
+ return contents;
3032
2817
  };
3033
2818
  exports.deserializeAws_restJson1UpdateAppCommand = deserializeAws_restJson1UpdateAppCommand;
3034
2819
  const deserializeAws_restJson1UpdateAppCommandError = async (output, context) => {
@@ -3036,7 +2821,6 @@ const deserializeAws_restJson1UpdateAppCommandError = async (output, context) =>
3036
2821
  ...output,
3037
2822
  body: await parseBody(output.body, context),
3038
2823
  };
3039
- let response;
3040
2824
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3041
2825
  switch (errorCode) {
3042
2826
  case "AccessDeniedException":
@@ -3059,29 +2843,26 @@ const deserializeAws_restJson1UpdateAppCommandError = async (output, context) =>
3059
2843
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3060
2844
  default:
3061
2845
  const parsedBody = parsedOutput.body;
3062
- const $metadata = deserializeMetadata(output);
3063
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3064
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
3065
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3066
- $fault: "client",
3067
- $metadata,
2846
+ (0, smithy_client_1.throwDefaultError)({
2847
+ output,
2848
+ parsedBody,
2849
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2850
+ errorCode,
3068
2851
  });
3069
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3070
2852
  }
3071
2853
  };
3072
2854
  const deserializeAws_restJson1UpdateResiliencyPolicyCommand = async (output, context) => {
3073
2855
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3074
2856
  return deserializeAws_restJson1UpdateResiliencyPolicyCommandError(output, context);
3075
2857
  }
3076
- const contents = {
2858
+ const contents = map({
3077
2859
  $metadata: deserializeMetadata(output),
3078
- policy: undefined,
3079
- };
2860
+ });
3080
2861
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3081
- if (data.policy !== undefined && data.policy !== null) {
2862
+ if (data.policy != null) {
3082
2863
  contents.policy = deserializeAws_restJson1ResiliencyPolicy(data.policy, context);
3083
2864
  }
3084
- return Promise.resolve(contents);
2865
+ return contents;
3085
2866
  };
3086
2867
  exports.deserializeAws_restJson1UpdateResiliencyPolicyCommand = deserializeAws_restJson1UpdateResiliencyPolicyCommand;
3087
2868
  const deserializeAws_restJson1UpdateResiliencyPolicyCommandError = async (output, context) => {
@@ -3089,7 +2870,6 @@ const deserializeAws_restJson1UpdateResiliencyPolicyCommandError = async (output
3089
2870
  ...output,
3090
2871
  body: await parseBody(output.body, context),
3091
2872
  };
3092
- let response;
3093
2873
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3094
2874
  switch (errorCode) {
3095
2875
  case "AccessDeniedException":
@@ -3112,20 +2892,19 @@ const deserializeAws_restJson1UpdateResiliencyPolicyCommandError = async (output
3112
2892
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3113
2893
  default:
3114
2894
  const parsedBody = parsedOutput.body;
3115
- const $metadata = deserializeMetadata(output);
3116
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3117
- response = new ResiliencehubServiceException_1.ResiliencehubServiceException({
3118
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3119
- $fault: "client",
3120
- $metadata,
2895
+ (0, smithy_client_1.throwDefaultError)({
2896
+ output,
2897
+ parsedBody,
2898
+ exceptionCtor: ResiliencehubServiceException_1.ResiliencehubServiceException,
2899
+ errorCode,
3121
2900
  });
3122
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3123
2901
  }
3124
2902
  };
2903
+ const map = smithy_client_1.map;
3125
2904
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
3126
- const contents = {};
2905
+ const contents = map({});
3127
2906
  const data = parsedOutput.body;
3128
- if (data.message !== undefined && data.message !== null) {
2907
+ if (data.message != null) {
3129
2908
  contents.message = (0, smithy_client_1.expectString)(data.message);
3130
2909
  }
3131
2910
  const exception = new models_0_1.AccessDeniedException({
@@ -3135,15 +2914,15 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
3135
2914
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3136
2915
  };
3137
2916
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
3138
- const contents = {};
2917
+ const contents = map({});
3139
2918
  const data = parsedOutput.body;
3140
- if (data.message !== undefined && data.message !== null) {
2919
+ if (data.message != null) {
3141
2920
  contents.message = (0, smithy_client_1.expectString)(data.message);
3142
2921
  }
3143
- if (data.resourceId !== undefined && data.resourceId !== null) {
2922
+ if (data.resourceId != null) {
3144
2923
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
3145
2924
  }
3146
- if (data.resourceType !== undefined && data.resourceType !== null) {
2925
+ if (data.resourceType != null) {
3147
2926
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
3148
2927
  }
3149
2928
  const exception = new models_0_1.ConflictException({
@@ -3153,9 +2932,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
3153
2932
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3154
2933
  };
3155
2934
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
3156
- const contents = {};
2935
+ const contents = map({});
3157
2936
  const data = parsedOutput.body;
3158
- if (data.message !== undefined && data.message !== null) {
2937
+ if (data.message != null) {
3159
2938
  contents.message = (0, smithy_client_1.expectString)(data.message);
3160
2939
  }
3161
2940
  const exception = new models_0_1.InternalServerException({
@@ -3165,15 +2944,15 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
3165
2944
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3166
2945
  };
3167
2946
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
3168
- const contents = {};
2947
+ const contents = map({});
3169
2948
  const data = parsedOutput.body;
3170
- if (data.message !== undefined && data.message !== null) {
2949
+ if (data.message != null) {
3171
2950
  contents.message = (0, smithy_client_1.expectString)(data.message);
3172
2951
  }
3173
- if (data.resourceId !== undefined && data.resourceId !== null) {
2952
+ if (data.resourceId != null) {
3174
2953
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
3175
2954
  }
3176
- if (data.resourceType !== undefined && data.resourceType !== null) {
2955
+ if (data.resourceType != null) {
3177
2956
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
3178
2957
  }
3179
2958
  const exception = new models_0_1.ResourceNotFoundException({
@@ -3183,9 +2962,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
3183
2962
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3184
2963
  };
3185
2964
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
3186
- const contents = {};
2965
+ const contents = map({});
3187
2966
  const data = parsedOutput.body;
3188
- if (data.message !== undefined && data.message !== null) {
2967
+ if (data.message != null) {
3189
2968
  contents.message = (0, smithy_client_1.expectString)(data.message);
3190
2969
  }
3191
2970
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -3195,12 +2974,12 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
3195
2974
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3196
2975
  };
3197
2976
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
3198
- const contents = {};
2977
+ const contents = map({});
3199
2978
  const data = parsedOutput.body;
3200
- if (data.message !== undefined && data.message !== null) {
2979
+ if (data.message != null) {
3201
2980
  contents.message = (0, smithy_client_1.expectString)(data.message);
3202
2981
  }
3203
- if (data.retryAfterSeconds !== undefined && data.retryAfterSeconds !== null) {
2982
+ if (data.retryAfterSeconds != null) {
3204
2983
  contents.retryAfterSeconds = (0, smithy_client_1.expectInt32)(data.retryAfterSeconds);
3205
2984
  }
3206
2985
  const exception = new models_0_1.ThrottlingException({
@@ -3210,9 +2989,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
3210
2989
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
3211
2990
  };
3212
2991
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
3213
- const contents = {};
2992
+ const contents = map({});
3214
2993
  const data = parsedOutput.body;
3215
- if (data.message !== undefined && data.message !== null) {
2994
+ if (data.message != null) {
3216
2995
  contents.message = (0, smithy_client_1.expectString)(data.message);
3217
2996
  }
3218
2997
  const exception = new models_0_1.ValidationException({
@@ -3225,9 +3004,6 @@ const serializeAws_restJson1ArnList = (input, context) => {
3225
3004
  return input
3226
3005
  .filter((e) => e != null)
3227
3006
  .map((entry) => {
3228
- if (entry === null) {
3229
- return null;
3230
- }
3231
3007
  return entry;
3232
3008
  });
3233
3009
  };
@@ -3246,9 +3022,6 @@ const serializeAws_restJson1EntityNameList = (input, context) => {
3246
3022
  return input
3247
3023
  .filter((e) => e != null)
3248
3024
  .map((entry) => {
3249
- if (entry === null) {
3250
- return null;
3251
- }
3252
3025
  return entry;
3253
3026
  });
3254
3027
  };
@@ -3270,9 +3043,6 @@ const serializeAws_restJson1RecommendationIdList = (input, context) => {
3270
3043
  return input
3271
3044
  .filter((e) => e != null)
3272
3045
  .map((entry) => {
3273
- if (entry === null) {
3274
- return null;
3275
- }
3276
3046
  return entry;
3277
3047
  });
3278
3048
  };
@@ -3280,9 +3050,6 @@ const serializeAws_restJson1RenderRecommendationTypeList = (input, context) => {
3280
3050
  return input
3281
3051
  .filter((e) => e != null)
3282
3052
  .map((entry) => {
3283
- if (entry === null) {
3284
- return null;
3285
- }
3286
3053
  return entry;
3287
3054
  });
3288
3055
  };
@@ -3303,9 +3070,6 @@ const serializeAws_restJson1ResourceMappingList = (input, context) => {
3303
3070
  return input
3304
3071
  .filter((e) => e != null)
3305
3072
  .map((entry) => {
3306
- if (entry === null) {
3307
- return null;
3308
- }
3309
3073
  return serializeAws_restJson1ResourceMapping(entry, context);
3310
3074
  });
3311
3075
  };
@@ -3313,9 +3077,6 @@ const serializeAws_restJson1String255List = (input, context) => {
3313
3077
  return input
3314
3078
  .filter((e) => e != null)
3315
3079
  .map((entry) => {
3316
- if (entry === null) {
3317
- return null;
3318
- }
3319
3080
  return entry;
3320
3081
  });
3321
3082
  };
@@ -3339,9 +3100,6 @@ const serializeAws_restJson1TerraformSourceList = (input, context) => {
3339
3100
  return input
3340
3101
  .filter((e) => e != null)
3341
3102
  .map((entry) => {
3342
- if (entry === null) {
3343
- return null;
3344
- }
3345
3103
  return serializeAws_restJson1TerraformSource(entry, context);
3346
3104
  });
3347
3105
  };