@aws-sdk/client-macie2 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.
@@ -252,16 +252,7 @@ const serializeAws_restJson1DeleteCustomDataIdentifierCommand = async (input, co
252
252
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
253
253
  const headers = {};
254
254
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/custom-data-identifiers/{id}";
255
- if (input.id !== undefined) {
256
- const labelValue = input.id;
257
- if (labelValue.length <= 0) {
258
- throw new Error("Empty value provided for input HTTP label: id.");
259
- }
260
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
261
- }
262
- else {
263
- throw new Error("No value provided for input HTTP label: id.");
264
- }
255
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
265
256
  let body;
266
257
  return new protocol_http_1.HttpRequest({
267
258
  protocol,
@@ -278,16 +269,7 @@ const serializeAws_restJson1DeleteFindingsFilterCommand = async (input, context)
278
269
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
279
270
  const headers = {};
280
271
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/findingsfilters/{id}";
281
- if (input.id !== undefined) {
282
- const labelValue = input.id;
283
- if (labelValue.length <= 0) {
284
- throw new Error("Empty value provided for input HTTP label: id.");
285
- }
286
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
287
- }
288
- else {
289
- throw new Error("No value provided for input HTTP label: id.");
290
- }
272
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
291
273
  let body;
292
274
  return new protocol_http_1.HttpRequest({
293
275
  protocol,
@@ -325,16 +307,7 @@ const serializeAws_restJson1DeleteMemberCommand = async (input, context) => {
325
307
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
326
308
  const headers = {};
327
309
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/members/{id}";
328
- if (input.id !== undefined) {
329
- const labelValue = input.id;
330
- if (labelValue.length <= 0) {
331
- throw new Error("Empty value provided for input HTTP label: id.");
332
- }
333
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
334
- }
335
- else {
336
- throw new Error("No value provided for input HTTP label: id.");
337
- }
310
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
338
311
  let body;
339
312
  return new protocol_http_1.HttpRequest({
340
313
  protocol,
@@ -377,16 +350,7 @@ const serializeAws_restJson1DescribeClassificationJobCommand = async (input, con
377
350
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
378
351
  const headers = {};
379
352
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}";
380
- if (input.jobId !== undefined) {
381
- const labelValue = input.jobId;
382
- if (labelValue.length <= 0) {
383
- throw new Error("Empty value provided for input HTTP label: jobId.");
384
- }
385
- resolvedPath = resolvedPath.replace("{jobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
386
- }
387
- else {
388
- throw new Error("No value provided for input HTTP label: jobId.");
389
- }
353
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
390
354
  let body;
391
355
  return new protocol_http_1.HttpRequest({
392
356
  protocol,
@@ -441,9 +405,9 @@ const serializeAws_restJson1DisableOrganizationAdminAccountCommand = async (inpu
441
405
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
442
406
  const headers = {};
443
407
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/admin";
444
- const query = {
445
- ...(input.adminAccountId !== undefined && { adminAccountId: input.adminAccountId }),
446
- };
408
+ const query = map({
409
+ adminAccountId: [, input.adminAccountId],
410
+ });
447
411
  let body;
448
412
  return new protocol_http_1.HttpRequest({
449
413
  protocol,
@@ -499,16 +463,7 @@ const serializeAws_restJson1DisassociateMemberCommand = async (input, context) =
499
463
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
500
464
  const headers = {};
501
465
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/members/disassociate/{id}";
502
- if (input.id !== undefined) {
503
- const labelValue = input.id;
504
- if (labelValue.length <= 0) {
505
- throw new Error("Empty value provided for input HTTP label: id.");
506
- }
507
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
508
- }
509
- else {
510
- throw new Error("No value provided for input HTTP label: id.");
511
- }
466
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
512
467
  let body;
513
468
  return new protocol_http_1.HttpRequest({
514
469
  protocol,
@@ -631,16 +586,7 @@ const serializeAws_restJson1GetCustomDataIdentifierCommand = async (input, conte
631
586
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
632
587
  const headers = {};
633
588
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/custom-data-identifiers/{id}";
634
- if (input.id !== undefined) {
635
- const labelValue = input.id;
636
- if (labelValue.length <= 0) {
637
- throw new Error("Empty value provided for input HTTP label: id.");
638
- }
639
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
640
- }
641
- else {
642
- throw new Error("No value provided for input HTTP label: id.");
643
- }
589
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
644
590
  let body;
645
591
  return new protocol_http_1.HttpRequest({
646
592
  protocol,
@@ -681,16 +627,7 @@ const serializeAws_restJson1GetFindingsFilterCommand = async (input, context) =>
681
627
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
682
628
  const headers = {};
683
629
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/findingsfilters/{id}";
684
- if (input.id !== undefined) {
685
- const labelValue = input.id;
686
- if (labelValue.length <= 0) {
687
- throw new Error("Empty value provided for input HTTP label: id.");
688
- }
689
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
690
- }
691
- else {
692
- throw new Error("No value provided for input HTTP label: id.");
693
- }
630
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
694
631
  let body;
695
632
  return new protocol_http_1.HttpRequest({
696
633
  protocol,
@@ -811,16 +748,7 @@ const serializeAws_restJson1GetMemberCommand = async (input, context) => {
811
748
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
812
749
  const headers = {};
813
750
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/members/{id}";
814
- if (input.id !== undefined) {
815
- const labelValue = input.id;
816
- if (labelValue.length <= 0) {
817
- throw new Error("Empty value provided for input HTTP label: id.");
818
- }
819
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
820
- }
821
- else {
822
- throw new Error("No value provided for input HTTP label: id.");
823
- }
751
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
824
752
  let body;
825
753
  return new protocol_http_1.HttpRequest({
826
754
  protocol,
@@ -856,16 +784,7 @@ const serializeAws_restJson1GetSensitiveDataOccurrencesCommand = async (input, c
856
784
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
857
785
  const headers = {};
858
786
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/findings/{findingId}/reveal";
859
- if (input.findingId !== undefined) {
860
- const labelValue = input.findingId;
861
- if (labelValue.length <= 0) {
862
- throw new Error("Empty value provided for input HTTP label: findingId.");
863
- }
864
- resolvedPath = resolvedPath.replace("{findingId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
865
- }
866
- else {
867
- throw new Error("No value provided for input HTTP label: findingId.");
868
- }
787
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "findingId", () => input.findingId, "{findingId}", false);
869
788
  let body;
870
789
  return new protocol_http_1.HttpRequest({
871
790
  protocol,
@@ -882,16 +801,7 @@ const serializeAws_restJson1GetSensitiveDataOccurrencesAvailabilityCommand = asy
882
801
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
883
802
  const headers = {};
884
803
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/findings/{findingId}/reveal/availability";
885
- if (input.findingId !== undefined) {
886
- const labelValue = input.findingId;
887
- if (labelValue.length <= 0) {
888
- throw new Error("Empty value provided for input HTTP label: findingId.");
889
- }
890
- resolvedPath = resolvedPath.replace("{findingId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
891
- }
892
- else {
893
- throw new Error("No value provided for input HTTP label: findingId.");
894
- }
804
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "findingId", () => input.findingId, "{findingId}", false);
895
805
  let body;
896
806
  return new protocol_http_1.HttpRequest({
897
807
  protocol,
@@ -935,9 +845,9 @@ const serializeAws_restJson1GetUsageTotalsCommand = async (input, context) => {
935
845
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
936
846
  const headers = {};
937
847
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/usage";
938
- const query = {
939
- ...(input.timeRange !== undefined && { timeRange: input.timeRange }),
940
- };
848
+ const query = map({
849
+ timeRange: [, input.timeRange],
850
+ });
941
851
  let body;
942
852
  return new protocol_http_1.HttpRequest({
943
853
  protocol,
@@ -1033,10 +943,10 @@ const serializeAws_restJson1ListFindingsFiltersCommand = async (input, context)
1033
943
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1034
944
  const headers = {};
1035
945
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/findingsfilters";
1036
- const query = {
1037
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1038
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1039
- };
946
+ const query = map({
947
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
948
+ nextToken: [, input.nextToken],
949
+ });
1040
950
  let body;
1041
951
  return new protocol_http_1.HttpRequest({
1042
952
  protocol,
@@ -1054,10 +964,10 @@ const serializeAws_restJson1ListInvitationsCommand = async (input, context) => {
1054
964
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1055
965
  const headers = {};
1056
966
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/invitations";
1057
- const query = {
1058
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1059
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1060
- };
967
+ const query = map({
968
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
969
+ nextToken: [, input.nextToken],
970
+ });
1061
971
  let body;
1062
972
  return new protocol_http_1.HttpRequest({
1063
973
  protocol,
@@ -1096,11 +1006,11 @@ const serializeAws_restJson1ListMembersCommand = async (input, context) => {
1096
1006
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1097
1007
  const headers = {};
1098
1008
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/members";
1099
- const query = {
1100
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1101
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1102
- ...(input.onlyAssociated !== undefined && { onlyAssociated: input.onlyAssociated }),
1103
- };
1009
+ const query = map({
1010
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
1011
+ nextToken: [, input.nextToken],
1012
+ onlyAssociated: [, input.onlyAssociated],
1013
+ });
1104
1014
  let body;
1105
1015
  return new protocol_http_1.HttpRequest({
1106
1016
  protocol,
@@ -1118,10 +1028,10 @@ const serializeAws_restJson1ListOrganizationAdminAccountsCommand = async (input,
1118
1028
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1119
1029
  const headers = {};
1120
1030
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/admin";
1121
- const query = {
1122
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1123
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1124
- };
1031
+ const query = map({
1032
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
1033
+ nextToken: [, input.nextToken],
1034
+ });
1125
1035
  let body;
1126
1036
  return new protocol_http_1.HttpRequest({
1127
1037
  protocol,
@@ -1139,16 +1049,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
1139
1049
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1140
1050
  const headers = {};
1141
1051
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
1142
- if (input.resourceArn !== undefined) {
1143
- const labelValue = input.resourceArn;
1144
- if (labelValue.length <= 0) {
1145
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1146
- }
1147
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1148
- }
1149
- else {
1150
- throw new Error("No value provided for input HTTP label: resourceArn.");
1151
- }
1052
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
1152
1053
  let body;
1153
1054
  return new protocol_http_1.HttpRequest({
1154
1055
  protocol,
@@ -1243,16 +1144,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
1243
1144
  "content-type": "application/json",
1244
1145
  };
1245
1146
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
1246
- if (input.resourceArn !== undefined) {
1247
- const labelValue = input.resourceArn;
1248
- if (labelValue.length <= 0) {
1249
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1250
- }
1251
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1252
- }
1253
- else {
1254
- throw new Error("No value provided for input HTTP label: resourceArn.");
1255
- }
1147
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
1256
1148
  let body;
1257
1149
  body = JSON.stringify({
1258
1150
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -1299,19 +1191,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
1299
1191
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1300
1192
  const headers = {};
1301
1193
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
1302
- if (input.resourceArn !== undefined) {
1303
- const labelValue = input.resourceArn;
1304
- if (labelValue.length <= 0) {
1305
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1306
- }
1307
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1308
- }
1309
- else {
1310
- throw new Error("No value provided for input HTTP label: resourceArn.");
1311
- }
1312
- const query = {
1313
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
1314
- };
1194
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
1195
+ const query = map({
1196
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
1197
+ });
1315
1198
  let body;
1316
1199
  return new protocol_http_1.HttpRequest({
1317
1200
  protocol,
@@ -1331,16 +1214,7 @@ const serializeAws_restJson1UpdateClassificationJobCommand = async (input, conte
1331
1214
  "content-type": "application/json",
1332
1215
  };
1333
1216
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/jobs/{jobId}";
1334
- if (input.jobId !== undefined) {
1335
- const labelValue = input.jobId;
1336
- if (labelValue.length <= 0) {
1337
- throw new Error("Empty value provided for input HTTP label: jobId.");
1338
- }
1339
- resolvedPath = resolvedPath.replace("{jobId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1340
- }
1341
- else {
1342
- throw new Error("No value provided for input HTTP label: jobId.");
1343
- }
1217
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
1344
1218
  let body;
1345
1219
  body = JSON.stringify({
1346
1220
  ...(input.jobStatus != null && { jobStatus: input.jobStatus }),
@@ -1363,16 +1237,7 @@ const serializeAws_restJson1UpdateFindingsFilterCommand = async (input, context)
1363
1237
  "content-type": "application/json",
1364
1238
  };
1365
1239
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/findingsfilters/{id}";
1366
- if (input.id !== undefined) {
1367
- const labelValue = input.id;
1368
- if (labelValue.length <= 0) {
1369
- throw new Error("Empty value provided for input HTTP label: id.");
1370
- }
1371
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1372
- }
1373
- else {
1374
- throw new Error("No value provided for input HTTP label: id.");
1375
- }
1240
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
1376
1241
  let body;
1377
1242
  body = JSON.stringify({
1378
1243
  ...(input.action != null && { action: input.action }),
@@ -1423,16 +1288,7 @@ const serializeAws_restJson1UpdateMemberSessionCommand = async (input, context)
1423
1288
  "content-type": "application/json",
1424
1289
  };
1425
1290
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/macie/members/{id}";
1426
- if (input.id !== undefined) {
1427
- const labelValue = input.id;
1428
- if (labelValue.length <= 0) {
1429
- throw new Error("Empty value provided for input HTTP label: id.");
1430
- }
1431
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1432
- }
1433
- else {
1434
- throw new Error("No value provided for input HTTP label: id.");
1435
- }
1291
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
1436
1292
  let body;
1437
1293
  body = JSON.stringify({
1438
1294
  ...(input.status != null && { status: input.status }),
@@ -1496,11 +1352,11 @@ const deserializeAws_restJson1AcceptInvitationCommand = async (output, context)
1496
1352
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1497
1353
  return deserializeAws_restJson1AcceptInvitationCommandError(output, context);
1498
1354
  }
1499
- const contents = {
1355
+ const contents = map({
1500
1356
  $metadata: deserializeMetadata(output),
1501
- };
1357
+ });
1502
1358
  await collectBody(output.body, context);
1503
- return Promise.resolve(contents);
1359
+ return contents;
1504
1360
  };
1505
1361
  exports.deserializeAws_restJson1AcceptInvitationCommand = deserializeAws_restJson1AcceptInvitationCommand;
1506
1362
  const deserializeAws_restJson1AcceptInvitationCommandError = async (output, context) => {
@@ -1508,7 +1364,6 @@ const deserializeAws_restJson1AcceptInvitationCommandError = async (output, cont
1508
1364
  ...output,
1509
1365
  body: await parseBody(output.body, context),
1510
1366
  };
1511
- let response;
1512
1367
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1513
1368
  switch (errorCode) {
1514
1369
  case "AccessDeniedException":
@@ -1534,33 +1389,29 @@ const deserializeAws_restJson1AcceptInvitationCommandError = async (output, cont
1534
1389
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1535
1390
  default:
1536
1391
  const parsedBody = parsedOutput.body;
1537
- const $metadata = deserializeMetadata(output);
1538
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1539
- response = new Macie2ServiceException_1.Macie2ServiceException({
1540
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1541
- $fault: "client",
1542
- $metadata,
1392
+ (0, smithy_client_1.throwDefaultError)({
1393
+ output,
1394
+ parsedBody,
1395
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1396
+ errorCode,
1543
1397
  });
1544
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1545
1398
  }
1546
1399
  };
1547
1400
  const deserializeAws_restJson1BatchGetCustomDataIdentifiersCommand = async (output, context) => {
1548
1401
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1549
1402
  return deserializeAws_restJson1BatchGetCustomDataIdentifiersCommandError(output, context);
1550
1403
  }
1551
- const contents = {
1404
+ const contents = map({
1552
1405
  $metadata: deserializeMetadata(output),
1553
- customDataIdentifiers: undefined,
1554
- notFoundIdentifierIds: undefined,
1555
- };
1406
+ });
1556
1407
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1557
- if (data.customDataIdentifiers !== undefined && data.customDataIdentifiers !== null) {
1408
+ if (data.customDataIdentifiers != null) {
1558
1409
  contents.customDataIdentifiers = deserializeAws_restJson1__listOfBatchGetCustomDataIdentifierSummary(data.customDataIdentifiers, context);
1559
1410
  }
1560
- if (data.notFoundIdentifierIds !== undefined && data.notFoundIdentifierIds !== null) {
1411
+ if (data.notFoundIdentifierIds != null) {
1561
1412
  contents.notFoundIdentifierIds = deserializeAws_restJson1__listOf__string(data.notFoundIdentifierIds, context);
1562
1413
  }
1563
- return Promise.resolve(contents);
1414
+ return contents;
1564
1415
  };
1565
1416
  exports.deserializeAws_restJson1BatchGetCustomDataIdentifiersCommand = deserializeAws_restJson1BatchGetCustomDataIdentifiersCommand;
1566
1417
  const deserializeAws_restJson1BatchGetCustomDataIdentifiersCommandError = async (output, context) => {
@@ -1568,7 +1419,6 @@ const deserializeAws_restJson1BatchGetCustomDataIdentifiersCommandError = async
1568
1419
  ...output,
1569
1420
  body: await parseBody(output.body, context),
1570
1421
  };
1571
- let response;
1572
1422
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1573
1423
  switch (errorCode) {
1574
1424
  case "AccessDeniedException":
@@ -1594,33 +1444,29 @@ const deserializeAws_restJson1BatchGetCustomDataIdentifiersCommandError = async
1594
1444
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1595
1445
  default:
1596
1446
  const parsedBody = parsedOutput.body;
1597
- const $metadata = deserializeMetadata(output);
1598
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1599
- response = new Macie2ServiceException_1.Macie2ServiceException({
1600
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1601
- $fault: "client",
1602
- $metadata,
1447
+ (0, smithy_client_1.throwDefaultError)({
1448
+ output,
1449
+ parsedBody,
1450
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1451
+ errorCode,
1603
1452
  });
1604
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1605
1453
  }
1606
1454
  };
1607
1455
  const deserializeAws_restJson1CreateClassificationJobCommand = async (output, context) => {
1608
1456
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1609
1457
  return deserializeAws_restJson1CreateClassificationJobCommandError(output, context);
1610
1458
  }
1611
- const contents = {
1459
+ const contents = map({
1612
1460
  $metadata: deserializeMetadata(output),
1613
- jobArn: undefined,
1614
- jobId: undefined,
1615
- };
1461
+ });
1616
1462
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1617
- if (data.jobArn !== undefined && data.jobArn !== null) {
1463
+ if (data.jobArn != null) {
1618
1464
  contents.jobArn = (0, smithy_client_1.expectString)(data.jobArn);
1619
1465
  }
1620
- if (data.jobId !== undefined && data.jobId !== null) {
1466
+ if (data.jobId != null) {
1621
1467
  contents.jobId = (0, smithy_client_1.expectString)(data.jobId);
1622
1468
  }
1623
- return Promise.resolve(contents);
1469
+ return contents;
1624
1470
  };
1625
1471
  exports.deserializeAws_restJson1CreateClassificationJobCommand = deserializeAws_restJson1CreateClassificationJobCommand;
1626
1472
  const deserializeAws_restJson1CreateClassificationJobCommandError = async (output, context) => {
@@ -1628,7 +1474,6 @@ const deserializeAws_restJson1CreateClassificationJobCommandError = async (outpu
1628
1474
  ...output,
1629
1475
  body: await parseBody(output.body, context),
1630
1476
  };
1631
- let response;
1632
1477
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1633
1478
  switch (errorCode) {
1634
1479
  case "AccessDeniedException":
@@ -1654,29 +1499,26 @@ const deserializeAws_restJson1CreateClassificationJobCommandError = async (outpu
1654
1499
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1655
1500
  default:
1656
1501
  const parsedBody = parsedOutput.body;
1657
- const $metadata = deserializeMetadata(output);
1658
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1659
- response = new Macie2ServiceException_1.Macie2ServiceException({
1660
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1661
- $fault: "client",
1662
- $metadata,
1502
+ (0, smithy_client_1.throwDefaultError)({
1503
+ output,
1504
+ parsedBody,
1505
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1506
+ errorCode,
1663
1507
  });
1664
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1665
1508
  }
1666
1509
  };
1667
1510
  const deserializeAws_restJson1CreateCustomDataIdentifierCommand = async (output, context) => {
1668
1511
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1669
1512
  return deserializeAws_restJson1CreateCustomDataIdentifierCommandError(output, context);
1670
1513
  }
1671
- const contents = {
1514
+ const contents = map({
1672
1515
  $metadata: deserializeMetadata(output),
1673
- customDataIdentifierId: undefined,
1674
- };
1516
+ });
1675
1517
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1676
- if (data.customDataIdentifierId !== undefined && data.customDataIdentifierId !== null) {
1518
+ if (data.customDataIdentifierId != null) {
1677
1519
  contents.customDataIdentifierId = (0, smithy_client_1.expectString)(data.customDataIdentifierId);
1678
1520
  }
1679
- return Promise.resolve(contents);
1521
+ return contents;
1680
1522
  };
1681
1523
  exports.deserializeAws_restJson1CreateCustomDataIdentifierCommand = deserializeAws_restJson1CreateCustomDataIdentifierCommand;
1682
1524
  const deserializeAws_restJson1CreateCustomDataIdentifierCommandError = async (output, context) => {
@@ -1684,7 +1526,6 @@ const deserializeAws_restJson1CreateCustomDataIdentifierCommandError = async (ou
1684
1526
  ...output,
1685
1527
  body: await parseBody(output.body, context),
1686
1528
  };
1687
- let response;
1688
1529
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1689
1530
  switch (errorCode) {
1690
1531
  case "AccessDeniedException":
@@ -1710,33 +1551,29 @@ const deserializeAws_restJson1CreateCustomDataIdentifierCommandError = async (ou
1710
1551
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1711
1552
  default:
1712
1553
  const parsedBody = parsedOutput.body;
1713
- const $metadata = deserializeMetadata(output);
1714
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1715
- response = new Macie2ServiceException_1.Macie2ServiceException({
1716
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1717
- $fault: "client",
1718
- $metadata,
1554
+ (0, smithy_client_1.throwDefaultError)({
1555
+ output,
1556
+ parsedBody,
1557
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1558
+ errorCode,
1719
1559
  });
1720
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1721
1560
  }
1722
1561
  };
1723
1562
  const deserializeAws_restJson1CreateFindingsFilterCommand = async (output, context) => {
1724
1563
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1725
1564
  return deserializeAws_restJson1CreateFindingsFilterCommandError(output, context);
1726
1565
  }
1727
- const contents = {
1566
+ const contents = map({
1728
1567
  $metadata: deserializeMetadata(output),
1729
- arn: undefined,
1730
- id: undefined,
1731
- };
1568
+ });
1732
1569
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1733
- if (data.arn !== undefined && data.arn !== null) {
1570
+ if (data.arn != null) {
1734
1571
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
1735
1572
  }
1736
- if (data.id !== undefined && data.id !== null) {
1573
+ if (data.id != null) {
1737
1574
  contents.id = (0, smithy_client_1.expectString)(data.id);
1738
1575
  }
1739
- return Promise.resolve(contents);
1576
+ return contents;
1740
1577
  };
1741
1578
  exports.deserializeAws_restJson1CreateFindingsFilterCommand = deserializeAws_restJson1CreateFindingsFilterCommand;
1742
1579
  const deserializeAws_restJson1CreateFindingsFilterCommandError = async (output, context) => {
@@ -1744,7 +1581,6 @@ const deserializeAws_restJson1CreateFindingsFilterCommandError = async (output,
1744
1581
  ...output,
1745
1582
  body: await parseBody(output.body, context),
1746
1583
  };
1747
- let response;
1748
1584
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1749
1585
  switch (errorCode) {
1750
1586
  case "AccessDeniedException":
@@ -1770,29 +1606,26 @@ const deserializeAws_restJson1CreateFindingsFilterCommandError = async (output,
1770
1606
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1771
1607
  default:
1772
1608
  const parsedBody = parsedOutput.body;
1773
- const $metadata = deserializeMetadata(output);
1774
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1775
- response = new Macie2ServiceException_1.Macie2ServiceException({
1776
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1777
- $fault: "client",
1778
- $metadata,
1609
+ (0, smithy_client_1.throwDefaultError)({
1610
+ output,
1611
+ parsedBody,
1612
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1613
+ errorCode,
1779
1614
  });
1780
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1781
1615
  }
1782
1616
  };
1783
1617
  const deserializeAws_restJson1CreateInvitationsCommand = async (output, context) => {
1784
1618
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1785
1619
  return deserializeAws_restJson1CreateInvitationsCommandError(output, context);
1786
1620
  }
1787
- const contents = {
1621
+ const contents = map({
1788
1622
  $metadata: deserializeMetadata(output),
1789
- unprocessedAccounts: undefined,
1790
- };
1623
+ });
1791
1624
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1792
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
1625
+ if (data.unprocessedAccounts != null) {
1793
1626
  contents.unprocessedAccounts = deserializeAws_restJson1__listOfUnprocessedAccount(data.unprocessedAccounts, context);
1794
1627
  }
1795
- return Promise.resolve(contents);
1628
+ return contents;
1796
1629
  };
1797
1630
  exports.deserializeAws_restJson1CreateInvitationsCommand = deserializeAws_restJson1CreateInvitationsCommand;
1798
1631
  const deserializeAws_restJson1CreateInvitationsCommandError = async (output, context) => {
@@ -1800,7 +1633,6 @@ const deserializeAws_restJson1CreateInvitationsCommandError = async (output, con
1800
1633
  ...output,
1801
1634
  body: await parseBody(output.body, context),
1802
1635
  };
1803
- let response;
1804
1636
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1805
1637
  switch (errorCode) {
1806
1638
  case "AccessDeniedException":
@@ -1826,29 +1658,26 @@ const deserializeAws_restJson1CreateInvitationsCommandError = async (output, con
1826
1658
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1827
1659
  default:
1828
1660
  const parsedBody = parsedOutput.body;
1829
- const $metadata = deserializeMetadata(output);
1830
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1831
- response = new Macie2ServiceException_1.Macie2ServiceException({
1832
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1833
- $fault: "client",
1834
- $metadata,
1661
+ (0, smithy_client_1.throwDefaultError)({
1662
+ output,
1663
+ parsedBody,
1664
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1665
+ errorCode,
1835
1666
  });
1836
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1837
1667
  }
1838
1668
  };
1839
1669
  const deserializeAws_restJson1CreateMemberCommand = async (output, context) => {
1840
1670
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1841
1671
  return deserializeAws_restJson1CreateMemberCommandError(output, context);
1842
1672
  }
1843
- const contents = {
1673
+ const contents = map({
1844
1674
  $metadata: deserializeMetadata(output),
1845
- arn: undefined,
1846
- };
1675
+ });
1847
1676
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1848
- if (data.arn !== undefined && data.arn !== null) {
1677
+ if (data.arn != null) {
1849
1678
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
1850
1679
  }
1851
- return Promise.resolve(contents);
1680
+ return contents;
1852
1681
  };
1853
1682
  exports.deserializeAws_restJson1CreateMemberCommand = deserializeAws_restJson1CreateMemberCommand;
1854
1683
  const deserializeAws_restJson1CreateMemberCommandError = async (output, context) => {
@@ -1856,7 +1685,6 @@ const deserializeAws_restJson1CreateMemberCommandError = async (output, context)
1856
1685
  ...output,
1857
1686
  body: await parseBody(output.body, context),
1858
1687
  };
1859
- let response;
1860
1688
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1861
1689
  switch (errorCode) {
1862
1690
  case "AccessDeniedException":
@@ -1882,25 +1710,23 @@ const deserializeAws_restJson1CreateMemberCommandError = async (output, context)
1882
1710
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1883
1711
  default:
1884
1712
  const parsedBody = parsedOutput.body;
1885
- const $metadata = deserializeMetadata(output);
1886
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1887
- response = new Macie2ServiceException_1.Macie2ServiceException({
1888
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1889
- $fault: "client",
1890
- $metadata,
1713
+ (0, smithy_client_1.throwDefaultError)({
1714
+ output,
1715
+ parsedBody,
1716
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1717
+ errorCode,
1891
1718
  });
1892
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1893
1719
  }
1894
1720
  };
1895
1721
  const deserializeAws_restJson1CreateSampleFindingsCommand = async (output, context) => {
1896
1722
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1897
1723
  return deserializeAws_restJson1CreateSampleFindingsCommandError(output, context);
1898
1724
  }
1899
- const contents = {
1725
+ const contents = map({
1900
1726
  $metadata: deserializeMetadata(output),
1901
- };
1727
+ });
1902
1728
  await collectBody(output.body, context);
1903
- return Promise.resolve(contents);
1729
+ return contents;
1904
1730
  };
1905
1731
  exports.deserializeAws_restJson1CreateSampleFindingsCommand = deserializeAws_restJson1CreateSampleFindingsCommand;
1906
1732
  const deserializeAws_restJson1CreateSampleFindingsCommandError = async (output, context) => {
@@ -1908,7 +1734,6 @@ const deserializeAws_restJson1CreateSampleFindingsCommandError = async (output,
1908
1734
  ...output,
1909
1735
  body: await parseBody(output.body, context),
1910
1736
  };
1911
- let response;
1912
1737
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1913
1738
  switch (errorCode) {
1914
1739
  case "AccessDeniedException":
@@ -1934,29 +1759,26 @@ const deserializeAws_restJson1CreateSampleFindingsCommandError = async (output,
1934
1759
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1935
1760
  default:
1936
1761
  const parsedBody = parsedOutput.body;
1937
- const $metadata = deserializeMetadata(output);
1938
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1939
- response = new Macie2ServiceException_1.Macie2ServiceException({
1940
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1941
- $fault: "client",
1942
- $metadata,
1762
+ (0, smithy_client_1.throwDefaultError)({
1763
+ output,
1764
+ parsedBody,
1765
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1766
+ errorCode,
1943
1767
  });
1944
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1945
1768
  }
1946
1769
  };
1947
1770
  const deserializeAws_restJson1DeclineInvitationsCommand = async (output, context) => {
1948
1771
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1949
1772
  return deserializeAws_restJson1DeclineInvitationsCommandError(output, context);
1950
1773
  }
1951
- const contents = {
1774
+ const contents = map({
1952
1775
  $metadata: deserializeMetadata(output),
1953
- unprocessedAccounts: undefined,
1954
- };
1776
+ });
1955
1777
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1956
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
1778
+ if (data.unprocessedAccounts != null) {
1957
1779
  contents.unprocessedAccounts = deserializeAws_restJson1__listOfUnprocessedAccount(data.unprocessedAccounts, context);
1958
1780
  }
1959
- return Promise.resolve(contents);
1781
+ return contents;
1960
1782
  };
1961
1783
  exports.deserializeAws_restJson1DeclineInvitationsCommand = deserializeAws_restJson1DeclineInvitationsCommand;
1962
1784
  const deserializeAws_restJson1DeclineInvitationsCommandError = async (output, context) => {
@@ -1964,7 +1786,6 @@ const deserializeAws_restJson1DeclineInvitationsCommandError = async (output, co
1964
1786
  ...output,
1965
1787
  body: await parseBody(output.body, context),
1966
1788
  };
1967
- let response;
1968
1789
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1969
1790
  switch (errorCode) {
1970
1791
  case "AccessDeniedException":
@@ -1990,25 +1811,23 @@ const deserializeAws_restJson1DeclineInvitationsCommandError = async (output, co
1990
1811
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1991
1812
  default:
1992
1813
  const parsedBody = parsedOutput.body;
1993
- const $metadata = deserializeMetadata(output);
1994
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1995
- response = new Macie2ServiceException_1.Macie2ServiceException({
1996
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1997
- $fault: "client",
1998
- $metadata,
1814
+ (0, smithy_client_1.throwDefaultError)({
1815
+ output,
1816
+ parsedBody,
1817
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1818
+ errorCode,
1999
1819
  });
2000
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2001
1820
  }
2002
1821
  };
2003
1822
  const deserializeAws_restJson1DeleteCustomDataIdentifierCommand = async (output, context) => {
2004
1823
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2005
1824
  return deserializeAws_restJson1DeleteCustomDataIdentifierCommandError(output, context);
2006
1825
  }
2007
- const contents = {
1826
+ const contents = map({
2008
1827
  $metadata: deserializeMetadata(output),
2009
- };
1828
+ });
2010
1829
  await collectBody(output.body, context);
2011
- return Promise.resolve(contents);
1830
+ return contents;
2012
1831
  };
2013
1832
  exports.deserializeAws_restJson1DeleteCustomDataIdentifierCommand = deserializeAws_restJson1DeleteCustomDataIdentifierCommand;
2014
1833
  const deserializeAws_restJson1DeleteCustomDataIdentifierCommandError = async (output, context) => {
@@ -2016,7 +1835,6 @@ const deserializeAws_restJson1DeleteCustomDataIdentifierCommandError = async (ou
2016
1835
  ...output,
2017
1836
  body: await parseBody(output.body, context),
2018
1837
  };
2019
- let response;
2020
1838
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2021
1839
  switch (errorCode) {
2022
1840
  case "AccessDeniedException":
@@ -2042,25 +1860,23 @@ const deserializeAws_restJson1DeleteCustomDataIdentifierCommandError = async (ou
2042
1860
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2043
1861
  default:
2044
1862
  const parsedBody = parsedOutput.body;
2045
- const $metadata = deserializeMetadata(output);
2046
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2047
- response = new Macie2ServiceException_1.Macie2ServiceException({
2048
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2049
- $fault: "client",
2050
- $metadata,
1863
+ (0, smithy_client_1.throwDefaultError)({
1864
+ output,
1865
+ parsedBody,
1866
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1867
+ errorCode,
2051
1868
  });
2052
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2053
1869
  }
2054
1870
  };
2055
1871
  const deserializeAws_restJson1DeleteFindingsFilterCommand = async (output, context) => {
2056
1872
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2057
1873
  return deserializeAws_restJson1DeleteFindingsFilterCommandError(output, context);
2058
1874
  }
2059
- const contents = {
1875
+ const contents = map({
2060
1876
  $metadata: deserializeMetadata(output),
2061
- };
1877
+ });
2062
1878
  await collectBody(output.body, context);
2063
- return Promise.resolve(contents);
1879
+ return contents;
2064
1880
  };
2065
1881
  exports.deserializeAws_restJson1DeleteFindingsFilterCommand = deserializeAws_restJson1DeleteFindingsFilterCommand;
2066
1882
  const deserializeAws_restJson1DeleteFindingsFilterCommandError = async (output, context) => {
@@ -2068,7 +1884,6 @@ const deserializeAws_restJson1DeleteFindingsFilterCommandError = async (output,
2068
1884
  ...output,
2069
1885
  body: await parseBody(output.body, context),
2070
1886
  };
2071
- let response;
2072
1887
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2073
1888
  switch (errorCode) {
2074
1889
  case "AccessDeniedException":
@@ -2094,29 +1909,26 @@ const deserializeAws_restJson1DeleteFindingsFilterCommandError = async (output,
2094
1909
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2095
1910
  default:
2096
1911
  const parsedBody = parsedOutput.body;
2097
- const $metadata = deserializeMetadata(output);
2098
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2099
- response = new Macie2ServiceException_1.Macie2ServiceException({
2100
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2101
- $fault: "client",
2102
- $metadata,
1912
+ (0, smithy_client_1.throwDefaultError)({
1913
+ output,
1914
+ parsedBody,
1915
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1916
+ errorCode,
2103
1917
  });
2104
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2105
1918
  }
2106
1919
  };
2107
1920
  const deserializeAws_restJson1DeleteInvitationsCommand = async (output, context) => {
2108
1921
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2109
1922
  return deserializeAws_restJson1DeleteInvitationsCommandError(output, context);
2110
1923
  }
2111
- const contents = {
1924
+ const contents = map({
2112
1925
  $metadata: deserializeMetadata(output),
2113
- unprocessedAccounts: undefined,
2114
- };
1926
+ });
2115
1927
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2116
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
1928
+ if (data.unprocessedAccounts != null) {
2117
1929
  contents.unprocessedAccounts = deserializeAws_restJson1__listOfUnprocessedAccount(data.unprocessedAccounts, context);
2118
1930
  }
2119
- return Promise.resolve(contents);
1931
+ return contents;
2120
1932
  };
2121
1933
  exports.deserializeAws_restJson1DeleteInvitationsCommand = deserializeAws_restJson1DeleteInvitationsCommand;
2122
1934
  const deserializeAws_restJson1DeleteInvitationsCommandError = async (output, context) => {
@@ -2124,7 +1936,6 @@ const deserializeAws_restJson1DeleteInvitationsCommandError = async (output, con
2124
1936
  ...output,
2125
1937
  body: await parseBody(output.body, context),
2126
1938
  };
2127
- let response;
2128
1939
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2129
1940
  switch (errorCode) {
2130
1941
  case "AccessDeniedException":
@@ -2150,25 +1961,23 @@ const deserializeAws_restJson1DeleteInvitationsCommandError = async (output, con
2150
1961
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2151
1962
  default:
2152
1963
  const parsedBody = parsedOutput.body;
2153
- const $metadata = deserializeMetadata(output);
2154
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2155
- response = new Macie2ServiceException_1.Macie2ServiceException({
2156
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2157
- $fault: "client",
2158
- $metadata,
1964
+ (0, smithy_client_1.throwDefaultError)({
1965
+ output,
1966
+ parsedBody,
1967
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
1968
+ errorCode,
2159
1969
  });
2160
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2161
1970
  }
2162
1971
  };
2163
1972
  const deserializeAws_restJson1DeleteMemberCommand = async (output, context) => {
2164
1973
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2165
1974
  return deserializeAws_restJson1DeleteMemberCommandError(output, context);
2166
1975
  }
2167
- const contents = {
1976
+ const contents = map({
2168
1977
  $metadata: deserializeMetadata(output),
2169
- };
1978
+ });
2170
1979
  await collectBody(output.body, context);
2171
- return Promise.resolve(contents);
1980
+ return contents;
2172
1981
  };
2173
1982
  exports.deserializeAws_restJson1DeleteMemberCommand = deserializeAws_restJson1DeleteMemberCommand;
2174
1983
  const deserializeAws_restJson1DeleteMemberCommandError = async (output, context) => {
@@ -2176,7 +1985,6 @@ const deserializeAws_restJson1DeleteMemberCommandError = async (output, context)
2176
1985
  ...output,
2177
1986
  body: await parseBody(output.body, context),
2178
1987
  };
2179
- let response;
2180
1988
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2181
1989
  switch (errorCode) {
2182
1990
  case "AccessDeniedException":
@@ -2202,33 +2010,29 @@ const deserializeAws_restJson1DeleteMemberCommandError = async (output, context)
2202
2010
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2203
2011
  default:
2204
2012
  const parsedBody = parsedOutput.body;
2205
- const $metadata = deserializeMetadata(output);
2206
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2207
- response = new Macie2ServiceException_1.Macie2ServiceException({
2208
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2209
- $fault: "client",
2210
- $metadata,
2013
+ (0, smithy_client_1.throwDefaultError)({
2014
+ output,
2015
+ parsedBody,
2016
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2017
+ errorCode,
2211
2018
  });
2212
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2213
2019
  }
2214
2020
  };
2215
2021
  const deserializeAws_restJson1DescribeBucketsCommand = async (output, context) => {
2216
2022
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2217
2023
  return deserializeAws_restJson1DescribeBucketsCommandError(output, context);
2218
2024
  }
2219
- const contents = {
2025
+ const contents = map({
2220
2026
  $metadata: deserializeMetadata(output),
2221
- buckets: undefined,
2222
- nextToken: undefined,
2223
- };
2027
+ });
2224
2028
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2225
- if (data.buckets !== undefined && data.buckets !== null) {
2029
+ if (data.buckets != null) {
2226
2030
  contents.buckets = deserializeAws_restJson1__listOfBucketMetadata(data.buckets, context);
2227
2031
  }
2228
- if (data.nextToken !== undefined && data.nextToken !== null) {
2032
+ if (data.nextToken != null) {
2229
2033
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2230
2034
  }
2231
- return Promise.resolve(contents);
2035
+ return contents;
2232
2036
  };
2233
2037
  exports.deserializeAws_restJson1DescribeBucketsCommand = deserializeAws_restJson1DescribeBucketsCommand;
2234
2038
  const deserializeAws_restJson1DescribeBucketsCommandError = async (output, context) => {
@@ -2236,7 +2040,6 @@ const deserializeAws_restJson1DescribeBucketsCommandError = async (output, conte
2236
2040
  ...output,
2237
2041
  body: await parseBody(output.body, context),
2238
2042
  };
2239
- let response;
2240
2043
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2241
2044
  switch (errorCode) {
2242
2045
  case "AccessDeniedException":
@@ -2262,105 +2065,83 @@ const deserializeAws_restJson1DescribeBucketsCommandError = async (output, conte
2262
2065
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2263
2066
  default:
2264
2067
  const parsedBody = parsedOutput.body;
2265
- const $metadata = deserializeMetadata(output);
2266
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2267
- response = new Macie2ServiceException_1.Macie2ServiceException({
2268
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2269
- $fault: "client",
2270
- $metadata,
2068
+ (0, smithy_client_1.throwDefaultError)({
2069
+ output,
2070
+ parsedBody,
2071
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2072
+ errorCode,
2271
2073
  });
2272
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2273
2074
  }
2274
2075
  };
2275
2076
  const deserializeAws_restJson1DescribeClassificationJobCommand = async (output, context) => {
2276
2077
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2277
2078
  return deserializeAws_restJson1DescribeClassificationJobCommandError(output, context);
2278
2079
  }
2279
- const contents = {
2080
+ const contents = map({
2280
2081
  $metadata: deserializeMetadata(output),
2281
- clientToken: undefined,
2282
- createdAt: undefined,
2283
- customDataIdentifierIds: undefined,
2284
- description: undefined,
2285
- initialRun: undefined,
2286
- jobArn: undefined,
2287
- jobId: undefined,
2288
- jobStatus: undefined,
2289
- jobType: undefined,
2290
- lastRunErrorStatus: undefined,
2291
- lastRunTime: undefined,
2292
- managedDataIdentifierIds: undefined,
2293
- managedDataIdentifierSelector: undefined,
2294
- name: undefined,
2295
- s3JobDefinition: undefined,
2296
- samplingPercentage: undefined,
2297
- scheduleFrequency: undefined,
2298
- statistics: undefined,
2299
- tags: undefined,
2300
- userPausedDetails: undefined,
2301
- };
2082
+ });
2302
2083
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2303
- if (data.clientToken !== undefined && data.clientToken !== null) {
2084
+ if (data.clientToken != null) {
2304
2085
  contents.clientToken = (0, smithy_client_1.expectString)(data.clientToken);
2305
2086
  }
2306
- if (data.createdAt !== undefined && data.createdAt !== null) {
2087
+ if (data.createdAt != null) {
2307
2088
  contents.createdAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createdAt));
2308
2089
  }
2309
- if (data.customDataIdentifierIds !== undefined && data.customDataIdentifierIds !== null) {
2090
+ if (data.customDataIdentifierIds != null) {
2310
2091
  contents.customDataIdentifierIds = deserializeAws_restJson1__listOf__string(data.customDataIdentifierIds, context);
2311
2092
  }
2312
- if (data.description !== undefined && data.description !== null) {
2093
+ if (data.description != null) {
2313
2094
  contents.description = (0, smithy_client_1.expectString)(data.description);
2314
2095
  }
2315
- if (data.initialRun !== undefined && data.initialRun !== null) {
2096
+ if (data.initialRun != null) {
2316
2097
  contents.initialRun = (0, smithy_client_1.expectBoolean)(data.initialRun);
2317
2098
  }
2318
- if (data.jobArn !== undefined && data.jobArn !== null) {
2099
+ if (data.jobArn != null) {
2319
2100
  contents.jobArn = (0, smithy_client_1.expectString)(data.jobArn);
2320
2101
  }
2321
- if (data.jobId !== undefined && data.jobId !== null) {
2102
+ if (data.jobId != null) {
2322
2103
  contents.jobId = (0, smithy_client_1.expectString)(data.jobId);
2323
2104
  }
2324
- if (data.jobStatus !== undefined && data.jobStatus !== null) {
2105
+ if (data.jobStatus != null) {
2325
2106
  contents.jobStatus = (0, smithy_client_1.expectString)(data.jobStatus);
2326
2107
  }
2327
- if (data.jobType !== undefined && data.jobType !== null) {
2108
+ if (data.jobType != null) {
2328
2109
  contents.jobType = (0, smithy_client_1.expectString)(data.jobType);
2329
2110
  }
2330
- if (data.lastRunErrorStatus !== undefined && data.lastRunErrorStatus !== null) {
2111
+ if (data.lastRunErrorStatus != null) {
2331
2112
  contents.lastRunErrorStatus = deserializeAws_restJson1LastRunErrorStatus(data.lastRunErrorStatus, context);
2332
2113
  }
2333
- if (data.lastRunTime !== undefined && data.lastRunTime !== null) {
2114
+ if (data.lastRunTime != null) {
2334
2115
  contents.lastRunTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.lastRunTime));
2335
2116
  }
2336
- if (data.managedDataIdentifierIds !== undefined && data.managedDataIdentifierIds !== null) {
2117
+ if (data.managedDataIdentifierIds != null) {
2337
2118
  contents.managedDataIdentifierIds = deserializeAws_restJson1__listOf__string(data.managedDataIdentifierIds, context);
2338
2119
  }
2339
- if (data.managedDataIdentifierSelector !== undefined && data.managedDataIdentifierSelector !== null) {
2120
+ if (data.managedDataIdentifierSelector != null) {
2340
2121
  contents.managedDataIdentifierSelector = (0, smithy_client_1.expectString)(data.managedDataIdentifierSelector);
2341
2122
  }
2342
- if (data.name !== undefined && data.name !== null) {
2123
+ if (data.name != null) {
2343
2124
  contents.name = (0, smithy_client_1.expectString)(data.name);
2344
2125
  }
2345
- if (data.s3JobDefinition !== undefined && data.s3JobDefinition !== null) {
2126
+ if (data.s3JobDefinition != null) {
2346
2127
  contents.s3JobDefinition = deserializeAws_restJson1S3JobDefinition(data.s3JobDefinition, context);
2347
2128
  }
2348
- if (data.samplingPercentage !== undefined && data.samplingPercentage !== null) {
2129
+ if (data.samplingPercentage != null) {
2349
2130
  contents.samplingPercentage = (0, smithy_client_1.expectInt32)(data.samplingPercentage);
2350
2131
  }
2351
- if (data.scheduleFrequency !== undefined && data.scheduleFrequency !== null) {
2132
+ if (data.scheduleFrequency != null) {
2352
2133
  contents.scheduleFrequency = deserializeAws_restJson1JobScheduleFrequency(data.scheduleFrequency, context);
2353
2134
  }
2354
- if (data.statistics !== undefined && data.statistics !== null) {
2135
+ if (data.statistics != null) {
2355
2136
  contents.statistics = deserializeAws_restJson1Statistics(data.statistics, context);
2356
2137
  }
2357
- if (data.tags !== undefined && data.tags !== null) {
2138
+ if (data.tags != null) {
2358
2139
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
2359
2140
  }
2360
- if (data.userPausedDetails !== undefined && data.userPausedDetails !== null) {
2141
+ if (data.userPausedDetails != null) {
2361
2142
  contents.userPausedDetails = deserializeAws_restJson1UserPausedDetails(data.userPausedDetails, context);
2362
2143
  }
2363
- return Promise.resolve(contents);
2144
+ return contents;
2364
2145
  };
2365
2146
  exports.deserializeAws_restJson1DescribeClassificationJobCommand = deserializeAws_restJson1DescribeClassificationJobCommand;
2366
2147
  const deserializeAws_restJson1DescribeClassificationJobCommandError = async (output, context) => {
@@ -2368,7 +2149,6 @@ const deserializeAws_restJson1DescribeClassificationJobCommandError = async (out
2368
2149
  ...output,
2369
2150
  body: await parseBody(output.body, context),
2370
2151
  };
2371
- let response;
2372
2152
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2373
2153
  switch (errorCode) {
2374
2154
  case "AccessDeniedException":
@@ -2394,33 +2174,29 @@ const deserializeAws_restJson1DescribeClassificationJobCommandError = async (out
2394
2174
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2395
2175
  default:
2396
2176
  const parsedBody = parsedOutput.body;
2397
- const $metadata = deserializeMetadata(output);
2398
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2399
- response = new Macie2ServiceException_1.Macie2ServiceException({
2400
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2401
- $fault: "client",
2402
- $metadata,
2177
+ (0, smithy_client_1.throwDefaultError)({
2178
+ output,
2179
+ parsedBody,
2180
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2181
+ errorCode,
2403
2182
  });
2404
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2405
2183
  }
2406
2184
  };
2407
2185
  const deserializeAws_restJson1DescribeOrganizationConfigurationCommand = async (output, context) => {
2408
2186
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2409
2187
  return deserializeAws_restJson1DescribeOrganizationConfigurationCommandError(output, context);
2410
2188
  }
2411
- const contents = {
2189
+ const contents = map({
2412
2190
  $metadata: deserializeMetadata(output),
2413
- autoEnable: undefined,
2414
- maxAccountLimitReached: undefined,
2415
- };
2191
+ });
2416
2192
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2417
- if (data.autoEnable !== undefined && data.autoEnable !== null) {
2193
+ if (data.autoEnable != null) {
2418
2194
  contents.autoEnable = (0, smithy_client_1.expectBoolean)(data.autoEnable);
2419
2195
  }
2420
- if (data.maxAccountLimitReached !== undefined && data.maxAccountLimitReached !== null) {
2196
+ if (data.maxAccountLimitReached != null) {
2421
2197
  contents.maxAccountLimitReached = (0, smithy_client_1.expectBoolean)(data.maxAccountLimitReached);
2422
2198
  }
2423
- return Promise.resolve(contents);
2199
+ return contents;
2424
2200
  };
2425
2201
  exports.deserializeAws_restJson1DescribeOrganizationConfigurationCommand = deserializeAws_restJson1DescribeOrganizationConfigurationCommand;
2426
2202
  const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = async (output, context) => {
@@ -2428,7 +2204,6 @@ const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = as
2428
2204
  ...output,
2429
2205
  body: await parseBody(output.body, context),
2430
2206
  };
2431
- let response;
2432
2207
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2433
2208
  switch (errorCode) {
2434
2209
  case "AccessDeniedException":
@@ -2454,25 +2229,23 @@ const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = as
2454
2229
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2455
2230
  default:
2456
2231
  const parsedBody = parsedOutput.body;
2457
- const $metadata = deserializeMetadata(output);
2458
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2459
- response = new Macie2ServiceException_1.Macie2ServiceException({
2460
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2461
- $fault: "client",
2462
- $metadata,
2232
+ (0, smithy_client_1.throwDefaultError)({
2233
+ output,
2234
+ parsedBody,
2235
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2236
+ errorCode,
2463
2237
  });
2464
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2465
2238
  }
2466
2239
  };
2467
2240
  const deserializeAws_restJson1DisableMacieCommand = async (output, context) => {
2468
2241
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2469
2242
  return deserializeAws_restJson1DisableMacieCommandError(output, context);
2470
2243
  }
2471
- const contents = {
2244
+ const contents = map({
2472
2245
  $metadata: deserializeMetadata(output),
2473
- };
2246
+ });
2474
2247
  await collectBody(output.body, context);
2475
- return Promise.resolve(contents);
2248
+ return contents;
2476
2249
  };
2477
2250
  exports.deserializeAws_restJson1DisableMacieCommand = deserializeAws_restJson1DisableMacieCommand;
2478
2251
  const deserializeAws_restJson1DisableMacieCommandError = async (output, context) => {
@@ -2480,7 +2253,6 @@ const deserializeAws_restJson1DisableMacieCommandError = async (output, context)
2480
2253
  ...output,
2481
2254
  body: await parseBody(output.body, context),
2482
2255
  };
2483
- let response;
2484
2256
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2485
2257
  switch (errorCode) {
2486
2258
  case "AccessDeniedException":
@@ -2506,25 +2278,23 @@ const deserializeAws_restJson1DisableMacieCommandError = async (output, context)
2506
2278
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2507
2279
  default:
2508
2280
  const parsedBody = parsedOutput.body;
2509
- const $metadata = deserializeMetadata(output);
2510
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2511
- response = new Macie2ServiceException_1.Macie2ServiceException({
2512
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2513
- $fault: "client",
2514
- $metadata,
2281
+ (0, smithy_client_1.throwDefaultError)({
2282
+ output,
2283
+ parsedBody,
2284
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2285
+ errorCode,
2515
2286
  });
2516
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2517
2287
  }
2518
2288
  };
2519
2289
  const deserializeAws_restJson1DisableOrganizationAdminAccountCommand = async (output, context) => {
2520
2290
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2521
2291
  return deserializeAws_restJson1DisableOrganizationAdminAccountCommandError(output, context);
2522
2292
  }
2523
- const contents = {
2293
+ const contents = map({
2524
2294
  $metadata: deserializeMetadata(output),
2525
- };
2295
+ });
2526
2296
  await collectBody(output.body, context);
2527
- return Promise.resolve(contents);
2297
+ return contents;
2528
2298
  };
2529
2299
  exports.deserializeAws_restJson1DisableOrganizationAdminAccountCommand = deserializeAws_restJson1DisableOrganizationAdminAccountCommand;
2530
2300
  const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = async (output, context) => {
@@ -2532,7 +2302,6 @@ const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = asyn
2532
2302
  ...output,
2533
2303
  body: await parseBody(output.body, context),
2534
2304
  };
2535
- let response;
2536
2305
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2537
2306
  switch (errorCode) {
2538
2307
  case "AccessDeniedException":
@@ -2558,25 +2327,23 @@ const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = asyn
2558
2327
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2559
2328
  default:
2560
2329
  const parsedBody = parsedOutput.body;
2561
- const $metadata = deserializeMetadata(output);
2562
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2563
- response = new Macie2ServiceException_1.Macie2ServiceException({
2564
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2565
- $fault: "client",
2566
- $metadata,
2330
+ (0, smithy_client_1.throwDefaultError)({
2331
+ output,
2332
+ parsedBody,
2333
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2334
+ errorCode,
2567
2335
  });
2568
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2569
2336
  }
2570
2337
  };
2571
2338
  const deserializeAws_restJson1DisassociateFromAdministratorAccountCommand = async (output, context) => {
2572
2339
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2573
2340
  return deserializeAws_restJson1DisassociateFromAdministratorAccountCommandError(output, context);
2574
2341
  }
2575
- const contents = {
2342
+ const contents = map({
2576
2343
  $metadata: deserializeMetadata(output),
2577
- };
2344
+ });
2578
2345
  await collectBody(output.body, context);
2579
- return Promise.resolve(contents);
2346
+ return contents;
2580
2347
  };
2581
2348
  exports.deserializeAws_restJson1DisassociateFromAdministratorAccountCommand = deserializeAws_restJson1DisassociateFromAdministratorAccountCommand;
2582
2349
  const deserializeAws_restJson1DisassociateFromAdministratorAccountCommandError = async (output, context) => {
@@ -2584,7 +2351,6 @@ const deserializeAws_restJson1DisassociateFromAdministratorAccountCommandError =
2584
2351
  ...output,
2585
2352
  body: await parseBody(output.body, context),
2586
2353
  };
2587
- let response;
2588
2354
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2589
2355
  switch (errorCode) {
2590
2356
  case "AccessDeniedException":
@@ -2610,25 +2376,23 @@ const deserializeAws_restJson1DisassociateFromAdministratorAccountCommandError =
2610
2376
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2611
2377
  default:
2612
2378
  const parsedBody = parsedOutput.body;
2613
- const $metadata = deserializeMetadata(output);
2614
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2615
- response = new Macie2ServiceException_1.Macie2ServiceException({
2616
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2617
- $fault: "client",
2618
- $metadata,
2379
+ (0, smithy_client_1.throwDefaultError)({
2380
+ output,
2381
+ parsedBody,
2382
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2383
+ errorCode,
2619
2384
  });
2620
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2621
2385
  }
2622
2386
  };
2623
2387
  const deserializeAws_restJson1DisassociateFromMasterAccountCommand = async (output, context) => {
2624
2388
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2625
2389
  return deserializeAws_restJson1DisassociateFromMasterAccountCommandError(output, context);
2626
2390
  }
2627
- const contents = {
2391
+ const contents = map({
2628
2392
  $metadata: deserializeMetadata(output),
2629
- };
2393
+ });
2630
2394
  await collectBody(output.body, context);
2631
- return Promise.resolve(contents);
2395
+ return contents;
2632
2396
  };
2633
2397
  exports.deserializeAws_restJson1DisassociateFromMasterAccountCommand = deserializeAws_restJson1DisassociateFromMasterAccountCommand;
2634
2398
  const deserializeAws_restJson1DisassociateFromMasterAccountCommandError = async (output, context) => {
@@ -2636,7 +2400,6 @@ const deserializeAws_restJson1DisassociateFromMasterAccountCommandError = async
2636
2400
  ...output,
2637
2401
  body: await parseBody(output.body, context),
2638
2402
  };
2639
- let response;
2640
2403
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2641
2404
  switch (errorCode) {
2642
2405
  case "AccessDeniedException":
@@ -2662,25 +2425,23 @@ const deserializeAws_restJson1DisassociateFromMasterAccountCommandError = async
2662
2425
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2663
2426
  default:
2664
2427
  const parsedBody = parsedOutput.body;
2665
- const $metadata = deserializeMetadata(output);
2666
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2667
- response = new Macie2ServiceException_1.Macie2ServiceException({
2668
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2669
- $fault: "client",
2670
- $metadata,
2428
+ (0, smithy_client_1.throwDefaultError)({
2429
+ output,
2430
+ parsedBody,
2431
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2432
+ errorCode,
2671
2433
  });
2672
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2673
2434
  }
2674
2435
  };
2675
2436
  const deserializeAws_restJson1DisassociateMemberCommand = async (output, context) => {
2676
2437
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2677
2438
  return deserializeAws_restJson1DisassociateMemberCommandError(output, context);
2678
2439
  }
2679
- const contents = {
2440
+ const contents = map({
2680
2441
  $metadata: deserializeMetadata(output),
2681
- };
2442
+ });
2682
2443
  await collectBody(output.body, context);
2683
- return Promise.resolve(contents);
2444
+ return contents;
2684
2445
  };
2685
2446
  exports.deserializeAws_restJson1DisassociateMemberCommand = deserializeAws_restJson1DisassociateMemberCommand;
2686
2447
  const deserializeAws_restJson1DisassociateMemberCommandError = async (output, context) => {
@@ -2688,7 +2449,6 @@ const deserializeAws_restJson1DisassociateMemberCommandError = async (output, co
2688
2449
  ...output,
2689
2450
  body: await parseBody(output.body, context),
2690
2451
  };
2691
- let response;
2692
2452
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2693
2453
  switch (errorCode) {
2694
2454
  case "AccessDeniedException":
@@ -2714,25 +2474,23 @@ const deserializeAws_restJson1DisassociateMemberCommandError = async (output, co
2714
2474
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2715
2475
  default:
2716
2476
  const parsedBody = parsedOutput.body;
2717
- const $metadata = deserializeMetadata(output);
2718
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2719
- response = new Macie2ServiceException_1.Macie2ServiceException({
2720
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2721
- $fault: "client",
2722
- $metadata,
2477
+ (0, smithy_client_1.throwDefaultError)({
2478
+ output,
2479
+ parsedBody,
2480
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2481
+ errorCode,
2723
2482
  });
2724
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2725
2483
  }
2726
2484
  };
2727
2485
  const deserializeAws_restJson1EnableMacieCommand = async (output, context) => {
2728
2486
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2729
2487
  return deserializeAws_restJson1EnableMacieCommandError(output, context);
2730
2488
  }
2731
- const contents = {
2489
+ const contents = map({
2732
2490
  $metadata: deserializeMetadata(output),
2733
- };
2491
+ });
2734
2492
  await collectBody(output.body, context);
2735
- return Promise.resolve(contents);
2493
+ return contents;
2736
2494
  };
2737
2495
  exports.deserializeAws_restJson1EnableMacieCommand = deserializeAws_restJson1EnableMacieCommand;
2738
2496
  const deserializeAws_restJson1EnableMacieCommandError = async (output, context) => {
@@ -2740,7 +2498,6 @@ const deserializeAws_restJson1EnableMacieCommandError = async (output, context)
2740
2498
  ...output,
2741
2499
  body: await parseBody(output.body, context),
2742
2500
  };
2743
- let response;
2744
2501
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2745
2502
  switch (errorCode) {
2746
2503
  case "AccessDeniedException":
@@ -2766,25 +2523,23 @@ const deserializeAws_restJson1EnableMacieCommandError = async (output, context)
2766
2523
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2767
2524
  default:
2768
2525
  const parsedBody = parsedOutput.body;
2769
- const $metadata = deserializeMetadata(output);
2770
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2771
- response = new Macie2ServiceException_1.Macie2ServiceException({
2772
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2773
- $fault: "client",
2774
- $metadata,
2526
+ (0, smithy_client_1.throwDefaultError)({
2527
+ output,
2528
+ parsedBody,
2529
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2530
+ errorCode,
2775
2531
  });
2776
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2777
2532
  }
2778
2533
  };
2779
2534
  const deserializeAws_restJson1EnableOrganizationAdminAccountCommand = async (output, context) => {
2780
2535
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2781
2536
  return deserializeAws_restJson1EnableOrganizationAdminAccountCommandError(output, context);
2782
2537
  }
2783
- const contents = {
2538
+ const contents = map({
2784
2539
  $metadata: deserializeMetadata(output),
2785
- };
2540
+ });
2786
2541
  await collectBody(output.body, context);
2787
- return Promise.resolve(contents);
2542
+ return contents;
2788
2543
  };
2789
2544
  exports.deserializeAws_restJson1EnableOrganizationAdminAccountCommand = deserializeAws_restJson1EnableOrganizationAdminAccountCommand;
2790
2545
  const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async (output, context) => {
@@ -2792,7 +2547,6 @@ const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async
2792
2547
  ...output,
2793
2548
  body: await parseBody(output.body, context),
2794
2549
  };
2795
- let response;
2796
2550
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2797
2551
  switch (errorCode) {
2798
2552
  case "AccessDeniedException":
@@ -2818,29 +2572,26 @@ const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async
2818
2572
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2819
2573
  default:
2820
2574
  const parsedBody = parsedOutput.body;
2821
- const $metadata = deserializeMetadata(output);
2822
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2823
- response = new Macie2ServiceException_1.Macie2ServiceException({
2824
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2825
- $fault: "client",
2826
- $metadata,
2575
+ (0, smithy_client_1.throwDefaultError)({
2576
+ output,
2577
+ parsedBody,
2578
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2579
+ errorCode,
2827
2580
  });
2828
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2829
2581
  }
2830
2582
  };
2831
2583
  const deserializeAws_restJson1GetAdministratorAccountCommand = async (output, context) => {
2832
2584
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2833
2585
  return deserializeAws_restJson1GetAdministratorAccountCommandError(output, context);
2834
2586
  }
2835
- const contents = {
2587
+ const contents = map({
2836
2588
  $metadata: deserializeMetadata(output),
2837
- administrator: undefined,
2838
- };
2589
+ });
2839
2590
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2840
- if (data.administrator !== undefined && data.administrator !== null) {
2591
+ if (data.administrator != null) {
2841
2592
  contents.administrator = deserializeAws_restJson1Invitation(data.administrator, context);
2842
2593
  }
2843
- return Promise.resolve(contents);
2594
+ return contents;
2844
2595
  };
2845
2596
  exports.deserializeAws_restJson1GetAdministratorAccountCommand = deserializeAws_restJson1GetAdministratorAccountCommand;
2846
2597
  const deserializeAws_restJson1GetAdministratorAccountCommandError = async (output, context) => {
@@ -2848,7 +2599,6 @@ const deserializeAws_restJson1GetAdministratorAccountCommandError = async (outpu
2848
2599
  ...output,
2849
2600
  body: await parseBody(output.body, context),
2850
2601
  };
2851
- let response;
2852
2602
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2853
2603
  switch (errorCode) {
2854
2604
  case "AccessDeniedException":
@@ -2874,79 +2624,63 @@ const deserializeAws_restJson1GetAdministratorAccountCommandError = async (outpu
2874
2624
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2875
2625
  default:
2876
2626
  const parsedBody = parsedOutput.body;
2877
- const $metadata = deserializeMetadata(output);
2878
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2879
- response = new Macie2ServiceException_1.Macie2ServiceException({
2880
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2881
- $fault: "client",
2882
- $metadata,
2627
+ (0, smithy_client_1.throwDefaultError)({
2628
+ output,
2629
+ parsedBody,
2630
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2631
+ errorCode,
2883
2632
  });
2884
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2885
2633
  }
2886
2634
  };
2887
2635
  const deserializeAws_restJson1GetBucketStatisticsCommand = async (output, context) => {
2888
2636
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2889
2637
  return deserializeAws_restJson1GetBucketStatisticsCommandError(output, context);
2890
2638
  }
2891
- const contents = {
2639
+ const contents = map({
2892
2640
  $metadata: deserializeMetadata(output),
2893
- bucketCount: undefined,
2894
- bucketCountByEffectivePermission: undefined,
2895
- bucketCountByEncryptionType: undefined,
2896
- bucketCountByObjectEncryptionRequirement: undefined,
2897
- bucketCountBySharedAccessType: undefined,
2898
- classifiableObjectCount: undefined,
2899
- classifiableSizeInBytes: undefined,
2900
- lastUpdated: undefined,
2901
- objectCount: undefined,
2902
- sizeInBytes: undefined,
2903
- sizeInBytesCompressed: undefined,
2904
- unclassifiableObjectCount: undefined,
2905
- unclassifiableObjectSizeInBytes: undefined,
2906
- };
2641
+ });
2907
2642
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2908
- if (data.bucketCount !== undefined && data.bucketCount !== null) {
2643
+ if (data.bucketCount != null) {
2909
2644
  contents.bucketCount = (0, smithy_client_1.expectLong)(data.bucketCount);
2910
2645
  }
2911
- if (data.bucketCountByEffectivePermission !== undefined && data.bucketCountByEffectivePermission !== null) {
2646
+ if (data.bucketCountByEffectivePermission != null) {
2912
2647
  contents.bucketCountByEffectivePermission = deserializeAws_restJson1BucketCountByEffectivePermission(data.bucketCountByEffectivePermission, context);
2913
2648
  }
2914
- if (data.bucketCountByEncryptionType !== undefined && data.bucketCountByEncryptionType !== null) {
2649
+ if (data.bucketCountByEncryptionType != null) {
2915
2650
  contents.bucketCountByEncryptionType = deserializeAws_restJson1BucketCountByEncryptionType(data.bucketCountByEncryptionType, context);
2916
2651
  }
2917
- if (data.bucketCountByObjectEncryptionRequirement !== undefined &&
2918
- data.bucketCountByObjectEncryptionRequirement !== null) {
2652
+ if (data.bucketCountByObjectEncryptionRequirement != null) {
2919
2653
  contents.bucketCountByObjectEncryptionRequirement =
2920
2654
  deserializeAws_restJson1BucketCountPolicyAllowsUnencryptedObjectUploads(data.bucketCountByObjectEncryptionRequirement, context);
2921
2655
  }
2922
- if (data.bucketCountBySharedAccessType !== undefined && data.bucketCountBySharedAccessType !== null) {
2656
+ if (data.bucketCountBySharedAccessType != null) {
2923
2657
  contents.bucketCountBySharedAccessType = deserializeAws_restJson1BucketCountBySharedAccessType(data.bucketCountBySharedAccessType, context);
2924
2658
  }
2925
- if (data.classifiableObjectCount !== undefined && data.classifiableObjectCount !== null) {
2659
+ if (data.classifiableObjectCount != null) {
2926
2660
  contents.classifiableObjectCount = (0, smithy_client_1.expectLong)(data.classifiableObjectCount);
2927
2661
  }
2928
- if (data.classifiableSizeInBytes !== undefined && data.classifiableSizeInBytes !== null) {
2662
+ if (data.classifiableSizeInBytes != null) {
2929
2663
  contents.classifiableSizeInBytes = (0, smithy_client_1.expectLong)(data.classifiableSizeInBytes);
2930
2664
  }
2931
- if (data.lastUpdated !== undefined && data.lastUpdated !== null) {
2665
+ if (data.lastUpdated != null) {
2932
2666
  contents.lastUpdated = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.lastUpdated));
2933
2667
  }
2934
- if (data.objectCount !== undefined && data.objectCount !== null) {
2668
+ if (data.objectCount != null) {
2935
2669
  contents.objectCount = (0, smithy_client_1.expectLong)(data.objectCount);
2936
2670
  }
2937
- if (data.sizeInBytes !== undefined && data.sizeInBytes !== null) {
2671
+ if (data.sizeInBytes != null) {
2938
2672
  contents.sizeInBytes = (0, smithy_client_1.expectLong)(data.sizeInBytes);
2939
2673
  }
2940
- if (data.sizeInBytesCompressed !== undefined && data.sizeInBytesCompressed !== null) {
2674
+ if (data.sizeInBytesCompressed != null) {
2941
2675
  contents.sizeInBytesCompressed = (0, smithy_client_1.expectLong)(data.sizeInBytesCompressed);
2942
2676
  }
2943
- if (data.unclassifiableObjectCount !== undefined && data.unclassifiableObjectCount !== null) {
2677
+ if (data.unclassifiableObjectCount != null) {
2944
2678
  contents.unclassifiableObjectCount = deserializeAws_restJson1ObjectLevelStatistics(data.unclassifiableObjectCount, context);
2945
2679
  }
2946
- if (data.unclassifiableObjectSizeInBytes !== undefined && data.unclassifiableObjectSizeInBytes !== null) {
2680
+ if (data.unclassifiableObjectSizeInBytes != null) {
2947
2681
  contents.unclassifiableObjectSizeInBytes = deserializeAws_restJson1ObjectLevelStatistics(data.unclassifiableObjectSizeInBytes, context);
2948
2682
  }
2949
- return Promise.resolve(contents);
2683
+ return contents;
2950
2684
  };
2951
2685
  exports.deserializeAws_restJson1GetBucketStatisticsCommand = deserializeAws_restJson1GetBucketStatisticsCommand;
2952
2686
  const deserializeAws_restJson1GetBucketStatisticsCommandError = async (output, context) => {
@@ -2954,7 +2688,6 @@ const deserializeAws_restJson1GetBucketStatisticsCommandError = async (output, c
2954
2688
  ...output,
2955
2689
  body: await parseBody(output.body, context),
2956
2690
  };
2957
- let response;
2958
2691
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2959
2692
  switch (errorCode) {
2960
2693
  case "AccessDeniedException":
@@ -2980,29 +2713,26 @@ const deserializeAws_restJson1GetBucketStatisticsCommandError = async (output, c
2980
2713
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2981
2714
  default:
2982
2715
  const parsedBody = parsedOutput.body;
2983
- const $metadata = deserializeMetadata(output);
2984
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2985
- response = new Macie2ServiceException_1.Macie2ServiceException({
2986
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2987
- $fault: "client",
2988
- $metadata,
2716
+ (0, smithy_client_1.throwDefaultError)({
2717
+ output,
2718
+ parsedBody,
2719
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2720
+ errorCode,
2989
2721
  });
2990
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2991
2722
  }
2992
2723
  };
2993
2724
  const deserializeAws_restJson1GetClassificationExportConfigurationCommand = async (output, context) => {
2994
2725
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2995
2726
  return deserializeAws_restJson1GetClassificationExportConfigurationCommandError(output, context);
2996
2727
  }
2997
- const contents = {
2728
+ const contents = map({
2998
2729
  $metadata: deserializeMetadata(output),
2999
- configuration: undefined,
3000
- };
2730
+ });
3001
2731
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3002
- if (data.configuration !== undefined && data.configuration !== null) {
2732
+ if (data.configuration != null) {
3003
2733
  contents.configuration = deserializeAws_restJson1ClassificationExportConfiguration(data.configuration, context);
3004
2734
  }
3005
- return Promise.resolve(contents);
2735
+ return contents;
3006
2736
  };
3007
2737
  exports.deserializeAws_restJson1GetClassificationExportConfigurationCommand = deserializeAws_restJson1GetClassificationExportConfigurationCommand;
3008
2738
  const deserializeAws_restJson1GetClassificationExportConfigurationCommandError = async (output, context) => {
@@ -3010,7 +2740,6 @@ const deserializeAws_restJson1GetClassificationExportConfigurationCommandError =
3010
2740
  ...output,
3011
2741
  body: await parseBody(output.body, context),
3012
2742
  };
3013
- let response;
3014
2743
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3015
2744
  switch (errorCode) {
3016
2745
  case "AccessDeniedException":
@@ -3036,73 +2765,59 @@ const deserializeAws_restJson1GetClassificationExportConfigurationCommandError =
3036
2765
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3037
2766
  default:
3038
2767
  const parsedBody = parsedOutput.body;
3039
- const $metadata = deserializeMetadata(output);
3040
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3041
- response = new Macie2ServiceException_1.Macie2ServiceException({
3042
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3043
- $fault: "client",
3044
- $metadata,
2768
+ (0, smithy_client_1.throwDefaultError)({
2769
+ output,
2770
+ parsedBody,
2771
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2772
+ errorCode,
3045
2773
  });
3046
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3047
2774
  }
3048
2775
  };
3049
2776
  const deserializeAws_restJson1GetCustomDataIdentifierCommand = async (output, context) => {
3050
2777
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3051
2778
  return deserializeAws_restJson1GetCustomDataIdentifierCommandError(output, context);
3052
2779
  }
3053
- const contents = {
2780
+ const contents = map({
3054
2781
  $metadata: deserializeMetadata(output),
3055
- arn: undefined,
3056
- createdAt: undefined,
3057
- deleted: undefined,
3058
- description: undefined,
3059
- id: undefined,
3060
- ignoreWords: undefined,
3061
- keywords: undefined,
3062
- maximumMatchDistance: undefined,
3063
- name: undefined,
3064
- regex: undefined,
3065
- severityLevels: undefined,
3066
- tags: undefined,
3067
- };
2782
+ });
3068
2783
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3069
- if (data.arn !== undefined && data.arn !== null) {
2784
+ if (data.arn != null) {
3070
2785
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
3071
2786
  }
3072
- if (data.createdAt !== undefined && data.createdAt !== null) {
2787
+ if (data.createdAt != null) {
3073
2788
  contents.createdAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createdAt));
3074
2789
  }
3075
- if (data.deleted !== undefined && data.deleted !== null) {
2790
+ if (data.deleted != null) {
3076
2791
  contents.deleted = (0, smithy_client_1.expectBoolean)(data.deleted);
3077
2792
  }
3078
- if (data.description !== undefined && data.description !== null) {
2793
+ if (data.description != null) {
3079
2794
  contents.description = (0, smithy_client_1.expectString)(data.description);
3080
2795
  }
3081
- if (data.id !== undefined && data.id !== null) {
2796
+ if (data.id != null) {
3082
2797
  contents.id = (0, smithy_client_1.expectString)(data.id);
3083
2798
  }
3084
- if (data.ignoreWords !== undefined && data.ignoreWords !== null) {
2799
+ if (data.ignoreWords != null) {
3085
2800
  contents.ignoreWords = deserializeAws_restJson1__listOf__string(data.ignoreWords, context);
3086
2801
  }
3087
- if (data.keywords !== undefined && data.keywords !== null) {
2802
+ if (data.keywords != null) {
3088
2803
  contents.keywords = deserializeAws_restJson1__listOf__string(data.keywords, context);
3089
2804
  }
3090
- if (data.maximumMatchDistance !== undefined && data.maximumMatchDistance !== null) {
2805
+ if (data.maximumMatchDistance != null) {
3091
2806
  contents.maximumMatchDistance = (0, smithy_client_1.expectInt32)(data.maximumMatchDistance);
3092
2807
  }
3093
- if (data.name !== undefined && data.name !== null) {
2808
+ if (data.name != null) {
3094
2809
  contents.name = (0, smithy_client_1.expectString)(data.name);
3095
2810
  }
3096
- if (data.regex !== undefined && data.regex !== null) {
2811
+ if (data.regex != null) {
3097
2812
  contents.regex = (0, smithy_client_1.expectString)(data.regex);
3098
2813
  }
3099
- if (data.severityLevels !== undefined && data.severityLevels !== null) {
2814
+ if (data.severityLevels != null) {
3100
2815
  contents.severityLevels = deserializeAws_restJson1SeverityLevelList(data.severityLevels, context);
3101
2816
  }
3102
- if (data.tags !== undefined && data.tags !== null) {
2817
+ if (data.tags != null) {
3103
2818
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
3104
2819
  }
3105
- return Promise.resolve(contents);
2820
+ return contents;
3106
2821
  };
3107
2822
  exports.deserializeAws_restJson1GetCustomDataIdentifierCommand = deserializeAws_restJson1GetCustomDataIdentifierCommand;
3108
2823
  const deserializeAws_restJson1GetCustomDataIdentifierCommandError = async (output, context) => {
@@ -3110,7 +2825,6 @@ const deserializeAws_restJson1GetCustomDataIdentifierCommandError = async (outpu
3110
2825
  ...output,
3111
2826
  body: await parseBody(output.body, context),
3112
2827
  };
3113
- let response;
3114
2828
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3115
2829
  switch (errorCode) {
3116
2830
  case "AccessDeniedException":
@@ -3136,29 +2850,26 @@ const deserializeAws_restJson1GetCustomDataIdentifierCommandError = async (outpu
3136
2850
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3137
2851
  default:
3138
2852
  const parsedBody = parsedOutput.body;
3139
- const $metadata = deserializeMetadata(output);
3140
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3141
- response = new Macie2ServiceException_1.Macie2ServiceException({
3142
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3143
- $fault: "client",
3144
- $metadata,
2853
+ (0, smithy_client_1.throwDefaultError)({
2854
+ output,
2855
+ parsedBody,
2856
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2857
+ errorCode,
3145
2858
  });
3146
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3147
2859
  }
3148
2860
  };
3149
2861
  const deserializeAws_restJson1GetFindingsCommand = async (output, context) => {
3150
2862
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3151
2863
  return deserializeAws_restJson1GetFindingsCommandError(output, context);
3152
2864
  }
3153
- const contents = {
2865
+ const contents = map({
3154
2866
  $metadata: deserializeMetadata(output),
3155
- findings: undefined,
3156
- };
2867
+ });
3157
2868
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3158
- if (data.findings !== undefined && data.findings !== null) {
2869
+ if (data.findings != null) {
3159
2870
  contents.findings = deserializeAws_restJson1__listOfFinding(data.findings, context);
3160
2871
  }
3161
- return Promise.resolve(contents);
2872
+ return contents;
3162
2873
  };
3163
2874
  exports.deserializeAws_restJson1GetFindingsCommand = deserializeAws_restJson1GetFindingsCommand;
3164
2875
  const deserializeAws_restJson1GetFindingsCommandError = async (output, context) => {
@@ -3166,7 +2877,6 @@ const deserializeAws_restJson1GetFindingsCommandError = async (output, context)
3166
2877
  ...output,
3167
2878
  body: await parseBody(output.body, context),
3168
2879
  };
3169
- let response;
3170
2880
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3171
2881
  switch (errorCode) {
3172
2882
  case "AccessDeniedException":
@@ -3192,57 +2902,47 @@ const deserializeAws_restJson1GetFindingsCommandError = async (output, context)
3192
2902
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3193
2903
  default:
3194
2904
  const parsedBody = parsedOutput.body;
3195
- const $metadata = deserializeMetadata(output);
3196
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3197
- response = new Macie2ServiceException_1.Macie2ServiceException({
3198
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3199
- $fault: "client",
3200
- $metadata,
2905
+ (0, smithy_client_1.throwDefaultError)({
2906
+ output,
2907
+ parsedBody,
2908
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2909
+ errorCode,
3201
2910
  });
3202
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3203
2911
  }
3204
2912
  };
3205
2913
  const deserializeAws_restJson1GetFindingsFilterCommand = async (output, context) => {
3206
2914
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3207
2915
  return deserializeAws_restJson1GetFindingsFilterCommandError(output, context);
3208
2916
  }
3209
- const contents = {
2917
+ const contents = map({
3210
2918
  $metadata: deserializeMetadata(output),
3211
- action: undefined,
3212
- arn: undefined,
3213
- description: undefined,
3214
- findingCriteria: undefined,
3215
- id: undefined,
3216
- name: undefined,
3217
- position: undefined,
3218
- tags: undefined,
3219
- };
2919
+ });
3220
2920
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3221
- if (data.action !== undefined && data.action !== null) {
2921
+ if (data.action != null) {
3222
2922
  contents.action = (0, smithy_client_1.expectString)(data.action);
3223
2923
  }
3224
- if (data.arn !== undefined && data.arn !== null) {
2924
+ if (data.arn != null) {
3225
2925
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
3226
2926
  }
3227
- if (data.description !== undefined && data.description !== null) {
2927
+ if (data.description != null) {
3228
2928
  contents.description = (0, smithy_client_1.expectString)(data.description);
3229
2929
  }
3230
- if (data.findingCriteria !== undefined && data.findingCriteria !== null) {
2930
+ if (data.findingCriteria != null) {
3231
2931
  contents.findingCriteria = deserializeAws_restJson1FindingCriteria(data.findingCriteria, context);
3232
2932
  }
3233
- if (data.id !== undefined && data.id !== null) {
2933
+ if (data.id != null) {
3234
2934
  contents.id = (0, smithy_client_1.expectString)(data.id);
3235
2935
  }
3236
- if (data.name !== undefined && data.name !== null) {
2936
+ if (data.name != null) {
3237
2937
  contents.name = (0, smithy_client_1.expectString)(data.name);
3238
2938
  }
3239
- if (data.position !== undefined && data.position !== null) {
2939
+ if (data.position != null) {
3240
2940
  contents.position = (0, smithy_client_1.expectInt32)(data.position);
3241
2941
  }
3242
- if (data.tags !== undefined && data.tags !== null) {
2942
+ if (data.tags != null) {
3243
2943
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
3244
2944
  }
3245
- return Promise.resolve(contents);
2945
+ return contents;
3246
2946
  };
3247
2947
  exports.deserializeAws_restJson1GetFindingsFilterCommand = deserializeAws_restJson1GetFindingsFilterCommand;
3248
2948
  const deserializeAws_restJson1GetFindingsFilterCommandError = async (output, context) => {
@@ -3250,7 +2950,6 @@ const deserializeAws_restJson1GetFindingsFilterCommandError = async (output, con
3250
2950
  ...output,
3251
2951
  body: await parseBody(output.body, context),
3252
2952
  };
3253
- let response;
3254
2953
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3255
2954
  switch (errorCode) {
3256
2955
  case "AccessDeniedException":
@@ -3276,29 +2975,26 @@ const deserializeAws_restJson1GetFindingsFilterCommandError = async (output, con
3276
2975
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3277
2976
  default:
3278
2977
  const parsedBody = parsedOutput.body;
3279
- const $metadata = deserializeMetadata(output);
3280
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3281
- response = new Macie2ServiceException_1.Macie2ServiceException({
3282
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3283
- $fault: "client",
3284
- $metadata,
2978
+ (0, smithy_client_1.throwDefaultError)({
2979
+ output,
2980
+ parsedBody,
2981
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
2982
+ errorCode,
3285
2983
  });
3286
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3287
2984
  }
3288
2985
  };
3289
2986
  const deserializeAws_restJson1GetFindingsPublicationConfigurationCommand = async (output, context) => {
3290
2987
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3291
2988
  return deserializeAws_restJson1GetFindingsPublicationConfigurationCommandError(output, context);
3292
2989
  }
3293
- const contents = {
2990
+ const contents = map({
3294
2991
  $metadata: deserializeMetadata(output),
3295
- securityHubConfiguration: undefined,
3296
- };
2992
+ });
3297
2993
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3298
- if (data.securityHubConfiguration !== undefined && data.securityHubConfiguration !== null) {
2994
+ if (data.securityHubConfiguration != null) {
3299
2995
  contents.securityHubConfiguration = deserializeAws_restJson1SecurityHubConfiguration(data.securityHubConfiguration, context);
3300
2996
  }
3301
- return Promise.resolve(contents);
2997
+ return contents;
3302
2998
  };
3303
2999
  exports.deserializeAws_restJson1GetFindingsPublicationConfigurationCommand = deserializeAws_restJson1GetFindingsPublicationConfigurationCommand;
3304
3000
  const deserializeAws_restJson1GetFindingsPublicationConfigurationCommandError = async (output, context) => {
@@ -3306,7 +3002,6 @@ const deserializeAws_restJson1GetFindingsPublicationConfigurationCommandError =
3306
3002
  ...output,
3307
3003
  body: await parseBody(output.body, context),
3308
3004
  };
3309
- let response;
3310
3005
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3311
3006
  switch (errorCode) {
3312
3007
  case "AccessDeniedException":
@@ -3332,29 +3027,26 @@ const deserializeAws_restJson1GetFindingsPublicationConfigurationCommandError =
3332
3027
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3333
3028
  default:
3334
3029
  const parsedBody = parsedOutput.body;
3335
- const $metadata = deserializeMetadata(output);
3336
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3337
- response = new Macie2ServiceException_1.Macie2ServiceException({
3338
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3339
- $fault: "client",
3340
- $metadata,
3030
+ (0, smithy_client_1.throwDefaultError)({
3031
+ output,
3032
+ parsedBody,
3033
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3034
+ errorCode,
3341
3035
  });
3342
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3343
3036
  }
3344
3037
  };
3345
3038
  const deserializeAws_restJson1GetFindingStatisticsCommand = async (output, context) => {
3346
3039
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3347
3040
  return deserializeAws_restJson1GetFindingStatisticsCommandError(output, context);
3348
3041
  }
3349
- const contents = {
3042
+ const contents = map({
3350
3043
  $metadata: deserializeMetadata(output),
3351
- countsByGroup: undefined,
3352
- };
3044
+ });
3353
3045
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3354
- if (data.countsByGroup !== undefined && data.countsByGroup !== null) {
3046
+ if (data.countsByGroup != null) {
3355
3047
  contents.countsByGroup = deserializeAws_restJson1__listOfGroupCount(data.countsByGroup, context);
3356
3048
  }
3357
- return Promise.resolve(contents);
3049
+ return contents;
3358
3050
  };
3359
3051
  exports.deserializeAws_restJson1GetFindingStatisticsCommand = deserializeAws_restJson1GetFindingStatisticsCommand;
3360
3052
  const deserializeAws_restJson1GetFindingStatisticsCommandError = async (output, context) => {
@@ -3362,7 +3054,6 @@ const deserializeAws_restJson1GetFindingStatisticsCommandError = async (output,
3362
3054
  ...output,
3363
3055
  body: await parseBody(output.body, context),
3364
3056
  };
3365
- let response;
3366
3057
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3367
3058
  switch (errorCode) {
3368
3059
  case "AccessDeniedException":
@@ -3388,29 +3079,26 @@ const deserializeAws_restJson1GetFindingStatisticsCommandError = async (output,
3388
3079
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3389
3080
  default:
3390
3081
  const parsedBody = parsedOutput.body;
3391
- const $metadata = deserializeMetadata(output);
3392
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3393
- response = new Macie2ServiceException_1.Macie2ServiceException({
3394
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3395
- $fault: "client",
3396
- $metadata,
3082
+ (0, smithy_client_1.throwDefaultError)({
3083
+ output,
3084
+ parsedBody,
3085
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3086
+ errorCode,
3397
3087
  });
3398
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3399
3088
  }
3400
3089
  };
3401
3090
  const deserializeAws_restJson1GetInvitationsCountCommand = async (output, context) => {
3402
3091
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3403
3092
  return deserializeAws_restJson1GetInvitationsCountCommandError(output, context);
3404
3093
  }
3405
- const contents = {
3094
+ const contents = map({
3406
3095
  $metadata: deserializeMetadata(output),
3407
- invitationsCount: undefined,
3408
- };
3096
+ });
3409
3097
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3410
- if (data.invitationsCount !== undefined && data.invitationsCount !== null) {
3098
+ if (data.invitationsCount != null) {
3411
3099
  contents.invitationsCount = (0, smithy_client_1.expectLong)(data.invitationsCount);
3412
3100
  }
3413
- return Promise.resolve(contents);
3101
+ return contents;
3414
3102
  };
3415
3103
  exports.deserializeAws_restJson1GetInvitationsCountCommand = deserializeAws_restJson1GetInvitationsCountCommand;
3416
3104
  const deserializeAws_restJson1GetInvitationsCountCommandError = async (output, context) => {
@@ -3418,7 +3106,6 @@ const deserializeAws_restJson1GetInvitationsCountCommandError = async (output, c
3418
3106
  ...output,
3419
3107
  body: await parseBody(output.body, context),
3420
3108
  };
3421
- let response;
3422
3109
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3423
3110
  switch (errorCode) {
3424
3111
  case "AccessDeniedException":
@@ -3444,45 +3131,38 @@ const deserializeAws_restJson1GetInvitationsCountCommandError = async (output, c
3444
3131
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3445
3132
  default:
3446
3133
  const parsedBody = parsedOutput.body;
3447
- const $metadata = deserializeMetadata(output);
3448
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3449
- response = new Macie2ServiceException_1.Macie2ServiceException({
3450
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3451
- $fault: "client",
3452
- $metadata,
3134
+ (0, smithy_client_1.throwDefaultError)({
3135
+ output,
3136
+ parsedBody,
3137
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3138
+ errorCode,
3453
3139
  });
3454
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3455
3140
  }
3456
3141
  };
3457
3142
  const deserializeAws_restJson1GetMacieSessionCommand = async (output, context) => {
3458
3143
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3459
3144
  return deserializeAws_restJson1GetMacieSessionCommandError(output, context);
3460
3145
  }
3461
- const contents = {
3146
+ const contents = map({
3462
3147
  $metadata: deserializeMetadata(output),
3463
- createdAt: undefined,
3464
- findingPublishingFrequency: undefined,
3465
- serviceRole: undefined,
3466
- status: undefined,
3467
- updatedAt: undefined,
3468
- };
3148
+ });
3469
3149
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3470
- if (data.createdAt !== undefined && data.createdAt !== null) {
3150
+ if (data.createdAt != null) {
3471
3151
  contents.createdAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.createdAt));
3472
3152
  }
3473
- if (data.findingPublishingFrequency !== undefined && data.findingPublishingFrequency !== null) {
3153
+ if (data.findingPublishingFrequency != null) {
3474
3154
  contents.findingPublishingFrequency = (0, smithy_client_1.expectString)(data.findingPublishingFrequency);
3475
3155
  }
3476
- if (data.serviceRole !== undefined && data.serviceRole !== null) {
3156
+ if (data.serviceRole != null) {
3477
3157
  contents.serviceRole = (0, smithy_client_1.expectString)(data.serviceRole);
3478
3158
  }
3479
- if (data.status !== undefined && data.status !== null) {
3159
+ if (data.status != null) {
3480
3160
  contents.status = (0, smithy_client_1.expectString)(data.status);
3481
3161
  }
3482
- if (data.updatedAt !== undefined && data.updatedAt !== null) {
3162
+ if (data.updatedAt != null) {
3483
3163
  contents.updatedAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.updatedAt));
3484
3164
  }
3485
- return Promise.resolve(contents);
3165
+ return contents;
3486
3166
  };
3487
3167
  exports.deserializeAws_restJson1GetMacieSessionCommand = deserializeAws_restJson1GetMacieSessionCommand;
3488
3168
  const deserializeAws_restJson1GetMacieSessionCommandError = async (output, context) => {
@@ -3490,7 +3170,6 @@ const deserializeAws_restJson1GetMacieSessionCommandError = async (output, conte
3490
3170
  ...output,
3491
3171
  body: await parseBody(output.body, context),
3492
3172
  };
3493
- let response;
3494
3173
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3495
3174
  switch (errorCode) {
3496
3175
  case "AccessDeniedException":
@@ -3516,29 +3195,26 @@ const deserializeAws_restJson1GetMacieSessionCommandError = async (output, conte
3516
3195
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3517
3196
  default:
3518
3197
  const parsedBody = parsedOutput.body;
3519
- const $metadata = deserializeMetadata(output);
3520
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3521
- response = new Macie2ServiceException_1.Macie2ServiceException({
3522
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3523
- $fault: "client",
3524
- $metadata,
3198
+ (0, smithy_client_1.throwDefaultError)({
3199
+ output,
3200
+ parsedBody,
3201
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3202
+ errorCode,
3525
3203
  });
3526
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3527
3204
  }
3528
3205
  };
3529
3206
  const deserializeAws_restJson1GetMasterAccountCommand = async (output, context) => {
3530
3207
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3531
3208
  return deserializeAws_restJson1GetMasterAccountCommandError(output, context);
3532
3209
  }
3533
- const contents = {
3210
+ const contents = map({
3534
3211
  $metadata: deserializeMetadata(output),
3535
- master: undefined,
3536
- };
3212
+ });
3537
3213
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3538
- if (data.master !== undefined && data.master !== null) {
3214
+ if (data.master != null) {
3539
3215
  contents.master = deserializeAws_restJson1Invitation(data.master, context);
3540
3216
  }
3541
- return Promise.resolve(contents);
3217
+ return contents;
3542
3218
  };
3543
3219
  exports.deserializeAws_restJson1GetMasterAccountCommand = deserializeAws_restJson1GetMasterAccountCommand;
3544
3220
  const deserializeAws_restJson1GetMasterAccountCommandError = async (output, context) => {
@@ -3546,7 +3222,6 @@ const deserializeAws_restJson1GetMasterAccountCommandError = async (output, cont
3546
3222
  ...output,
3547
3223
  body: await parseBody(output.body, context),
3548
3224
  };
3549
- let response;
3550
3225
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3551
3226
  switch (errorCode) {
3552
3227
  case "AccessDeniedException":
@@ -3572,61 +3247,50 @@ const deserializeAws_restJson1GetMasterAccountCommandError = async (output, cont
3572
3247
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3573
3248
  default:
3574
3249
  const parsedBody = parsedOutput.body;
3575
- const $metadata = deserializeMetadata(output);
3576
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3577
- response = new Macie2ServiceException_1.Macie2ServiceException({
3578
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3579
- $fault: "client",
3580
- $metadata,
3250
+ (0, smithy_client_1.throwDefaultError)({
3251
+ output,
3252
+ parsedBody,
3253
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3254
+ errorCode,
3581
3255
  });
3582
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3583
3256
  }
3584
3257
  };
3585
3258
  const deserializeAws_restJson1GetMemberCommand = async (output, context) => {
3586
3259
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3587
3260
  return deserializeAws_restJson1GetMemberCommandError(output, context);
3588
3261
  }
3589
- const contents = {
3262
+ const contents = map({
3590
3263
  $metadata: deserializeMetadata(output),
3591
- accountId: undefined,
3592
- administratorAccountId: undefined,
3593
- arn: undefined,
3594
- email: undefined,
3595
- invitedAt: undefined,
3596
- masterAccountId: undefined,
3597
- relationshipStatus: undefined,
3598
- tags: undefined,
3599
- updatedAt: undefined,
3600
- };
3264
+ });
3601
3265
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3602
- if (data.accountId !== undefined && data.accountId !== null) {
3266
+ if (data.accountId != null) {
3603
3267
  contents.accountId = (0, smithy_client_1.expectString)(data.accountId);
3604
3268
  }
3605
- if (data.administratorAccountId !== undefined && data.administratorAccountId !== null) {
3269
+ if (data.administratorAccountId != null) {
3606
3270
  contents.administratorAccountId = (0, smithy_client_1.expectString)(data.administratorAccountId);
3607
3271
  }
3608
- if (data.arn !== undefined && data.arn !== null) {
3272
+ if (data.arn != null) {
3609
3273
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
3610
3274
  }
3611
- if (data.email !== undefined && data.email !== null) {
3275
+ if (data.email != null) {
3612
3276
  contents.email = (0, smithy_client_1.expectString)(data.email);
3613
3277
  }
3614
- if (data.invitedAt !== undefined && data.invitedAt !== null) {
3278
+ if (data.invitedAt != null) {
3615
3279
  contents.invitedAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.invitedAt));
3616
3280
  }
3617
- if (data.masterAccountId !== undefined && data.masterAccountId !== null) {
3281
+ if (data.masterAccountId != null) {
3618
3282
  contents.masterAccountId = (0, smithy_client_1.expectString)(data.masterAccountId);
3619
3283
  }
3620
- if (data.relationshipStatus !== undefined && data.relationshipStatus !== null) {
3284
+ if (data.relationshipStatus != null) {
3621
3285
  contents.relationshipStatus = (0, smithy_client_1.expectString)(data.relationshipStatus);
3622
3286
  }
3623
- if (data.tags !== undefined && data.tags !== null) {
3287
+ if (data.tags != null) {
3624
3288
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
3625
3289
  }
3626
- if (data.updatedAt !== undefined && data.updatedAt !== null) {
3290
+ if (data.updatedAt != null) {
3627
3291
  contents.updatedAt = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTime)(data.updatedAt));
3628
3292
  }
3629
- return Promise.resolve(contents);
3293
+ return contents;
3630
3294
  };
3631
3295
  exports.deserializeAws_restJson1GetMemberCommand = deserializeAws_restJson1GetMemberCommand;
3632
3296
  const deserializeAws_restJson1GetMemberCommandError = async (output, context) => {
@@ -3634,7 +3298,6 @@ const deserializeAws_restJson1GetMemberCommandError = async (output, context) =>
3634
3298
  ...output,
3635
3299
  body: await parseBody(output.body, context),
3636
3300
  };
3637
- let response;
3638
3301
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3639
3302
  switch (errorCode) {
3640
3303
  case "AccessDeniedException":
@@ -3660,29 +3323,26 @@ const deserializeAws_restJson1GetMemberCommandError = async (output, context) =>
3660
3323
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3661
3324
  default:
3662
3325
  const parsedBody = parsedOutput.body;
3663
- const $metadata = deserializeMetadata(output);
3664
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3665
- response = new Macie2ServiceException_1.Macie2ServiceException({
3666
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3667
- $fault: "client",
3668
- $metadata,
3326
+ (0, smithy_client_1.throwDefaultError)({
3327
+ output,
3328
+ parsedBody,
3329
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3330
+ errorCode,
3669
3331
  });
3670
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3671
3332
  }
3672
3333
  };
3673
3334
  const deserializeAws_restJson1GetRevealConfigurationCommand = async (output, context) => {
3674
3335
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3675
3336
  return deserializeAws_restJson1GetRevealConfigurationCommandError(output, context);
3676
3337
  }
3677
- const contents = {
3338
+ const contents = map({
3678
3339
  $metadata: deserializeMetadata(output),
3679
- configuration: undefined,
3680
- };
3340
+ });
3681
3341
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3682
- if (data.configuration !== undefined && data.configuration !== null) {
3342
+ if (data.configuration != null) {
3683
3343
  contents.configuration = deserializeAws_restJson1RevealConfiguration(data.configuration, context);
3684
3344
  }
3685
- return Promise.resolve(contents);
3345
+ return contents;
3686
3346
  };
3687
3347
  exports.deserializeAws_restJson1GetRevealConfigurationCommand = deserializeAws_restJson1GetRevealConfigurationCommand;
3688
3348
  const deserializeAws_restJson1GetRevealConfigurationCommandError = async (output, context) => {
@@ -3690,7 +3350,6 @@ const deserializeAws_restJson1GetRevealConfigurationCommandError = async (output
3690
3350
  ...output,
3691
3351
  body: await parseBody(output.body, context),
3692
3352
  };
3693
- let response;
3694
3353
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3695
3354
  switch (errorCode) {
3696
3355
  case "AccessDeniedException":
@@ -3707,37 +3366,32 @@ const deserializeAws_restJson1GetRevealConfigurationCommandError = async (output
3707
3366
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3708
3367
  default:
3709
3368
  const parsedBody = parsedOutput.body;
3710
- const $metadata = deserializeMetadata(output);
3711
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3712
- response = new Macie2ServiceException_1.Macie2ServiceException({
3713
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3714
- $fault: "client",
3715
- $metadata,
3369
+ (0, smithy_client_1.throwDefaultError)({
3370
+ output,
3371
+ parsedBody,
3372
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3373
+ errorCode,
3716
3374
  });
3717
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3718
3375
  }
3719
3376
  };
3720
3377
  const deserializeAws_restJson1GetSensitiveDataOccurrencesCommand = async (output, context) => {
3721
3378
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3722
3379
  return deserializeAws_restJson1GetSensitiveDataOccurrencesCommandError(output, context);
3723
3380
  }
3724
- const contents = {
3381
+ const contents = map({
3725
3382
  $metadata: deserializeMetadata(output),
3726
- error: undefined,
3727
- sensitiveDataOccurrences: undefined,
3728
- status: undefined,
3729
- };
3383
+ });
3730
3384
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3731
- if (data.error !== undefined && data.error !== null) {
3385
+ if (data.error != null) {
3732
3386
  contents.error = (0, smithy_client_1.expectString)(data.error);
3733
3387
  }
3734
- if (data.sensitiveDataOccurrences !== undefined && data.sensitiveDataOccurrences !== null) {
3388
+ if (data.sensitiveDataOccurrences != null) {
3735
3389
  contents.sensitiveDataOccurrences = deserializeAws_restJson1SensitiveDataOccurrences(data.sensitiveDataOccurrences, context);
3736
3390
  }
3737
- if (data.status !== undefined && data.status !== null) {
3391
+ if (data.status != null) {
3738
3392
  contents.status = (0, smithy_client_1.expectString)(data.status);
3739
3393
  }
3740
- return Promise.resolve(contents);
3394
+ return contents;
3741
3395
  };
3742
3396
  exports.deserializeAws_restJson1GetSensitiveDataOccurrencesCommand = deserializeAws_restJson1GetSensitiveDataOccurrencesCommand;
3743
3397
  const deserializeAws_restJson1GetSensitiveDataOccurrencesCommandError = async (output, context) => {
@@ -3745,7 +3399,6 @@ const deserializeAws_restJson1GetSensitiveDataOccurrencesCommandError = async (o
3745
3399
  ...output,
3746
3400
  body: await parseBody(output.body, context),
3747
3401
  };
3748
- let response;
3749
3402
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3750
3403
  switch (errorCode) {
3751
3404
  case "AccessDeniedException":
@@ -3768,33 +3421,29 @@ const deserializeAws_restJson1GetSensitiveDataOccurrencesCommandError = async (o
3768
3421
  throw await deserializeAws_restJson1UnprocessableEntityExceptionResponse(parsedOutput, context);
3769
3422
  default:
3770
3423
  const parsedBody = parsedOutput.body;
3771
- const $metadata = deserializeMetadata(output);
3772
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3773
- response = new Macie2ServiceException_1.Macie2ServiceException({
3774
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3775
- $fault: "client",
3776
- $metadata,
3424
+ (0, smithy_client_1.throwDefaultError)({
3425
+ output,
3426
+ parsedBody,
3427
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3428
+ errorCode,
3777
3429
  });
3778
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3779
3430
  }
3780
3431
  };
3781
3432
  const deserializeAws_restJson1GetSensitiveDataOccurrencesAvailabilityCommand = async (output, context) => {
3782
3433
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3783
3434
  return deserializeAws_restJson1GetSensitiveDataOccurrencesAvailabilityCommandError(output, context);
3784
3435
  }
3785
- const contents = {
3436
+ const contents = map({
3786
3437
  $metadata: deserializeMetadata(output),
3787
- code: undefined,
3788
- reasons: undefined,
3789
- };
3438
+ });
3790
3439
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3791
- if (data.code !== undefined && data.code !== null) {
3440
+ if (data.code != null) {
3792
3441
  contents.code = (0, smithy_client_1.expectString)(data.code);
3793
3442
  }
3794
- if (data.reasons !== undefined && data.reasons !== null) {
3443
+ if (data.reasons != null) {
3795
3444
  contents.reasons = deserializeAws_restJson1__listOfUnavailabilityReasonCode(data.reasons, context);
3796
3445
  }
3797
- return Promise.resolve(contents);
3446
+ return contents;
3798
3447
  };
3799
3448
  exports.deserializeAws_restJson1GetSensitiveDataOccurrencesAvailabilityCommand = deserializeAws_restJson1GetSensitiveDataOccurrencesAvailabilityCommand;
3800
3449
  const deserializeAws_restJson1GetSensitiveDataOccurrencesAvailabilityCommandError = async (output, context) => {
@@ -3802,7 +3451,6 @@ const deserializeAws_restJson1GetSensitiveDataOccurrencesAvailabilityCommandErro
3802
3451
  ...output,
3803
3452
  body: await parseBody(output.body, context),
3804
3453
  };
3805
- let response;
3806
3454
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3807
3455
  switch (errorCode) {
3808
3456
  case "AccessDeniedException":
@@ -3819,37 +3467,32 @@ const deserializeAws_restJson1GetSensitiveDataOccurrencesAvailabilityCommandErro
3819
3467
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
3820
3468
  default:
3821
3469
  const parsedBody = parsedOutput.body;
3822
- const $metadata = deserializeMetadata(output);
3823
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3824
- response = new Macie2ServiceException_1.Macie2ServiceException({
3825
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3826
- $fault: "client",
3827
- $metadata,
3470
+ (0, smithy_client_1.throwDefaultError)({
3471
+ output,
3472
+ parsedBody,
3473
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3474
+ errorCode,
3828
3475
  });
3829
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3830
3476
  }
3831
3477
  };
3832
3478
  const deserializeAws_restJson1GetUsageStatisticsCommand = async (output, context) => {
3833
3479
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3834
3480
  return deserializeAws_restJson1GetUsageStatisticsCommandError(output, context);
3835
3481
  }
3836
- const contents = {
3482
+ const contents = map({
3837
3483
  $metadata: deserializeMetadata(output),
3838
- nextToken: undefined,
3839
- records: undefined,
3840
- timeRange: undefined,
3841
- };
3484
+ });
3842
3485
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3843
- if (data.nextToken !== undefined && data.nextToken !== null) {
3486
+ if (data.nextToken != null) {
3844
3487
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3845
3488
  }
3846
- if (data.records !== undefined && data.records !== null) {
3489
+ if (data.records != null) {
3847
3490
  contents.records = deserializeAws_restJson1__listOfUsageRecord(data.records, context);
3848
3491
  }
3849
- if (data.timeRange !== undefined && data.timeRange !== null) {
3492
+ if (data.timeRange != null) {
3850
3493
  contents.timeRange = (0, smithy_client_1.expectString)(data.timeRange);
3851
3494
  }
3852
- return Promise.resolve(contents);
3495
+ return contents;
3853
3496
  };
3854
3497
  exports.deserializeAws_restJson1GetUsageStatisticsCommand = deserializeAws_restJson1GetUsageStatisticsCommand;
3855
3498
  const deserializeAws_restJson1GetUsageStatisticsCommandError = async (output, context) => {
@@ -3857,7 +3500,6 @@ const deserializeAws_restJson1GetUsageStatisticsCommandError = async (output, co
3857
3500
  ...output,
3858
3501
  body: await parseBody(output.body, context),
3859
3502
  };
3860
- let response;
3861
3503
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3862
3504
  switch (errorCode) {
3863
3505
  case "AccessDeniedException":
@@ -3883,33 +3525,29 @@ const deserializeAws_restJson1GetUsageStatisticsCommandError = async (output, co
3883
3525
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3884
3526
  default:
3885
3527
  const parsedBody = parsedOutput.body;
3886
- const $metadata = deserializeMetadata(output);
3887
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3888
- response = new Macie2ServiceException_1.Macie2ServiceException({
3889
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3890
- $fault: "client",
3891
- $metadata,
3528
+ (0, smithy_client_1.throwDefaultError)({
3529
+ output,
3530
+ parsedBody,
3531
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3532
+ errorCode,
3892
3533
  });
3893
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3894
3534
  }
3895
3535
  };
3896
3536
  const deserializeAws_restJson1GetUsageTotalsCommand = async (output, context) => {
3897
3537
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3898
3538
  return deserializeAws_restJson1GetUsageTotalsCommandError(output, context);
3899
3539
  }
3900
- const contents = {
3540
+ const contents = map({
3901
3541
  $metadata: deserializeMetadata(output),
3902
- timeRange: undefined,
3903
- usageTotals: undefined,
3904
- };
3542
+ });
3905
3543
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3906
- if (data.timeRange !== undefined && data.timeRange !== null) {
3544
+ if (data.timeRange != null) {
3907
3545
  contents.timeRange = (0, smithy_client_1.expectString)(data.timeRange);
3908
3546
  }
3909
- if (data.usageTotals !== undefined && data.usageTotals !== null) {
3547
+ if (data.usageTotals != null) {
3910
3548
  contents.usageTotals = deserializeAws_restJson1__listOfUsageTotal(data.usageTotals, context);
3911
3549
  }
3912
- return Promise.resolve(contents);
3550
+ return contents;
3913
3551
  };
3914
3552
  exports.deserializeAws_restJson1GetUsageTotalsCommand = deserializeAws_restJson1GetUsageTotalsCommand;
3915
3553
  const deserializeAws_restJson1GetUsageTotalsCommandError = async (output, context) => {
@@ -3917,7 +3555,6 @@ const deserializeAws_restJson1GetUsageTotalsCommandError = async (output, contex
3917
3555
  ...output,
3918
3556
  body: await parseBody(output.body, context),
3919
3557
  };
3920
- let response;
3921
3558
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3922
3559
  switch (errorCode) {
3923
3560
  case "AccessDeniedException":
@@ -3943,33 +3580,29 @@ const deserializeAws_restJson1GetUsageTotalsCommandError = async (output, contex
3943
3580
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3944
3581
  default:
3945
3582
  const parsedBody = parsedOutput.body;
3946
- const $metadata = deserializeMetadata(output);
3947
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3948
- response = new Macie2ServiceException_1.Macie2ServiceException({
3949
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3950
- $fault: "client",
3951
- $metadata,
3583
+ (0, smithy_client_1.throwDefaultError)({
3584
+ output,
3585
+ parsedBody,
3586
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3587
+ errorCode,
3952
3588
  });
3953
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3954
3589
  }
3955
3590
  };
3956
3591
  const deserializeAws_restJson1ListClassificationJobsCommand = async (output, context) => {
3957
3592
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3958
3593
  return deserializeAws_restJson1ListClassificationJobsCommandError(output, context);
3959
3594
  }
3960
- const contents = {
3595
+ const contents = map({
3961
3596
  $metadata: deserializeMetadata(output),
3962
- items: undefined,
3963
- nextToken: undefined,
3964
- };
3597
+ });
3965
3598
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3966
- if (data.items !== undefined && data.items !== null) {
3599
+ if (data.items != null) {
3967
3600
  contents.items = deserializeAws_restJson1__listOfJobSummary(data.items, context);
3968
3601
  }
3969
- if (data.nextToken !== undefined && data.nextToken !== null) {
3602
+ if (data.nextToken != null) {
3970
3603
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3971
3604
  }
3972
- return Promise.resolve(contents);
3605
+ return contents;
3973
3606
  };
3974
3607
  exports.deserializeAws_restJson1ListClassificationJobsCommand = deserializeAws_restJson1ListClassificationJobsCommand;
3975
3608
  const deserializeAws_restJson1ListClassificationJobsCommandError = async (output, context) => {
@@ -3977,7 +3610,6 @@ const deserializeAws_restJson1ListClassificationJobsCommandError = async (output
3977
3610
  ...output,
3978
3611
  body: await parseBody(output.body, context),
3979
3612
  };
3980
- let response;
3981
3613
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3982
3614
  switch (errorCode) {
3983
3615
  case "AccessDeniedException":
@@ -4003,33 +3635,29 @@ const deserializeAws_restJson1ListClassificationJobsCommandError = async (output
4003
3635
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4004
3636
  default:
4005
3637
  const parsedBody = parsedOutput.body;
4006
- const $metadata = deserializeMetadata(output);
4007
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4008
- response = new Macie2ServiceException_1.Macie2ServiceException({
4009
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4010
- $fault: "client",
4011
- $metadata,
3638
+ (0, smithy_client_1.throwDefaultError)({
3639
+ output,
3640
+ parsedBody,
3641
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3642
+ errorCode,
4012
3643
  });
4013
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4014
3644
  }
4015
3645
  };
4016
3646
  const deserializeAws_restJson1ListCustomDataIdentifiersCommand = async (output, context) => {
4017
3647
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4018
3648
  return deserializeAws_restJson1ListCustomDataIdentifiersCommandError(output, context);
4019
3649
  }
4020
- const contents = {
3650
+ const contents = map({
4021
3651
  $metadata: deserializeMetadata(output),
4022
- items: undefined,
4023
- nextToken: undefined,
4024
- };
3652
+ });
4025
3653
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4026
- if (data.items !== undefined && data.items !== null) {
3654
+ if (data.items != null) {
4027
3655
  contents.items = deserializeAws_restJson1__listOfCustomDataIdentifierSummary(data.items, context);
4028
3656
  }
4029
- if (data.nextToken !== undefined && data.nextToken !== null) {
3657
+ if (data.nextToken != null) {
4030
3658
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
4031
3659
  }
4032
- return Promise.resolve(contents);
3660
+ return contents;
4033
3661
  };
4034
3662
  exports.deserializeAws_restJson1ListCustomDataIdentifiersCommand = deserializeAws_restJson1ListCustomDataIdentifiersCommand;
4035
3663
  const deserializeAws_restJson1ListCustomDataIdentifiersCommandError = async (output, context) => {
@@ -4037,7 +3665,6 @@ const deserializeAws_restJson1ListCustomDataIdentifiersCommandError = async (out
4037
3665
  ...output,
4038
3666
  body: await parseBody(output.body, context),
4039
3667
  };
4040
- let response;
4041
3668
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4042
3669
  switch (errorCode) {
4043
3670
  case "AccessDeniedException":
@@ -4063,33 +3690,29 @@ const deserializeAws_restJson1ListCustomDataIdentifiersCommandError = async (out
4063
3690
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4064
3691
  default:
4065
3692
  const parsedBody = parsedOutput.body;
4066
- const $metadata = deserializeMetadata(output);
4067
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4068
- response = new Macie2ServiceException_1.Macie2ServiceException({
4069
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4070
- $fault: "client",
4071
- $metadata,
3693
+ (0, smithy_client_1.throwDefaultError)({
3694
+ output,
3695
+ parsedBody,
3696
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3697
+ errorCode,
4072
3698
  });
4073
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4074
3699
  }
4075
3700
  };
4076
3701
  const deserializeAws_restJson1ListFindingsCommand = async (output, context) => {
4077
3702
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4078
3703
  return deserializeAws_restJson1ListFindingsCommandError(output, context);
4079
3704
  }
4080
- const contents = {
3705
+ const contents = map({
4081
3706
  $metadata: deserializeMetadata(output),
4082
- findingIds: undefined,
4083
- nextToken: undefined,
4084
- };
3707
+ });
4085
3708
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4086
- if (data.findingIds !== undefined && data.findingIds !== null) {
3709
+ if (data.findingIds != null) {
4087
3710
  contents.findingIds = deserializeAws_restJson1__listOf__string(data.findingIds, context);
4088
3711
  }
4089
- if (data.nextToken !== undefined && data.nextToken !== null) {
3712
+ if (data.nextToken != null) {
4090
3713
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
4091
3714
  }
4092
- return Promise.resolve(contents);
3715
+ return contents;
4093
3716
  };
4094
3717
  exports.deserializeAws_restJson1ListFindingsCommand = deserializeAws_restJson1ListFindingsCommand;
4095
3718
  const deserializeAws_restJson1ListFindingsCommandError = async (output, context) => {
@@ -4097,7 +3720,6 @@ const deserializeAws_restJson1ListFindingsCommandError = async (output, context)
4097
3720
  ...output,
4098
3721
  body: await parseBody(output.body, context),
4099
3722
  };
4100
- let response;
4101
3723
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4102
3724
  switch (errorCode) {
4103
3725
  case "AccessDeniedException":
@@ -4123,33 +3745,29 @@ const deserializeAws_restJson1ListFindingsCommandError = async (output, context)
4123
3745
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4124
3746
  default:
4125
3747
  const parsedBody = parsedOutput.body;
4126
- const $metadata = deserializeMetadata(output);
4127
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4128
- response = new Macie2ServiceException_1.Macie2ServiceException({
4129
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4130
- $fault: "client",
4131
- $metadata,
3748
+ (0, smithy_client_1.throwDefaultError)({
3749
+ output,
3750
+ parsedBody,
3751
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3752
+ errorCode,
4132
3753
  });
4133
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4134
3754
  }
4135
3755
  };
4136
3756
  const deserializeAws_restJson1ListFindingsFiltersCommand = async (output, context) => {
4137
3757
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4138
3758
  return deserializeAws_restJson1ListFindingsFiltersCommandError(output, context);
4139
3759
  }
4140
- const contents = {
3760
+ const contents = map({
4141
3761
  $metadata: deserializeMetadata(output),
4142
- findingsFilterListItems: undefined,
4143
- nextToken: undefined,
4144
- };
3762
+ });
4145
3763
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4146
- if (data.findingsFilterListItems !== undefined && data.findingsFilterListItems !== null) {
3764
+ if (data.findingsFilterListItems != null) {
4147
3765
  contents.findingsFilterListItems = deserializeAws_restJson1__listOfFindingsFilterListItem(data.findingsFilterListItems, context);
4148
3766
  }
4149
- if (data.nextToken !== undefined && data.nextToken !== null) {
3767
+ if (data.nextToken != null) {
4150
3768
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
4151
3769
  }
4152
- return Promise.resolve(contents);
3770
+ return contents;
4153
3771
  };
4154
3772
  exports.deserializeAws_restJson1ListFindingsFiltersCommand = deserializeAws_restJson1ListFindingsFiltersCommand;
4155
3773
  const deserializeAws_restJson1ListFindingsFiltersCommandError = async (output, context) => {
@@ -4157,7 +3775,6 @@ const deserializeAws_restJson1ListFindingsFiltersCommandError = async (output, c
4157
3775
  ...output,
4158
3776
  body: await parseBody(output.body, context),
4159
3777
  };
4160
- let response;
4161
3778
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4162
3779
  switch (errorCode) {
4163
3780
  case "AccessDeniedException":
@@ -4183,33 +3800,29 @@ const deserializeAws_restJson1ListFindingsFiltersCommandError = async (output, c
4183
3800
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4184
3801
  default:
4185
3802
  const parsedBody = parsedOutput.body;
4186
- const $metadata = deserializeMetadata(output);
4187
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4188
- response = new Macie2ServiceException_1.Macie2ServiceException({
4189
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4190
- $fault: "client",
4191
- $metadata,
3803
+ (0, smithy_client_1.throwDefaultError)({
3804
+ output,
3805
+ parsedBody,
3806
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3807
+ errorCode,
4192
3808
  });
4193
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4194
3809
  }
4195
3810
  };
4196
3811
  const deserializeAws_restJson1ListInvitationsCommand = async (output, context) => {
4197
3812
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4198
3813
  return deserializeAws_restJson1ListInvitationsCommandError(output, context);
4199
3814
  }
4200
- const contents = {
3815
+ const contents = map({
4201
3816
  $metadata: deserializeMetadata(output),
4202
- invitations: undefined,
4203
- nextToken: undefined,
4204
- };
3817
+ });
4205
3818
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4206
- if (data.invitations !== undefined && data.invitations !== null) {
3819
+ if (data.invitations != null) {
4207
3820
  contents.invitations = deserializeAws_restJson1__listOfInvitation(data.invitations, context);
4208
3821
  }
4209
- if (data.nextToken !== undefined && data.nextToken !== null) {
3822
+ if (data.nextToken != null) {
4210
3823
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
4211
3824
  }
4212
- return Promise.resolve(contents);
3825
+ return contents;
4213
3826
  };
4214
3827
  exports.deserializeAws_restJson1ListInvitationsCommand = deserializeAws_restJson1ListInvitationsCommand;
4215
3828
  const deserializeAws_restJson1ListInvitationsCommandError = async (output, context) => {
@@ -4217,7 +3830,6 @@ const deserializeAws_restJson1ListInvitationsCommandError = async (output, conte
4217
3830
  ...output,
4218
3831
  body: await parseBody(output.body, context),
4219
3832
  };
4220
- let response;
4221
3833
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4222
3834
  switch (errorCode) {
4223
3835
  case "AccessDeniedException":
@@ -4243,33 +3855,29 @@ const deserializeAws_restJson1ListInvitationsCommandError = async (output, conte
4243
3855
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4244
3856
  default:
4245
3857
  const parsedBody = parsedOutput.body;
4246
- const $metadata = deserializeMetadata(output);
4247
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4248
- response = new Macie2ServiceException_1.Macie2ServiceException({
4249
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4250
- $fault: "client",
4251
- $metadata,
3858
+ (0, smithy_client_1.throwDefaultError)({
3859
+ output,
3860
+ parsedBody,
3861
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3862
+ errorCode,
4252
3863
  });
4253
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4254
3864
  }
4255
3865
  };
4256
3866
  const deserializeAws_restJson1ListManagedDataIdentifiersCommand = async (output, context) => {
4257
3867
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4258
3868
  return deserializeAws_restJson1ListManagedDataIdentifiersCommandError(output, context);
4259
3869
  }
4260
- const contents = {
3870
+ const contents = map({
4261
3871
  $metadata: deserializeMetadata(output),
4262
- items: undefined,
4263
- nextToken: undefined,
4264
- };
3872
+ });
4265
3873
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4266
- if (data.items !== undefined && data.items !== null) {
3874
+ if (data.items != null) {
4267
3875
  contents.items = deserializeAws_restJson1__listOfManagedDataIdentifierSummary(data.items, context);
4268
3876
  }
4269
- if (data.nextToken !== undefined && data.nextToken !== null) {
3877
+ if (data.nextToken != null) {
4270
3878
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
4271
3879
  }
4272
- return Promise.resolve(contents);
3880
+ return contents;
4273
3881
  };
4274
3882
  exports.deserializeAws_restJson1ListManagedDataIdentifiersCommand = deserializeAws_restJson1ListManagedDataIdentifiersCommand;
4275
3883
  const deserializeAws_restJson1ListManagedDataIdentifiersCommandError = async (output, context) => {
@@ -4277,38 +3885,30 @@ const deserializeAws_restJson1ListManagedDataIdentifiersCommandError = async (ou
4277
3885
  ...output,
4278
3886
  body: await parseBody(output.body, context),
4279
3887
  };
4280
- let response;
4281
3888
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4282
- switch (errorCode) {
4283
- default:
4284
- const parsedBody = parsedOutput.body;
4285
- const $metadata = deserializeMetadata(output);
4286
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4287
- response = new Macie2ServiceException_1.Macie2ServiceException({
4288
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4289
- $fault: "client",
4290
- $metadata,
4291
- });
4292
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4293
- }
3889
+ const parsedBody = parsedOutput.body;
3890
+ (0, smithy_client_1.throwDefaultError)({
3891
+ output,
3892
+ parsedBody,
3893
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3894
+ errorCode,
3895
+ });
4294
3896
  };
4295
3897
  const deserializeAws_restJson1ListMembersCommand = async (output, context) => {
4296
3898
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4297
3899
  return deserializeAws_restJson1ListMembersCommandError(output, context);
4298
3900
  }
4299
- const contents = {
3901
+ const contents = map({
4300
3902
  $metadata: deserializeMetadata(output),
4301
- members: undefined,
4302
- nextToken: undefined,
4303
- };
3903
+ });
4304
3904
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4305
- if (data.members !== undefined && data.members !== null) {
3905
+ if (data.members != null) {
4306
3906
  contents.members = deserializeAws_restJson1__listOfMember(data.members, context);
4307
3907
  }
4308
- if (data.nextToken !== undefined && data.nextToken !== null) {
3908
+ if (data.nextToken != null) {
4309
3909
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
4310
3910
  }
4311
- return Promise.resolve(contents);
3911
+ return contents;
4312
3912
  };
4313
3913
  exports.deserializeAws_restJson1ListMembersCommand = deserializeAws_restJson1ListMembersCommand;
4314
3914
  const deserializeAws_restJson1ListMembersCommandError = async (output, context) => {
@@ -4316,7 +3916,6 @@ const deserializeAws_restJson1ListMembersCommandError = async (output, context)
4316
3916
  ...output,
4317
3917
  body: await parseBody(output.body, context),
4318
3918
  };
4319
- let response;
4320
3919
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4321
3920
  switch (errorCode) {
4322
3921
  case "AccessDeniedException":
@@ -4342,33 +3941,29 @@ const deserializeAws_restJson1ListMembersCommandError = async (output, context)
4342
3941
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4343
3942
  default:
4344
3943
  const parsedBody = parsedOutput.body;
4345
- const $metadata = deserializeMetadata(output);
4346
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4347
- response = new Macie2ServiceException_1.Macie2ServiceException({
4348
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4349
- $fault: "client",
4350
- $metadata,
3944
+ (0, smithy_client_1.throwDefaultError)({
3945
+ output,
3946
+ parsedBody,
3947
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
3948
+ errorCode,
4351
3949
  });
4352
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4353
3950
  }
4354
3951
  };
4355
3952
  const deserializeAws_restJson1ListOrganizationAdminAccountsCommand = async (output, context) => {
4356
3953
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4357
3954
  return deserializeAws_restJson1ListOrganizationAdminAccountsCommandError(output, context);
4358
3955
  }
4359
- const contents = {
3956
+ const contents = map({
4360
3957
  $metadata: deserializeMetadata(output),
4361
- adminAccounts: undefined,
4362
- nextToken: undefined,
4363
- };
3958
+ });
4364
3959
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4365
- if (data.adminAccounts !== undefined && data.adminAccounts !== null) {
3960
+ if (data.adminAccounts != null) {
4366
3961
  contents.adminAccounts = deserializeAws_restJson1__listOfAdminAccount(data.adminAccounts, context);
4367
3962
  }
4368
- if (data.nextToken !== undefined && data.nextToken !== null) {
3963
+ if (data.nextToken != null) {
4369
3964
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
4370
3965
  }
4371
- return Promise.resolve(contents);
3966
+ return contents;
4372
3967
  };
4373
3968
  exports.deserializeAws_restJson1ListOrganizationAdminAccountsCommand = deserializeAws_restJson1ListOrganizationAdminAccountsCommand;
4374
3969
  const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async (output, context) => {
@@ -4376,7 +3971,6 @@ const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async
4376
3971
  ...output,
4377
3972
  body: await parseBody(output.body, context),
4378
3973
  };
4379
- let response;
4380
3974
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4381
3975
  switch (errorCode) {
4382
3976
  case "AccessDeniedException":
@@ -4402,29 +3996,26 @@ const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async
4402
3996
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4403
3997
  default:
4404
3998
  const parsedBody = parsedOutput.body;
4405
- const $metadata = deserializeMetadata(output);
4406
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4407
- response = new Macie2ServiceException_1.Macie2ServiceException({
4408
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4409
- $fault: "client",
4410
- $metadata,
3999
+ (0, smithy_client_1.throwDefaultError)({
4000
+ output,
4001
+ parsedBody,
4002
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4003
+ errorCode,
4411
4004
  });
4412
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4413
4005
  }
4414
4006
  };
4415
4007
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
4416
4008
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4417
4009
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
4418
4010
  }
4419
- const contents = {
4011
+ const contents = map({
4420
4012
  $metadata: deserializeMetadata(output),
4421
- tags: undefined,
4422
- };
4013
+ });
4423
4014
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4424
- if (data.tags !== undefined && data.tags !== null) {
4015
+ if (data.tags != null) {
4425
4016
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
4426
4017
  }
4427
- return Promise.resolve(contents);
4018
+ return contents;
4428
4019
  };
4429
4020
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
4430
4021
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -4432,34 +4023,27 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
4432
4023
  ...output,
4433
4024
  body: await parseBody(output.body, context),
4434
4025
  };
4435
- let response;
4436
4026
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4437
- switch (errorCode) {
4438
- default:
4439
- const parsedBody = parsedOutput.body;
4440
- const $metadata = deserializeMetadata(output);
4441
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4442
- response = new Macie2ServiceException_1.Macie2ServiceException({
4443
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4444
- $fault: "client",
4445
- $metadata,
4446
- });
4447
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4448
- }
4027
+ const parsedBody = parsedOutput.body;
4028
+ (0, smithy_client_1.throwDefaultError)({
4029
+ output,
4030
+ parsedBody,
4031
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4032
+ errorCode,
4033
+ });
4449
4034
  };
4450
4035
  const deserializeAws_restJson1PutClassificationExportConfigurationCommand = async (output, context) => {
4451
4036
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4452
4037
  return deserializeAws_restJson1PutClassificationExportConfigurationCommandError(output, context);
4453
4038
  }
4454
- const contents = {
4039
+ const contents = map({
4455
4040
  $metadata: deserializeMetadata(output),
4456
- configuration: undefined,
4457
- };
4041
+ });
4458
4042
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4459
- if (data.configuration !== undefined && data.configuration !== null) {
4043
+ if (data.configuration != null) {
4460
4044
  contents.configuration = deserializeAws_restJson1ClassificationExportConfiguration(data.configuration, context);
4461
4045
  }
4462
- return Promise.resolve(contents);
4046
+ return contents;
4463
4047
  };
4464
4048
  exports.deserializeAws_restJson1PutClassificationExportConfigurationCommand = deserializeAws_restJson1PutClassificationExportConfigurationCommand;
4465
4049
  const deserializeAws_restJson1PutClassificationExportConfigurationCommandError = async (output, context) => {
@@ -4467,7 +4051,6 @@ const deserializeAws_restJson1PutClassificationExportConfigurationCommandError =
4467
4051
  ...output,
4468
4052
  body: await parseBody(output.body, context),
4469
4053
  };
4470
- let response;
4471
4054
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4472
4055
  switch (errorCode) {
4473
4056
  case "AccessDeniedException":
@@ -4493,25 +4076,23 @@ const deserializeAws_restJson1PutClassificationExportConfigurationCommandError =
4493
4076
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4494
4077
  default:
4495
4078
  const parsedBody = parsedOutput.body;
4496
- const $metadata = deserializeMetadata(output);
4497
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4498
- response = new Macie2ServiceException_1.Macie2ServiceException({
4499
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4500
- $fault: "client",
4501
- $metadata,
4079
+ (0, smithy_client_1.throwDefaultError)({
4080
+ output,
4081
+ parsedBody,
4082
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4083
+ errorCode,
4502
4084
  });
4503
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4504
4085
  }
4505
4086
  };
4506
4087
  const deserializeAws_restJson1PutFindingsPublicationConfigurationCommand = async (output, context) => {
4507
4088
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4508
4089
  return deserializeAws_restJson1PutFindingsPublicationConfigurationCommandError(output, context);
4509
4090
  }
4510
- const contents = {
4091
+ const contents = map({
4511
4092
  $metadata: deserializeMetadata(output),
4512
- };
4093
+ });
4513
4094
  await collectBody(output.body, context);
4514
- return Promise.resolve(contents);
4095
+ return contents;
4515
4096
  };
4516
4097
  exports.deserializeAws_restJson1PutFindingsPublicationConfigurationCommand = deserializeAws_restJson1PutFindingsPublicationConfigurationCommand;
4517
4098
  const deserializeAws_restJson1PutFindingsPublicationConfigurationCommandError = async (output, context) => {
@@ -4519,7 +4100,6 @@ const deserializeAws_restJson1PutFindingsPublicationConfigurationCommandError =
4519
4100
  ...output,
4520
4101
  body: await parseBody(output.body, context),
4521
4102
  };
4522
- let response;
4523
4103
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4524
4104
  switch (errorCode) {
4525
4105
  case "AccessDeniedException":
@@ -4545,33 +4125,29 @@ const deserializeAws_restJson1PutFindingsPublicationConfigurationCommandError =
4545
4125
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4546
4126
  default:
4547
4127
  const parsedBody = parsedOutput.body;
4548
- const $metadata = deserializeMetadata(output);
4549
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4550
- response = new Macie2ServiceException_1.Macie2ServiceException({
4551
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4552
- $fault: "client",
4553
- $metadata,
4128
+ (0, smithy_client_1.throwDefaultError)({
4129
+ output,
4130
+ parsedBody,
4131
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4132
+ errorCode,
4554
4133
  });
4555
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4556
4134
  }
4557
4135
  };
4558
4136
  const deserializeAws_restJson1SearchResourcesCommand = async (output, context) => {
4559
4137
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4560
4138
  return deserializeAws_restJson1SearchResourcesCommandError(output, context);
4561
4139
  }
4562
- const contents = {
4140
+ const contents = map({
4563
4141
  $metadata: deserializeMetadata(output),
4564
- matchingResources: undefined,
4565
- nextToken: undefined,
4566
- };
4142
+ });
4567
4143
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4568
- if (data.matchingResources !== undefined && data.matchingResources !== null) {
4144
+ if (data.matchingResources != null) {
4569
4145
  contents.matchingResources = deserializeAws_restJson1__listOfMatchingResource(data.matchingResources, context);
4570
4146
  }
4571
- if (data.nextToken !== undefined && data.nextToken !== null) {
4147
+ if (data.nextToken != null) {
4572
4148
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
4573
4149
  }
4574
- return Promise.resolve(contents);
4150
+ return contents;
4575
4151
  };
4576
4152
  exports.deserializeAws_restJson1SearchResourcesCommand = deserializeAws_restJson1SearchResourcesCommand;
4577
4153
  const deserializeAws_restJson1SearchResourcesCommandError = async (output, context) => {
@@ -4579,7 +4155,6 @@ const deserializeAws_restJson1SearchResourcesCommandError = async (output, conte
4579
4155
  ...output,
4580
4156
  body: await parseBody(output.body, context),
4581
4157
  };
4582
- let response;
4583
4158
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4584
4159
  switch (errorCode) {
4585
4160
  case "AccessDeniedException":
@@ -4605,25 +4180,23 @@ const deserializeAws_restJson1SearchResourcesCommandError = async (output, conte
4605
4180
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4606
4181
  default:
4607
4182
  const parsedBody = parsedOutput.body;
4608
- const $metadata = deserializeMetadata(output);
4609
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4610
- response = new Macie2ServiceException_1.Macie2ServiceException({
4611
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4612
- $fault: "client",
4613
- $metadata,
4183
+ (0, smithy_client_1.throwDefaultError)({
4184
+ output,
4185
+ parsedBody,
4186
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4187
+ errorCode,
4614
4188
  });
4615
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4616
4189
  }
4617
4190
  };
4618
4191
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
4619
4192
  if (output.statusCode !== 204 && output.statusCode >= 300) {
4620
4193
  return deserializeAws_restJson1TagResourceCommandError(output, context);
4621
4194
  }
4622
- const contents = {
4195
+ const contents = map({
4623
4196
  $metadata: deserializeMetadata(output),
4624
- };
4197
+ });
4625
4198
  await collectBody(output.body, context);
4626
- return Promise.resolve(contents);
4199
+ return contents;
4627
4200
  };
4628
4201
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
4629
4202
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -4631,34 +4204,27 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
4631
4204
  ...output,
4632
4205
  body: await parseBody(output.body, context),
4633
4206
  };
4634
- let response;
4635
4207
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4636
- switch (errorCode) {
4637
- default:
4638
- const parsedBody = parsedOutput.body;
4639
- const $metadata = deserializeMetadata(output);
4640
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4641
- response = new Macie2ServiceException_1.Macie2ServiceException({
4642
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4643
- $fault: "client",
4644
- $metadata,
4645
- });
4646
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4647
- }
4208
+ const parsedBody = parsedOutput.body;
4209
+ (0, smithy_client_1.throwDefaultError)({
4210
+ output,
4211
+ parsedBody,
4212
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4213
+ errorCode,
4214
+ });
4648
4215
  };
4649
4216
  const deserializeAws_restJson1TestCustomDataIdentifierCommand = async (output, context) => {
4650
4217
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4651
4218
  return deserializeAws_restJson1TestCustomDataIdentifierCommandError(output, context);
4652
4219
  }
4653
- const contents = {
4220
+ const contents = map({
4654
4221
  $metadata: deserializeMetadata(output),
4655
- matchCount: undefined,
4656
- };
4222
+ });
4657
4223
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4658
- if (data.matchCount !== undefined && data.matchCount !== null) {
4224
+ if (data.matchCount != null) {
4659
4225
  contents.matchCount = (0, smithy_client_1.expectInt32)(data.matchCount);
4660
4226
  }
4661
- return Promise.resolve(contents);
4227
+ return contents;
4662
4228
  };
4663
4229
  exports.deserializeAws_restJson1TestCustomDataIdentifierCommand = deserializeAws_restJson1TestCustomDataIdentifierCommand;
4664
4230
  const deserializeAws_restJson1TestCustomDataIdentifierCommandError = async (output, context) => {
@@ -4666,7 +4232,6 @@ const deserializeAws_restJson1TestCustomDataIdentifierCommandError = async (outp
4666
4232
  ...output,
4667
4233
  body: await parseBody(output.body, context),
4668
4234
  };
4669
- let response;
4670
4235
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4671
4236
  switch (errorCode) {
4672
4237
  case "AccessDeniedException":
@@ -4692,25 +4257,23 @@ const deserializeAws_restJson1TestCustomDataIdentifierCommandError = async (outp
4692
4257
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4693
4258
  default:
4694
4259
  const parsedBody = parsedOutput.body;
4695
- const $metadata = deserializeMetadata(output);
4696
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4697
- response = new Macie2ServiceException_1.Macie2ServiceException({
4698
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4699
- $fault: "client",
4700
- $metadata,
4260
+ (0, smithy_client_1.throwDefaultError)({
4261
+ output,
4262
+ parsedBody,
4263
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4264
+ errorCode,
4701
4265
  });
4702
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4703
4266
  }
4704
4267
  };
4705
4268
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
4706
4269
  if (output.statusCode !== 204 && output.statusCode >= 300) {
4707
4270
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
4708
4271
  }
4709
- const contents = {
4272
+ const contents = map({
4710
4273
  $metadata: deserializeMetadata(output),
4711
- };
4274
+ });
4712
4275
  await collectBody(output.body, context);
4713
- return Promise.resolve(contents);
4276
+ return contents;
4714
4277
  };
4715
4278
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
4716
4279
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -4718,30 +4281,24 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
4718
4281
  ...output,
4719
4282
  body: await parseBody(output.body, context),
4720
4283
  };
4721
- let response;
4722
4284
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4723
- switch (errorCode) {
4724
- default:
4725
- const parsedBody = parsedOutput.body;
4726
- const $metadata = deserializeMetadata(output);
4727
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4728
- response = new Macie2ServiceException_1.Macie2ServiceException({
4729
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4730
- $fault: "client",
4731
- $metadata,
4732
- });
4733
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4734
- }
4285
+ const parsedBody = parsedOutput.body;
4286
+ (0, smithy_client_1.throwDefaultError)({
4287
+ output,
4288
+ parsedBody,
4289
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4290
+ errorCode,
4291
+ });
4735
4292
  };
4736
4293
  const deserializeAws_restJson1UpdateClassificationJobCommand = async (output, context) => {
4737
4294
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4738
4295
  return deserializeAws_restJson1UpdateClassificationJobCommandError(output, context);
4739
4296
  }
4740
- const contents = {
4297
+ const contents = map({
4741
4298
  $metadata: deserializeMetadata(output),
4742
- };
4299
+ });
4743
4300
  await collectBody(output.body, context);
4744
- return Promise.resolve(contents);
4301
+ return contents;
4745
4302
  };
4746
4303
  exports.deserializeAws_restJson1UpdateClassificationJobCommand = deserializeAws_restJson1UpdateClassificationJobCommand;
4747
4304
  const deserializeAws_restJson1UpdateClassificationJobCommandError = async (output, context) => {
@@ -4749,7 +4306,6 @@ const deserializeAws_restJson1UpdateClassificationJobCommandError = async (outpu
4749
4306
  ...output,
4750
4307
  body: await parseBody(output.body, context),
4751
4308
  };
4752
- let response;
4753
4309
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4754
4310
  switch (errorCode) {
4755
4311
  case "AccessDeniedException":
@@ -4775,33 +4331,29 @@ const deserializeAws_restJson1UpdateClassificationJobCommandError = async (outpu
4775
4331
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4776
4332
  default:
4777
4333
  const parsedBody = parsedOutput.body;
4778
- const $metadata = deserializeMetadata(output);
4779
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4780
- response = new Macie2ServiceException_1.Macie2ServiceException({
4781
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4782
- $fault: "client",
4783
- $metadata,
4334
+ (0, smithy_client_1.throwDefaultError)({
4335
+ output,
4336
+ parsedBody,
4337
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4338
+ errorCode,
4784
4339
  });
4785
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4786
4340
  }
4787
4341
  };
4788
4342
  const deserializeAws_restJson1UpdateFindingsFilterCommand = async (output, context) => {
4789
4343
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4790
4344
  return deserializeAws_restJson1UpdateFindingsFilterCommandError(output, context);
4791
4345
  }
4792
- const contents = {
4346
+ const contents = map({
4793
4347
  $metadata: deserializeMetadata(output),
4794
- arn: undefined,
4795
- id: undefined,
4796
- };
4348
+ });
4797
4349
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4798
- if (data.arn !== undefined && data.arn !== null) {
4350
+ if (data.arn != null) {
4799
4351
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
4800
4352
  }
4801
- if (data.id !== undefined && data.id !== null) {
4353
+ if (data.id != null) {
4802
4354
  contents.id = (0, smithy_client_1.expectString)(data.id);
4803
4355
  }
4804
- return Promise.resolve(contents);
4356
+ return contents;
4805
4357
  };
4806
4358
  exports.deserializeAws_restJson1UpdateFindingsFilterCommand = deserializeAws_restJson1UpdateFindingsFilterCommand;
4807
4359
  const deserializeAws_restJson1UpdateFindingsFilterCommandError = async (output, context) => {
@@ -4809,7 +4361,6 @@ const deserializeAws_restJson1UpdateFindingsFilterCommandError = async (output,
4809
4361
  ...output,
4810
4362
  body: await parseBody(output.body, context),
4811
4363
  };
4812
- let response;
4813
4364
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4814
4365
  switch (errorCode) {
4815
4366
  case "AccessDeniedException":
@@ -4835,25 +4386,23 @@ const deserializeAws_restJson1UpdateFindingsFilterCommandError = async (output,
4835
4386
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4836
4387
  default:
4837
4388
  const parsedBody = parsedOutput.body;
4838
- const $metadata = deserializeMetadata(output);
4839
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4840
- response = new Macie2ServiceException_1.Macie2ServiceException({
4841
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4842
- $fault: "client",
4843
- $metadata,
4389
+ (0, smithy_client_1.throwDefaultError)({
4390
+ output,
4391
+ parsedBody,
4392
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4393
+ errorCode,
4844
4394
  });
4845
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4846
4395
  }
4847
4396
  };
4848
4397
  const deserializeAws_restJson1UpdateMacieSessionCommand = async (output, context) => {
4849
4398
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4850
4399
  return deserializeAws_restJson1UpdateMacieSessionCommandError(output, context);
4851
4400
  }
4852
- const contents = {
4401
+ const contents = map({
4853
4402
  $metadata: deserializeMetadata(output),
4854
- };
4403
+ });
4855
4404
  await collectBody(output.body, context);
4856
- return Promise.resolve(contents);
4405
+ return contents;
4857
4406
  };
4858
4407
  exports.deserializeAws_restJson1UpdateMacieSessionCommand = deserializeAws_restJson1UpdateMacieSessionCommand;
4859
4408
  const deserializeAws_restJson1UpdateMacieSessionCommandError = async (output, context) => {
@@ -4861,7 +4410,6 @@ const deserializeAws_restJson1UpdateMacieSessionCommandError = async (output, co
4861
4410
  ...output,
4862
4411
  body: await parseBody(output.body, context),
4863
4412
  };
4864
- let response;
4865
4413
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4866
4414
  switch (errorCode) {
4867
4415
  case "AccessDeniedException":
@@ -4887,25 +4435,23 @@ const deserializeAws_restJson1UpdateMacieSessionCommandError = async (output, co
4887
4435
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4888
4436
  default:
4889
4437
  const parsedBody = parsedOutput.body;
4890
- const $metadata = deserializeMetadata(output);
4891
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4892
- response = new Macie2ServiceException_1.Macie2ServiceException({
4893
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4894
- $fault: "client",
4895
- $metadata,
4438
+ (0, smithy_client_1.throwDefaultError)({
4439
+ output,
4440
+ parsedBody,
4441
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4442
+ errorCode,
4896
4443
  });
4897
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4898
4444
  }
4899
4445
  };
4900
4446
  const deserializeAws_restJson1UpdateMemberSessionCommand = async (output, context) => {
4901
4447
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4902
4448
  return deserializeAws_restJson1UpdateMemberSessionCommandError(output, context);
4903
4449
  }
4904
- const contents = {
4450
+ const contents = map({
4905
4451
  $metadata: deserializeMetadata(output),
4906
- };
4452
+ });
4907
4453
  await collectBody(output.body, context);
4908
- return Promise.resolve(contents);
4454
+ return contents;
4909
4455
  };
4910
4456
  exports.deserializeAws_restJson1UpdateMemberSessionCommand = deserializeAws_restJson1UpdateMemberSessionCommand;
4911
4457
  const deserializeAws_restJson1UpdateMemberSessionCommandError = async (output, context) => {
@@ -4913,7 +4459,6 @@ const deserializeAws_restJson1UpdateMemberSessionCommandError = async (output, c
4913
4459
  ...output,
4914
4460
  body: await parseBody(output.body, context),
4915
4461
  };
4916
- let response;
4917
4462
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4918
4463
  switch (errorCode) {
4919
4464
  case "AccessDeniedException":
@@ -4939,25 +4484,23 @@ const deserializeAws_restJson1UpdateMemberSessionCommandError = async (output, c
4939
4484
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4940
4485
  default:
4941
4486
  const parsedBody = parsedOutput.body;
4942
- const $metadata = deserializeMetadata(output);
4943
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4944
- response = new Macie2ServiceException_1.Macie2ServiceException({
4945
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4946
- $fault: "client",
4947
- $metadata,
4487
+ (0, smithy_client_1.throwDefaultError)({
4488
+ output,
4489
+ parsedBody,
4490
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4491
+ errorCode,
4948
4492
  });
4949
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4950
4493
  }
4951
4494
  };
4952
4495
  const deserializeAws_restJson1UpdateOrganizationConfigurationCommand = async (output, context) => {
4953
4496
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4954
4497
  return deserializeAws_restJson1UpdateOrganizationConfigurationCommandError(output, context);
4955
4498
  }
4956
- const contents = {
4499
+ const contents = map({
4957
4500
  $metadata: deserializeMetadata(output),
4958
- };
4501
+ });
4959
4502
  await collectBody(output.body, context);
4960
- return Promise.resolve(contents);
4503
+ return contents;
4961
4504
  };
4962
4505
  exports.deserializeAws_restJson1UpdateOrganizationConfigurationCommand = deserializeAws_restJson1UpdateOrganizationConfigurationCommand;
4963
4506
  const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = async (output, context) => {
@@ -4965,7 +4508,6 @@ const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = asyn
4965
4508
  ...output,
4966
4509
  body: await parseBody(output.body, context),
4967
4510
  };
4968
- let response;
4969
4511
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4970
4512
  switch (errorCode) {
4971
4513
  case "AccessDeniedException":
@@ -4991,29 +4533,26 @@ const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = asyn
4991
4533
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
4992
4534
  default:
4993
4535
  const parsedBody = parsedOutput.body;
4994
- const $metadata = deserializeMetadata(output);
4995
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4996
- response = new Macie2ServiceException_1.Macie2ServiceException({
4997
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4998
- $fault: "client",
4999
- $metadata,
4536
+ (0, smithy_client_1.throwDefaultError)({
4537
+ output,
4538
+ parsedBody,
4539
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4540
+ errorCode,
5000
4541
  });
5001
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
5002
4542
  }
5003
4543
  };
5004
4544
  const deserializeAws_restJson1UpdateRevealConfigurationCommand = async (output, context) => {
5005
4545
  if (output.statusCode !== 200 && output.statusCode >= 300) {
5006
4546
  return deserializeAws_restJson1UpdateRevealConfigurationCommandError(output, context);
5007
4547
  }
5008
- const contents = {
4548
+ const contents = map({
5009
4549
  $metadata: deserializeMetadata(output),
5010
- configuration: undefined,
5011
- };
4550
+ });
5012
4551
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
5013
- if (data.configuration !== undefined && data.configuration !== null) {
4552
+ if (data.configuration != null) {
5014
4553
  contents.configuration = deserializeAws_restJson1RevealConfiguration(data.configuration, context);
5015
4554
  }
5016
- return Promise.resolve(contents);
4555
+ return contents;
5017
4556
  };
5018
4557
  exports.deserializeAws_restJson1UpdateRevealConfigurationCommand = deserializeAws_restJson1UpdateRevealConfigurationCommand;
5019
4558
  const deserializeAws_restJson1UpdateRevealConfigurationCommandError = async (output, context) => {
@@ -5021,7 +4560,6 @@ const deserializeAws_restJson1UpdateRevealConfigurationCommandError = async (out
5021
4560
  ...output,
5022
4561
  body: await parseBody(output.body, context),
5023
4562
  };
5024
- let response;
5025
4563
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
5026
4564
  switch (errorCode) {
5027
4565
  case "AccessDeniedException":
@@ -5038,20 +4576,19 @@ const deserializeAws_restJson1UpdateRevealConfigurationCommandError = async (out
5038
4576
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
5039
4577
  default:
5040
4578
  const parsedBody = parsedOutput.body;
5041
- const $metadata = deserializeMetadata(output);
5042
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
5043
- response = new Macie2ServiceException_1.Macie2ServiceException({
5044
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
5045
- $fault: "client",
5046
- $metadata,
4579
+ (0, smithy_client_1.throwDefaultError)({
4580
+ output,
4581
+ parsedBody,
4582
+ exceptionCtor: Macie2ServiceException_1.Macie2ServiceException,
4583
+ errorCode,
5047
4584
  });
5048
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
5049
4585
  }
5050
4586
  };
4587
+ const map = smithy_client_1.map;
5051
4588
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
5052
- const contents = {};
4589
+ const contents = map({});
5053
4590
  const data = parsedOutput.body;
5054
- if (data.message !== undefined && data.message !== null) {
4591
+ if (data.message != null) {
5055
4592
  contents.message = (0, smithy_client_1.expectString)(data.message);
5056
4593
  }
5057
4594
  const exception = new models_0_1.AccessDeniedException({
@@ -5061,9 +4598,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
5061
4598
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
5062
4599
  };
5063
4600
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
5064
- const contents = {};
4601
+ const contents = map({});
5065
4602
  const data = parsedOutput.body;
5066
- if (data.message !== undefined && data.message !== null) {
4603
+ if (data.message != null) {
5067
4604
  contents.message = (0, smithy_client_1.expectString)(data.message);
5068
4605
  }
5069
4606
  const exception = new models_0_1.ConflictException({
@@ -5073,9 +4610,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
5073
4610
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
5074
4611
  };
5075
4612
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
5076
- const contents = {};
4613
+ const contents = map({});
5077
4614
  const data = parsedOutput.body;
5078
- if (data.message !== undefined && data.message !== null) {
4615
+ if (data.message != null) {
5079
4616
  contents.message = (0, smithy_client_1.expectString)(data.message);
5080
4617
  }
5081
4618
  const exception = new models_0_1.InternalServerException({
@@ -5085,9 +4622,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
5085
4622
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
5086
4623
  };
5087
4624
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
5088
- const contents = {};
4625
+ const contents = map({});
5089
4626
  const data = parsedOutput.body;
5090
- if (data.message !== undefined && data.message !== null) {
4627
+ if (data.message != null) {
5091
4628
  contents.message = (0, smithy_client_1.expectString)(data.message);
5092
4629
  }
5093
4630
  const exception = new models_0_1.ResourceNotFoundException({
@@ -5097,9 +4634,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
5097
4634
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
5098
4635
  };
5099
4636
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
5100
- const contents = {};
4637
+ const contents = map({});
5101
4638
  const data = parsedOutput.body;
5102
- if (data.message !== undefined && data.message !== null) {
4639
+ if (data.message != null) {
5103
4640
  contents.message = (0, smithy_client_1.expectString)(data.message);
5104
4641
  }
5105
4642
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -5109,9 +4646,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
5109
4646
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
5110
4647
  };
5111
4648
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
5112
- const contents = {};
4649
+ const contents = map({});
5113
4650
  const data = parsedOutput.body;
5114
- if (data.message !== undefined && data.message !== null) {
4651
+ if (data.message != null) {
5115
4652
  contents.message = (0, smithy_client_1.expectString)(data.message);
5116
4653
  }
5117
4654
  const exception = new models_0_1.ThrottlingException({
@@ -5121,9 +4658,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
5121
4658
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
5122
4659
  };
5123
4660
  const deserializeAws_restJson1UnprocessableEntityExceptionResponse = async (parsedOutput, context) => {
5124
- const contents = {};
4661
+ const contents = map({});
5125
4662
  const data = parsedOutput.body;
5126
- if (data.message !== undefined && data.message !== null) {
4663
+ if (data.message != null) {
5127
4664
  contents.message = (0, smithy_client_1.expectString)(data.message);
5128
4665
  }
5129
4666
  const exception = new models_0_1.UnprocessableEntityException({
@@ -5133,9 +4670,9 @@ const deserializeAws_restJson1UnprocessableEntityExceptionResponse = async (pars
5133
4670
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
5134
4671
  };
5135
4672
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
5136
- const contents = {};
4673
+ const contents = map({});
5137
4674
  const data = parsedOutput.body;
5138
- if (data.message !== undefined && data.message !== null) {
4675
+ if (data.message != null) {
5139
4676
  contents.message = (0, smithy_client_1.expectString)(data.message);
5140
4677
  }
5141
4678
  const exception = new models_0_1.ValidationException({
@@ -5148,9 +4685,6 @@ const serializeAws_restJson1__listOf__string = (input, context) => {
5148
4685
  return input
5149
4686
  .filter((e) => e != null)
5150
4687
  .map((entry) => {
5151
- if (entry === null) {
5152
- return null;
5153
- }
5154
4688
  return entry;
5155
4689
  });
5156
4690
  };
@@ -5158,9 +4692,6 @@ const serializeAws_restJson1__listOfCriteriaForJob = (input, context) => {
5158
4692
  return input
5159
4693
  .filter((e) => e != null)
5160
4694
  .map((entry) => {
5161
- if (entry === null) {
5162
- return null;
5163
- }
5164
4695
  return serializeAws_restJson1CriteriaForJob(entry, context);
5165
4696
  });
5166
4697
  };
@@ -5168,9 +4699,6 @@ const serializeAws_restJson1__listOfFindingType = (input, context) => {
5168
4699
  return input
5169
4700
  .filter((e) => e != null)
5170
4701
  .map((entry) => {
5171
- if (entry === null) {
5172
- return null;
5173
- }
5174
4702
  return entry;
5175
4703
  });
5176
4704
  };
@@ -5178,9 +4706,6 @@ const serializeAws_restJson1__listOfJobScopeTerm = (input, context) => {
5178
4706
  return input
5179
4707
  .filter((e) => e != null)
5180
4708
  .map((entry) => {
5181
- if (entry === null) {
5182
- return null;
5183
- }
5184
4709
  return serializeAws_restJson1JobScopeTerm(entry, context);
5185
4710
  });
5186
4711
  };
@@ -5188,9 +4713,6 @@ const serializeAws_restJson1__listOfListJobsFilterTerm = (input, context) => {
5188
4713
  return input
5189
4714
  .filter((e) => e != null)
5190
4715
  .map((entry) => {
5191
- if (entry === null) {
5192
- return null;
5193
- }
5194
4716
  return serializeAws_restJson1ListJobsFilterTerm(entry, context);
5195
4717
  });
5196
4718
  };
@@ -5198,9 +4720,6 @@ const serializeAws_restJson1__listOfS3BucketDefinitionForJob = (input, context)
5198
4720
  return input
5199
4721
  .filter((e) => e != null)
5200
4722
  .map((entry) => {
5201
- if (entry === null) {
5202
- return null;
5203
- }
5204
4723
  return serializeAws_restJson1S3BucketDefinitionForJob(entry, context);
5205
4724
  });
5206
4725
  };
@@ -5208,9 +4727,6 @@ const serializeAws_restJson1__listOfSearchResourcesCriteria = (input, context) =
5208
4727
  return input
5209
4728
  .filter((e) => e != null)
5210
4729
  .map((entry) => {
5211
- if (entry === null) {
5212
- return null;
5213
- }
5214
4730
  return serializeAws_restJson1SearchResourcesCriteria(entry, context);
5215
4731
  });
5216
4732
  };
@@ -5218,9 +4734,6 @@ const serializeAws_restJson1__listOfSearchResourcesTagCriterionPair = (input, co
5218
4734
  return input
5219
4735
  .filter((e) => e != null)
5220
4736
  .map((entry) => {
5221
- if (entry === null) {
5222
- return null;
5223
- }
5224
4737
  return serializeAws_restJson1SearchResourcesTagCriterionPair(entry, context);
5225
4738
  });
5226
4739
  };
@@ -5228,9 +4741,6 @@ const serializeAws_restJson1__listOfTagCriterionPairForJob = (input, context) =>
5228
4741
  return input
5229
4742
  .filter((e) => e != null)
5230
4743
  .map((entry) => {
5231
- if (entry === null) {
5232
- return null;
5233
- }
5234
4744
  return serializeAws_restJson1TagCriterionPairForJob(entry, context);
5235
4745
  });
5236
4746
  };
@@ -5238,9 +4748,6 @@ const serializeAws_restJson1__listOfTagValuePair = (input, context) => {
5238
4748
  return input
5239
4749
  .filter((e) => e != null)
5240
4750
  .map((entry) => {
5241
- if (entry === null) {
5242
- return null;
5243
- }
5244
4751
  return serializeAws_restJson1TagValuePair(entry, context);
5245
4752
  });
5246
4753
  };
@@ -5248,9 +4755,6 @@ const serializeAws_restJson1__listOfUsageStatisticsFilter = (input, context) =>
5248
4755
  return input
5249
4756
  .filter((e) => e != null)
5250
4757
  .map((entry) => {
5251
- if (entry === null) {
5252
- return null;
5253
- }
5254
4758
  return serializeAws_restJson1UsageStatisticsFilter(entry, context);
5255
4759
  });
5256
4760
  };
@@ -5516,9 +5020,6 @@ const serializeAws_restJson1SeverityLevelList = (input, context) => {
5516
5020
  return input
5517
5021
  .filter((e) => e != null)
5518
5022
  .map((entry) => {
5519
- if (entry === null) {
5520
- return null;
5521
- }
5522
5023
  return serializeAws_restJson1SeverityLevel(entry, context);
5523
5024
  });
5524
5025
  };