@aws-sdk/client-guardduty 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.
@@ -14,16 +14,7 @@ const serializeAws_restJson1AcceptAdministratorInvitationCommand = async (input,
14
14
  "content-type": "application/json",
15
15
  };
16
16
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/administrator";
17
- if (input.DetectorId !== undefined) {
18
- const labelValue = input.DetectorId;
19
- if (labelValue.length <= 0) {
20
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
21
- }
22
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
23
- }
24
- else {
25
- throw new Error("No value provided for input HTTP label: DetectorId.");
26
- }
17
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
27
18
  let body;
28
19
  body = JSON.stringify({
29
20
  ...(input.AdministratorId != null && { administratorId: input.AdministratorId }),
@@ -46,16 +37,7 @@ const serializeAws_restJson1AcceptInvitationCommand = async (input, context) =>
46
37
  "content-type": "application/json",
47
38
  };
48
39
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/master";
49
- if (input.DetectorId !== undefined) {
50
- const labelValue = input.DetectorId;
51
- if (labelValue.length <= 0) {
52
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
53
- }
54
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
55
- }
56
- else {
57
- throw new Error("No value provided for input HTTP label: DetectorId.");
58
- }
40
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
59
41
  let body;
60
42
  body = JSON.stringify({
61
43
  ...(input.InvitationId != null && { invitationId: input.InvitationId }),
@@ -78,16 +60,7 @@ const serializeAws_restJson1ArchiveFindingsCommand = async (input, context) => {
78
60
  "content-type": "application/json",
79
61
  };
80
62
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/archive";
81
- if (input.DetectorId !== undefined) {
82
- const labelValue = input.DetectorId;
83
- if (labelValue.length <= 0) {
84
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
85
- }
86
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
87
- }
88
- else {
89
- throw new Error("No value provided for input HTTP label: DetectorId.");
90
- }
63
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
91
64
  let body;
92
65
  body = JSON.stringify({
93
66
  ...(input.FindingIds != null && { findingIds: serializeAws_restJson1FindingIds(input.FindingIds, context) }),
@@ -138,16 +111,7 @@ const serializeAws_restJson1CreateFilterCommand = async (input, context) => {
138
111
  "content-type": "application/json",
139
112
  };
140
113
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/filter";
141
- if (input.DetectorId !== undefined) {
142
- const labelValue = input.DetectorId;
143
- if (labelValue.length <= 0) {
144
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
145
- }
146
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
147
- }
148
- else {
149
- throw new Error("No value provided for input HTTP label: DetectorId.");
150
- }
114
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
151
115
  let body;
152
116
  body = JSON.stringify({
153
117
  ...(input.Action != null && { action: input.Action }),
@@ -178,16 +142,7 @@ const serializeAws_restJson1CreateIPSetCommand = async (input, context) => {
178
142
  "content-type": "application/json",
179
143
  };
180
144
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset";
181
- if (input.DetectorId !== undefined) {
182
- const labelValue = input.DetectorId;
183
- if (labelValue.length <= 0) {
184
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
185
- }
186
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
187
- }
188
- else {
189
- throw new Error("No value provided for input HTTP label: DetectorId.");
190
- }
145
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
191
146
  let body;
192
147
  body = JSON.stringify({
193
148
  ...(input.Activate != null && { activate: input.Activate }),
@@ -214,16 +169,7 @@ const serializeAws_restJson1CreateMembersCommand = async (input, context) => {
214
169
  "content-type": "application/json",
215
170
  };
216
171
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member";
217
- if (input.DetectorId !== undefined) {
218
- const labelValue = input.DetectorId;
219
- if (labelValue.length <= 0) {
220
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
221
- }
222
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
223
- }
224
- else {
225
- throw new Error("No value provided for input HTTP label: DetectorId.");
226
- }
172
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
227
173
  let body;
228
174
  body = JSON.stringify({
229
175
  ...(input.AccountDetails != null && {
@@ -249,16 +195,7 @@ const serializeAws_restJson1CreatePublishingDestinationCommand = async (input, c
249
195
  };
250
196
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
251
197
  "/detector/{DetectorId}/publishingDestination";
252
- if (input.DetectorId !== undefined) {
253
- const labelValue = input.DetectorId;
254
- if (labelValue.length <= 0) {
255
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
256
- }
257
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
258
- }
259
- else {
260
- throw new Error("No value provided for input HTTP label: DetectorId.");
261
- }
198
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
262
199
  let body;
263
200
  body = JSON.stringify({
264
201
  clientToken: (_a = input.ClientToken) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)(),
@@ -284,16 +221,7 @@ const serializeAws_restJson1CreateSampleFindingsCommand = async (input, context)
284
221
  "content-type": "application/json",
285
222
  };
286
223
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/create";
287
- if (input.DetectorId !== undefined) {
288
- const labelValue = input.DetectorId;
289
- if (labelValue.length <= 0) {
290
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
291
- }
292
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
293
- }
294
- else {
295
- throw new Error("No value provided for input HTTP label: DetectorId.");
296
- }
224
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
297
225
  let body;
298
226
  body = JSON.stringify({
299
227
  ...(input.FindingTypes != null && {
@@ -318,16 +246,7 @@ const serializeAws_restJson1CreateThreatIntelSetCommand = async (input, context)
318
246
  "content-type": "application/json",
319
247
  };
320
248
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/threatintelset";
321
- if (input.DetectorId !== undefined) {
322
- const labelValue = input.DetectorId;
323
- if (labelValue.length <= 0) {
324
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
325
- }
326
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
327
- }
328
- else {
329
- throw new Error("No value provided for input HTTP label: DetectorId.");
330
- }
249
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
331
250
  let body;
332
251
  body = JSON.stringify({
333
252
  ...(input.Activate != null && { activate: input.Activate }),
@@ -373,16 +292,7 @@ const serializeAws_restJson1DeleteDetectorCommand = async (input, context) => {
373
292
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
374
293
  const headers = {};
375
294
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}";
376
- if (input.DetectorId !== undefined) {
377
- const labelValue = input.DetectorId;
378
- if (labelValue.length <= 0) {
379
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
380
- }
381
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
382
- }
383
- else {
384
- throw new Error("No value provided for input HTTP label: DetectorId.");
385
- }
295
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
386
296
  let body;
387
297
  return new protocol_http_1.HttpRequest({
388
298
  protocol,
@@ -400,26 +310,8 @@ const serializeAws_restJson1DeleteFilterCommand = async (input, context) => {
400
310
  const headers = {};
401
311
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
402
312
  "/detector/{DetectorId}/filter/{FilterName}";
403
- if (input.DetectorId !== undefined) {
404
- const labelValue = input.DetectorId;
405
- if (labelValue.length <= 0) {
406
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
407
- }
408
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
409
- }
410
- else {
411
- throw new Error("No value provided for input HTTP label: DetectorId.");
412
- }
413
- if (input.FilterName !== undefined) {
414
- const labelValue = input.FilterName;
415
- if (labelValue.length <= 0) {
416
- throw new Error("Empty value provided for input HTTP label: FilterName.");
417
- }
418
- resolvedPath = resolvedPath.replace("{FilterName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
419
- }
420
- else {
421
- throw new Error("No value provided for input HTTP label: FilterName.");
422
- }
313
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
314
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FilterName", () => input.FilterName, "{FilterName}", false);
423
315
  let body;
424
316
  return new protocol_http_1.HttpRequest({
425
317
  protocol,
@@ -457,26 +349,8 @@ const serializeAws_restJson1DeleteIPSetCommand = async (input, context) => {
457
349
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
458
350
  const headers = {};
459
351
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset/{IpSetId}";
460
- if (input.DetectorId !== undefined) {
461
- const labelValue = input.DetectorId;
462
- if (labelValue.length <= 0) {
463
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
464
- }
465
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
466
- }
467
- else {
468
- throw new Error("No value provided for input HTTP label: DetectorId.");
469
- }
470
- if (input.IpSetId !== undefined) {
471
- const labelValue = input.IpSetId;
472
- if (labelValue.length <= 0) {
473
- throw new Error("Empty value provided for input HTTP label: IpSetId.");
474
- }
475
- resolvedPath = resolvedPath.replace("{IpSetId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
476
- }
477
- else {
478
- throw new Error("No value provided for input HTTP label: IpSetId.");
479
- }
352
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
353
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IpSetId", () => input.IpSetId, "{IpSetId}", false);
480
354
  let body;
481
355
  return new protocol_http_1.HttpRequest({
482
356
  protocol,
@@ -495,16 +369,7 @@ const serializeAws_restJson1DeleteMembersCommand = async (input, context) => {
495
369
  "content-type": "application/json",
496
370
  };
497
371
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/delete";
498
- if (input.DetectorId !== undefined) {
499
- const labelValue = input.DetectorId;
500
- if (labelValue.length <= 0) {
501
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
502
- }
503
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
504
- }
505
- else {
506
- throw new Error("No value provided for input HTTP label: DetectorId.");
507
- }
372
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
508
373
  let body;
509
374
  body = JSON.stringify({
510
375
  ...(input.AccountIds != null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }),
@@ -525,26 +390,8 @@ const serializeAws_restJson1DeletePublishingDestinationCommand = async (input, c
525
390
  const headers = {};
526
391
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
527
392
  "/detector/{DetectorId}/publishingDestination/{DestinationId}";
528
- if (input.DetectorId !== undefined) {
529
- const labelValue = input.DetectorId;
530
- if (labelValue.length <= 0) {
531
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
532
- }
533
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
534
- }
535
- else {
536
- throw new Error("No value provided for input HTTP label: DetectorId.");
537
- }
538
- if (input.DestinationId !== undefined) {
539
- const labelValue = input.DestinationId;
540
- if (labelValue.length <= 0) {
541
- throw new Error("Empty value provided for input HTTP label: DestinationId.");
542
- }
543
- resolvedPath = resolvedPath.replace("{DestinationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
544
- }
545
- else {
546
- throw new Error("No value provided for input HTTP label: DestinationId.");
547
- }
393
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
394
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DestinationId", () => input.DestinationId, "{DestinationId}", false);
548
395
  let body;
549
396
  return new protocol_http_1.HttpRequest({
550
397
  protocol,
@@ -562,26 +409,8 @@ const serializeAws_restJson1DeleteThreatIntelSetCommand = async (input, context)
562
409
  const headers = {};
563
410
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
564
411
  "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}";
565
- if (input.DetectorId !== undefined) {
566
- const labelValue = input.DetectorId;
567
- if (labelValue.length <= 0) {
568
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
569
- }
570
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
571
- }
572
- else {
573
- throw new Error("No value provided for input HTTP label: DetectorId.");
574
- }
575
- if (input.ThreatIntelSetId !== undefined) {
576
- const labelValue = input.ThreatIntelSetId;
577
- if (labelValue.length <= 0) {
578
- throw new Error("Empty value provided for input HTTP label: ThreatIntelSetId.");
579
- }
580
- resolvedPath = resolvedPath.replace("{ThreatIntelSetId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
581
- }
582
- else {
583
- throw new Error("No value provided for input HTTP label: ThreatIntelSetId.");
584
- }
412
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
413
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ThreatIntelSetId", () => input.ThreatIntelSetId, "{ThreatIntelSetId}", false);
585
414
  let body;
586
415
  return new protocol_http_1.HttpRequest({
587
416
  protocol,
@@ -600,16 +429,7 @@ const serializeAws_restJson1DescribeMalwareScansCommand = async (input, context)
600
429
  "content-type": "application/json",
601
430
  };
602
431
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/malware-scans";
603
- if (input.DetectorId !== undefined) {
604
- const labelValue = input.DetectorId;
605
- if (labelValue.length <= 0) {
606
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
607
- }
608
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
609
- }
610
- else {
611
- throw new Error("No value provided for input HTTP label: DetectorId.");
612
- }
432
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
613
433
  let body;
614
434
  body = JSON.stringify({
615
435
  ...(input.FilterCriteria != null && {
@@ -636,16 +456,7 @@ const serializeAws_restJson1DescribeOrganizationConfigurationCommand = async (in
636
456
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
637
457
  const headers = {};
638
458
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/admin";
639
- if (input.DetectorId !== undefined) {
640
- const labelValue = input.DetectorId;
641
- if (labelValue.length <= 0) {
642
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
643
- }
644
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
645
- }
646
- else {
647
- throw new Error("No value provided for input HTTP label: DetectorId.");
648
- }
459
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
649
460
  let body;
650
461
  return new protocol_http_1.HttpRequest({
651
462
  protocol,
@@ -663,26 +474,8 @@ const serializeAws_restJson1DescribePublishingDestinationCommand = async (input,
663
474
  const headers = {};
664
475
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
665
476
  "/detector/{DetectorId}/publishingDestination/{DestinationId}";
666
- if (input.DetectorId !== undefined) {
667
- const labelValue = input.DetectorId;
668
- if (labelValue.length <= 0) {
669
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
670
- }
671
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
672
- }
673
- else {
674
- throw new Error("No value provided for input HTTP label: DetectorId.");
675
- }
676
- if (input.DestinationId !== undefined) {
677
- const labelValue = input.DestinationId;
678
- if (labelValue.length <= 0) {
679
- throw new Error("Empty value provided for input HTTP label: DestinationId.");
680
- }
681
- resolvedPath = resolvedPath.replace("{DestinationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
682
- }
683
- else {
684
- throw new Error("No value provided for input HTTP label: DestinationId.");
685
- }
477
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
478
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DestinationId", () => input.DestinationId, "{DestinationId}", false);
686
479
  let body;
687
480
  return new protocol_http_1.HttpRequest({
688
481
  protocol,
@@ -721,16 +514,7 @@ const serializeAws_restJson1DisassociateFromAdministratorAccountCommand = async
721
514
  const headers = {};
722
515
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
723
516
  "/detector/{DetectorId}/administrator/disassociate";
724
- if (input.DetectorId !== undefined) {
725
- const labelValue = input.DetectorId;
726
- if (labelValue.length <= 0) {
727
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
728
- }
729
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
730
- }
731
- else {
732
- throw new Error("No value provided for input HTTP label: DetectorId.");
733
- }
517
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
734
518
  let body;
735
519
  return new protocol_http_1.HttpRequest({
736
520
  protocol,
@@ -748,16 +532,7 @@ const serializeAws_restJson1DisassociateFromMasterAccountCommand = async (input,
748
532
  const headers = {};
749
533
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
750
534
  "/detector/{DetectorId}/master/disassociate";
751
- if (input.DetectorId !== undefined) {
752
- const labelValue = input.DetectorId;
753
- if (labelValue.length <= 0) {
754
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
755
- }
756
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
757
- }
758
- else {
759
- throw new Error("No value provided for input HTTP label: DetectorId.");
760
- }
535
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
761
536
  let body;
762
537
  return new protocol_http_1.HttpRequest({
763
538
  protocol,
@@ -777,16 +552,7 @@ const serializeAws_restJson1DisassociateMembersCommand = async (input, context)
777
552
  };
778
553
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
779
554
  "/detector/{DetectorId}/member/disassociate";
780
- if (input.DetectorId !== undefined) {
781
- const labelValue = input.DetectorId;
782
- if (labelValue.length <= 0) {
783
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
784
- }
785
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
786
- }
787
- else {
788
- throw new Error("No value provided for input HTTP label: DetectorId.");
789
- }
555
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
790
556
  let body;
791
557
  body = JSON.stringify({
792
558
  ...(input.AccountIds != null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }),
@@ -827,16 +593,7 @@ const serializeAws_restJson1GetAdministratorAccountCommand = async (input, conte
827
593
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
828
594
  const headers = {};
829
595
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/administrator";
830
- if (input.DetectorId !== undefined) {
831
- const labelValue = input.DetectorId;
832
- if (labelValue.length <= 0) {
833
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
834
- }
835
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
836
- }
837
- else {
838
- throw new Error("No value provided for input HTTP label: DetectorId.");
839
- }
596
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
840
597
  let body;
841
598
  return new protocol_http_1.HttpRequest({
842
599
  protocol,
@@ -853,16 +610,7 @@ const serializeAws_restJson1GetDetectorCommand = async (input, context) => {
853
610
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
854
611
  const headers = {};
855
612
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}";
856
- if (input.DetectorId !== undefined) {
857
- const labelValue = input.DetectorId;
858
- if (labelValue.length <= 0) {
859
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
860
- }
861
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
862
- }
863
- else {
864
- throw new Error("No value provided for input HTTP label: DetectorId.");
865
- }
613
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
866
614
  let body;
867
615
  return new protocol_http_1.HttpRequest({
868
616
  protocol,
@@ -880,26 +628,8 @@ const serializeAws_restJson1GetFilterCommand = async (input, context) => {
880
628
  const headers = {};
881
629
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
882
630
  "/detector/{DetectorId}/filter/{FilterName}";
883
- if (input.DetectorId !== undefined) {
884
- const labelValue = input.DetectorId;
885
- if (labelValue.length <= 0) {
886
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
887
- }
888
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
889
- }
890
- else {
891
- throw new Error("No value provided for input HTTP label: DetectorId.");
892
- }
893
- if (input.FilterName !== undefined) {
894
- const labelValue = input.FilterName;
895
- if (labelValue.length <= 0) {
896
- throw new Error("Empty value provided for input HTTP label: FilterName.");
897
- }
898
- resolvedPath = resolvedPath.replace("{FilterName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
899
- }
900
- else {
901
- throw new Error("No value provided for input HTTP label: FilterName.");
902
- }
631
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
632
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FilterName", () => input.FilterName, "{FilterName}", false);
903
633
  let body;
904
634
  return new protocol_http_1.HttpRequest({
905
635
  protocol,
@@ -918,16 +648,7 @@ const serializeAws_restJson1GetFindingsCommand = async (input, context) => {
918
648
  "content-type": "application/json",
919
649
  };
920
650
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/get";
921
- if (input.DetectorId !== undefined) {
922
- const labelValue = input.DetectorId;
923
- if (labelValue.length <= 0) {
924
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
925
- }
926
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
927
- }
928
- else {
929
- throw new Error("No value provided for input HTTP label: DetectorId.");
930
- }
651
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
931
652
  let body;
932
653
  body = JSON.stringify({
933
654
  ...(input.FindingIds != null && { findingIds: serializeAws_restJson1FindingIds(input.FindingIds, context) }),
@@ -953,16 +674,7 @@ const serializeAws_restJson1GetFindingsStatisticsCommand = async (input, context
953
674
  };
954
675
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
955
676
  "/detector/{DetectorId}/findings/statistics";
956
- if (input.DetectorId !== undefined) {
957
- const labelValue = input.DetectorId;
958
- if (labelValue.length <= 0) {
959
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
960
- }
961
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
962
- }
963
- else {
964
- throw new Error("No value provided for input HTTP label: DetectorId.");
965
- }
677
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
966
678
  let body;
967
679
  body = JSON.stringify({
968
680
  ...(input.FindingCriteria != null && {
@@ -1006,26 +718,8 @@ const serializeAws_restJson1GetIPSetCommand = async (input, context) => {
1006
718
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1007
719
  const headers = {};
1008
720
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset/{IpSetId}";
1009
- if (input.DetectorId !== undefined) {
1010
- const labelValue = input.DetectorId;
1011
- if (labelValue.length <= 0) {
1012
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1013
- }
1014
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1015
- }
1016
- else {
1017
- throw new Error("No value provided for input HTTP label: DetectorId.");
1018
- }
1019
- if (input.IpSetId !== undefined) {
1020
- const labelValue = input.IpSetId;
1021
- if (labelValue.length <= 0) {
1022
- throw new Error("Empty value provided for input HTTP label: IpSetId.");
1023
- }
1024
- resolvedPath = resolvedPath.replace("{IpSetId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1025
- }
1026
- else {
1027
- throw new Error("No value provided for input HTTP label: IpSetId.");
1028
- }
721
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
722
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IpSetId", () => input.IpSetId, "{IpSetId}", false);
1029
723
  let body;
1030
724
  return new protocol_http_1.HttpRequest({
1031
725
  protocol,
@@ -1043,16 +737,7 @@ const serializeAws_restJson1GetMalwareScanSettingsCommand = async (input, contex
1043
737
  const headers = {};
1044
738
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1045
739
  "/detector/{DetectorId}/malware-scan-settings";
1046
- if (input.DetectorId !== undefined) {
1047
- const labelValue = input.DetectorId;
1048
- if (labelValue.length <= 0) {
1049
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1050
- }
1051
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1052
- }
1053
- else {
1054
- throw new Error("No value provided for input HTTP label: DetectorId.");
1055
- }
740
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1056
741
  let body;
1057
742
  return new protocol_http_1.HttpRequest({
1058
743
  protocol,
@@ -1069,16 +754,7 @@ const serializeAws_restJson1GetMasterAccountCommand = async (input, context) =>
1069
754
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1070
755
  const headers = {};
1071
756
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/master";
1072
- if (input.DetectorId !== undefined) {
1073
- const labelValue = input.DetectorId;
1074
- if (labelValue.length <= 0) {
1075
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1076
- }
1077
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1078
- }
1079
- else {
1080
- throw new Error("No value provided for input HTTP label: DetectorId.");
1081
- }
757
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1082
758
  let body;
1083
759
  return new protocol_http_1.HttpRequest({
1084
760
  protocol,
@@ -1098,16 +774,7 @@ const serializeAws_restJson1GetMemberDetectorsCommand = async (input, context) =
1098
774
  };
1099
775
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1100
776
  "/detector/{DetectorId}/member/detector/get";
1101
- if (input.DetectorId !== undefined) {
1102
- const labelValue = input.DetectorId;
1103
- if (labelValue.length <= 0) {
1104
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1105
- }
1106
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1107
- }
1108
- else {
1109
- throw new Error("No value provided for input HTTP label: DetectorId.");
1110
- }
777
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1111
778
  let body;
1112
779
  body = JSON.stringify({
1113
780
  ...(input.AccountIds != null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }),
@@ -1129,16 +796,7 @@ const serializeAws_restJson1GetMembersCommand = async (input, context) => {
1129
796
  "content-type": "application/json",
1130
797
  };
1131
798
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/get";
1132
- if (input.DetectorId !== undefined) {
1133
- const labelValue = input.DetectorId;
1134
- if (labelValue.length <= 0) {
1135
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1136
- }
1137
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1138
- }
1139
- else {
1140
- throw new Error("No value provided for input HTTP label: DetectorId.");
1141
- }
799
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1142
800
  let body;
1143
801
  body = JSON.stringify({
1144
802
  ...(input.AccountIds != null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }),
@@ -1161,16 +819,7 @@ const serializeAws_restJson1GetRemainingFreeTrialDaysCommand = async (input, con
1161
819
  };
1162
820
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1163
821
  "/detector/{DetectorId}/freeTrial/daysRemaining";
1164
- if (input.DetectorId !== undefined) {
1165
- const labelValue = input.DetectorId;
1166
- if (labelValue.length <= 0) {
1167
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1168
- }
1169
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1170
- }
1171
- else {
1172
- throw new Error("No value provided for input HTTP label: DetectorId.");
1173
- }
822
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1174
823
  let body;
1175
824
  body = JSON.stringify({
1176
825
  ...(input.AccountIds != null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }),
@@ -1191,26 +840,8 @@ const serializeAws_restJson1GetThreatIntelSetCommand = async (input, context) =>
1191
840
  const headers = {};
1192
841
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1193
842
  "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}";
1194
- if (input.DetectorId !== undefined) {
1195
- const labelValue = input.DetectorId;
1196
- if (labelValue.length <= 0) {
1197
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1198
- }
1199
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1200
- }
1201
- else {
1202
- throw new Error("No value provided for input HTTP label: DetectorId.");
1203
- }
1204
- if (input.ThreatIntelSetId !== undefined) {
1205
- const labelValue = input.ThreatIntelSetId;
1206
- if (labelValue.length <= 0) {
1207
- throw new Error("Empty value provided for input HTTP label: ThreatIntelSetId.");
1208
- }
1209
- resolvedPath = resolvedPath.replace("{ThreatIntelSetId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1210
- }
1211
- else {
1212
- throw new Error("No value provided for input HTTP label: ThreatIntelSetId.");
1213
- }
843
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
844
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ThreatIntelSetId", () => input.ThreatIntelSetId, "{ThreatIntelSetId}", false);
1214
845
  let body;
1215
846
  return new protocol_http_1.HttpRequest({
1216
847
  protocol,
@@ -1229,16 +860,7 @@ const serializeAws_restJson1GetUsageStatisticsCommand = async (input, context) =
1229
860
  "content-type": "application/json",
1230
861
  };
1231
862
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/usage/statistics";
1232
- if (input.DetectorId !== undefined) {
1233
- const labelValue = input.DetectorId;
1234
- if (labelValue.length <= 0) {
1235
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1236
- }
1237
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1238
- }
1239
- else {
1240
- throw new Error("No value provided for input HTTP label: DetectorId.");
1241
- }
863
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1242
864
  let body;
1243
865
  body = JSON.stringify({
1244
866
  ...(input.MaxResults != null && { maxResults: input.MaxResults }),
@@ -1266,16 +888,7 @@ const serializeAws_restJson1InviteMembersCommand = async (input, context) => {
1266
888
  "content-type": "application/json",
1267
889
  };
1268
890
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/invite";
1269
- if (input.DetectorId !== undefined) {
1270
- const labelValue = input.DetectorId;
1271
- if (labelValue.length <= 0) {
1272
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1273
- }
1274
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1275
- }
1276
- else {
1277
- throw new Error("No value provided for input HTTP label: DetectorId.");
1278
- }
891
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1279
892
  let body;
1280
893
  body = JSON.stringify({
1281
894
  ...(input.AccountIds != null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }),
@@ -1297,10 +910,10 @@ const serializeAws_restJson1ListDetectorsCommand = async (input, context) => {
1297
910
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1298
911
  const headers = {};
1299
912
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector";
1300
- const query = {
1301
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
1302
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
1303
- };
913
+ const query = map({
914
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
915
+ nextToken: [, input.NextToken],
916
+ });
1304
917
  let body;
1305
918
  return new protocol_http_1.HttpRequest({
1306
919
  protocol,
@@ -1318,20 +931,11 @@ const serializeAws_restJson1ListFiltersCommand = async (input, context) => {
1318
931
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1319
932
  const headers = {};
1320
933
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/filter";
1321
- if (input.DetectorId !== undefined) {
1322
- const labelValue = input.DetectorId;
1323
- if (labelValue.length <= 0) {
1324
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1325
- }
1326
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1327
- }
1328
- else {
1329
- throw new Error("No value provided for input HTTP label: DetectorId.");
1330
- }
1331
- const query = {
1332
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
1333
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
1334
- };
934
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
935
+ const query = map({
936
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
937
+ nextToken: [, input.NextToken],
938
+ });
1335
939
  let body;
1336
940
  return new protocol_http_1.HttpRequest({
1337
941
  protocol,
@@ -1351,16 +955,7 @@ const serializeAws_restJson1ListFindingsCommand = async (input, context) => {
1351
955
  "content-type": "application/json",
1352
956
  };
1353
957
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings";
1354
- if (input.DetectorId !== undefined) {
1355
- const labelValue = input.DetectorId;
1356
- if (labelValue.length <= 0) {
1357
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1358
- }
1359
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1360
- }
1361
- else {
1362
- throw new Error("No value provided for input HTTP label: DetectorId.");
1363
- }
958
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1364
959
  let body;
1365
960
  body = JSON.stringify({
1366
961
  ...(input.FindingCriteria != null && {
@@ -1387,10 +982,10 @@ const serializeAws_restJson1ListInvitationsCommand = async (input, context) => {
1387
982
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1388
983
  const headers = {};
1389
984
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/invitation";
1390
- const query = {
1391
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
1392
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
1393
- };
985
+ const query = map({
986
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
987
+ nextToken: [, input.NextToken],
988
+ });
1394
989
  let body;
1395
990
  return new protocol_http_1.HttpRequest({
1396
991
  protocol,
@@ -1408,20 +1003,11 @@ const serializeAws_restJson1ListIPSetsCommand = async (input, context) => {
1408
1003
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1409
1004
  const headers = {};
1410
1005
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset";
1411
- if (input.DetectorId !== undefined) {
1412
- const labelValue = input.DetectorId;
1413
- if (labelValue.length <= 0) {
1414
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1415
- }
1416
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1417
- }
1418
- else {
1419
- throw new Error("No value provided for input HTTP label: DetectorId.");
1420
- }
1421
- const query = {
1422
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
1423
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
1424
- };
1006
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1007
+ const query = map({
1008
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
1009
+ nextToken: [, input.NextToken],
1010
+ });
1425
1011
  let body;
1426
1012
  return new protocol_http_1.HttpRequest({
1427
1013
  protocol,
@@ -1439,21 +1025,12 @@ const serializeAws_restJson1ListMembersCommand = async (input, context) => {
1439
1025
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1440
1026
  const headers = {};
1441
1027
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member";
1442
- if (input.DetectorId !== undefined) {
1443
- const labelValue = input.DetectorId;
1444
- if (labelValue.length <= 0) {
1445
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1446
- }
1447
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1448
- }
1449
- else {
1450
- throw new Error("No value provided for input HTTP label: DetectorId.");
1451
- }
1452
- const query = {
1453
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
1454
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
1455
- ...(input.OnlyAssociated !== undefined && { onlyAssociated: input.OnlyAssociated }),
1456
- };
1028
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1029
+ const query = map({
1030
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
1031
+ nextToken: [, input.NextToken],
1032
+ onlyAssociated: [, input.OnlyAssociated],
1033
+ });
1457
1034
  let body;
1458
1035
  return new protocol_http_1.HttpRequest({
1459
1036
  protocol,
@@ -1471,10 +1048,10 @@ const serializeAws_restJson1ListOrganizationAdminAccountsCommand = async (input,
1471
1048
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1472
1049
  const headers = {};
1473
1050
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/admin";
1474
- const query = {
1475
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
1476
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
1477
- };
1051
+ const query = map({
1052
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
1053
+ nextToken: [, input.NextToken],
1054
+ });
1478
1055
  let body;
1479
1056
  return new protocol_http_1.HttpRequest({
1480
1057
  protocol,
@@ -1493,20 +1070,11 @@ const serializeAws_restJson1ListPublishingDestinationsCommand = async (input, co
1493
1070
  const headers = {};
1494
1071
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1495
1072
  "/detector/{DetectorId}/publishingDestination";
1496
- if (input.DetectorId !== undefined) {
1497
- const labelValue = input.DetectorId;
1498
- if (labelValue.length <= 0) {
1499
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1500
- }
1501
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1502
- }
1503
- else {
1504
- throw new Error("No value provided for input HTTP label: DetectorId.");
1505
- }
1506
- const query = {
1507
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
1508
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
1509
- };
1073
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1074
+ const query = map({
1075
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
1076
+ nextToken: [, input.NextToken],
1077
+ });
1510
1078
  let body;
1511
1079
  return new protocol_http_1.HttpRequest({
1512
1080
  protocol,
@@ -1524,16 +1092,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
1524
1092
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1525
1093
  const headers = {};
1526
1094
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
1527
- if (input.ResourceArn !== undefined) {
1528
- const labelValue = input.ResourceArn;
1529
- if (labelValue.length <= 0) {
1530
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
1531
- }
1532
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1533
- }
1534
- else {
1535
- throw new Error("No value provided for input HTTP label: ResourceArn.");
1536
- }
1095
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
1537
1096
  let body;
1538
1097
  return new protocol_http_1.HttpRequest({
1539
1098
  protocol,
@@ -1550,20 +1109,11 @@ const serializeAws_restJson1ListThreatIntelSetsCommand = async (input, context)
1550
1109
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1551
1110
  const headers = {};
1552
1111
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/threatintelset";
1553
- if (input.DetectorId !== undefined) {
1554
- const labelValue = input.DetectorId;
1555
- if (labelValue.length <= 0) {
1556
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1557
- }
1558
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1559
- }
1560
- else {
1561
- throw new Error("No value provided for input HTTP label: DetectorId.");
1562
- }
1563
- const query = {
1564
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
1565
- ...(input.NextToken !== undefined && { nextToken: input.NextToken }),
1566
- };
1112
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1113
+ const query = map({
1114
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
1115
+ nextToken: [, input.NextToken],
1116
+ });
1567
1117
  let body;
1568
1118
  return new protocol_http_1.HttpRequest({
1569
1119
  protocol,
@@ -1583,16 +1133,7 @@ const serializeAws_restJson1StartMonitoringMembersCommand = async (input, contex
1583
1133
  "content-type": "application/json",
1584
1134
  };
1585
1135
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/start";
1586
- if (input.DetectorId !== undefined) {
1587
- const labelValue = input.DetectorId;
1588
- if (labelValue.length <= 0) {
1589
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1590
- }
1591
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1592
- }
1593
- else {
1594
- throw new Error("No value provided for input HTTP label: DetectorId.");
1595
- }
1136
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1596
1137
  let body;
1597
1138
  body = JSON.stringify({
1598
1139
  ...(input.AccountIds != null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }),
@@ -1614,16 +1155,7 @@ const serializeAws_restJson1StopMonitoringMembersCommand = async (input, context
1614
1155
  "content-type": "application/json",
1615
1156
  };
1616
1157
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/member/stop";
1617
- if (input.DetectorId !== undefined) {
1618
- const labelValue = input.DetectorId;
1619
- if (labelValue.length <= 0) {
1620
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1621
- }
1622
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1623
- }
1624
- else {
1625
- throw new Error("No value provided for input HTTP label: DetectorId.");
1626
- }
1158
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1627
1159
  let body;
1628
1160
  body = JSON.stringify({
1629
1161
  ...(input.AccountIds != null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }),
@@ -1645,16 +1177,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
1645
1177
  "content-type": "application/json",
1646
1178
  };
1647
1179
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
1648
- if (input.ResourceArn !== undefined) {
1649
- const labelValue = input.ResourceArn;
1650
- if (labelValue.length <= 0) {
1651
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
1652
- }
1653
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1654
- }
1655
- else {
1656
- throw new Error("No value provided for input HTTP label: ResourceArn.");
1657
- }
1180
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
1658
1181
  let body;
1659
1182
  body = JSON.stringify({
1660
1183
  ...(input.Tags != null && { tags: serializeAws_restJson1TagMap(input.Tags, context) }),
@@ -1676,16 +1199,7 @@ const serializeAws_restJson1UnarchiveFindingsCommand = async (input, context) =>
1676
1199
  "content-type": "application/json",
1677
1200
  };
1678
1201
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/unarchive";
1679
- if (input.DetectorId !== undefined) {
1680
- const labelValue = input.DetectorId;
1681
- if (labelValue.length <= 0) {
1682
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1683
- }
1684
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1685
- }
1686
- else {
1687
- throw new Error("No value provided for input HTTP label: DetectorId.");
1688
- }
1202
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1689
1203
  let body;
1690
1204
  body = JSON.stringify({
1691
1205
  ...(input.FindingIds != null && { findingIds: serializeAws_restJson1FindingIds(input.FindingIds, context) }),
@@ -1705,19 +1219,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
1705
1219
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1706
1220
  const headers = {};
1707
1221
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
1708
- if (input.ResourceArn !== undefined) {
1709
- const labelValue = input.ResourceArn;
1710
- if (labelValue.length <= 0) {
1711
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
1712
- }
1713
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1714
- }
1715
- else {
1716
- throw new Error("No value provided for input HTTP label: ResourceArn.");
1717
- }
1718
- const query = {
1719
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
1720
- };
1222
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
1223
+ const query = map({
1224
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
1225
+ });
1721
1226
  let body;
1722
1227
  return new protocol_http_1.HttpRequest({
1723
1228
  protocol,
@@ -1737,16 +1242,7 @@ const serializeAws_restJson1UpdateDetectorCommand = async (input, context) => {
1737
1242
  "content-type": "application/json",
1738
1243
  };
1739
1244
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}";
1740
- if (input.DetectorId !== undefined) {
1741
- const labelValue = input.DetectorId;
1742
- if (labelValue.length <= 0) {
1743
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1744
- }
1745
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1746
- }
1747
- else {
1748
- throw new Error("No value provided for input HTTP label: DetectorId.");
1749
- }
1245
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1750
1246
  let body;
1751
1247
  body = JSON.stringify({
1752
1248
  ...(input.DataSources != null && {
@@ -1773,26 +1269,8 @@ const serializeAws_restJson1UpdateFilterCommand = async (input, context) => {
1773
1269
  };
1774
1270
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1775
1271
  "/detector/{DetectorId}/filter/{FilterName}";
1776
- if (input.DetectorId !== undefined) {
1777
- const labelValue = input.DetectorId;
1778
- if (labelValue.length <= 0) {
1779
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1780
- }
1781
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1782
- }
1783
- else {
1784
- throw new Error("No value provided for input HTTP label: DetectorId.");
1785
- }
1786
- if (input.FilterName !== undefined) {
1787
- const labelValue = input.FilterName;
1788
- if (labelValue.length <= 0) {
1789
- throw new Error("Empty value provided for input HTTP label: FilterName.");
1790
- }
1791
- resolvedPath = resolvedPath.replace("{FilterName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1792
- }
1793
- else {
1794
- throw new Error("No value provided for input HTTP label: FilterName.");
1795
- }
1272
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1273
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "FilterName", () => input.FilterName, "{FilterName}", false);
1796
1274
  let body;
1797
1275
  body = JSON.stringify({
1798
1276
  ...(input.Action != null && { action: input.Action }),
@@ -1819,16 +1297,7 @@ const serializeAws_restJson1UpdateFindingsFeedbackCommand = async (input, contex
1819
1297
  "content-type": "application/json",
1820
1298
  };
1821
1299
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/findings/feedback";
1822
- if (input.DetectorId !== undefined) {
1823
- const labelValue = input.DetectorId;
1824
- if (labelValue.length <= 0) {
1825
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1826
- }
1827
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1828
- }
1829
- else {
1830
- throw new Error("No value provided for input HTTP label: DetectorId.");
1831
- }
1300
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1832
1301
  let body;
1833
1302
  body = JSON.stringify({
1834
1303
  ...(input.Comments != null && { comments: input.Comments }),
@@ -1852,26 +1321,8 @@ const serializeAws_restJson1UpdateIPSetCommand = async (input, context) => {
1852
1321
  "content-type": "application/json",
1853
1322
  };
1854
1323
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/ipset/{IpSetId}";
1855
- if (input.DetectorId !== undefined) {
1856
- const labelValue = input.DetectorId;
1857
- if (labelValue.length <= 0) {
1858
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1859
- }
1860
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1861
- }
1862
- else {
1863
- throw new Error("No value provided for input HTTP label: DetectorId.");
1864
- }
1865
- if (input.IpSetId !== undefined) {
1866
- const labelValue = input.IpSetId;
1867
- if (labelValue.length <= 0) {
1868
- throw new Error("Empty value provided for input HTTP label: IpSetId.");
1869
- }
1870
- resolvedPath = resolvedPath.replace("{IpSetId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1871
- }
1872
- else {
1873
- throw new Error("No value provided for input HTTP label: IpSetId.");
1874
- }
1324
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1325
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "IpSetId", () => input.IpSetId, "{IpSetId}", false);
1875
1326
  let body;
1876
1327
  body = JSON.stringify({
1877
1328
  ...(input.Activate != null && { activate: input.Activate }),
@@ -1896,16 +1347,7 @@ const serializeAws_restJson1UpdateMalwareScanSettingsCommand = async (input, con
1896
1347
  };
1897
1348
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1898
1349
  "/detector/{DetectorId}/malware-scan-settings";
1899
- if (input.DetectorId !== undefined) {
1900
- const labelValue = input.DetectorId;
1901
- if (labelValue.length <= 0) {
1902
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1903
- }
1904
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1905
- }
1906
- else {
1907
- throw new Error("No value provided for input HTTP label: DetectorId.");
1908
- }
1350
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1909
1351
  let body;
1910
1352
  body = JSON.stringify({
1911
1353
  ...(input.EbsSnapshotPreservation != null && { ebsSnapshotPreservation: input.EbsSnapshotPreservation }),
@@ -1931,16 +1373,7 @@ const serializeAws_restJson1UpdateMemberDetectorsCommand = async (input, context
1931
1373
  };
1932
1374
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1933
1375
  "/detector/{DetectorId}/member/detector/update";
1934
- if (input.DetectorId !== undefined) {
1935
- const labelValue = input.DetectorId;
1936
- if (labelValue.length <= 0) {
1937
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1938
- }
1939
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1940
- }
1941
- else {
1942
- throw new Error("No value provided for input HTTP label: DetectorId.");
1943
- }
1376
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1944
1377
  let body;
1945
1378
  body = JSON.stringify({
1946
1379
  ...(input.AccountIds != null && { accountIds: serializeAws_restJson1AccountIds(input.AccountIds, context) }),
@@ -1965,16 +1398,7 @@ const serializeAws_restJson1UpdateOrganizationConfigurationCommand = async (inpu
1965
1398
  "content-type": "application/json",
1966
1399
  };
1967
1400
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detector/{DetectorId}/admin";
1968
- if (input.DetectorId !== undefined) {
1969
- const labelValue = input.DetectorId;
1970
- if (labelValue.length <= 0) {
1971
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
1972
- }
1973
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1974
- }
1975
- else {
1976
- throw new Error("No value provided for input HTTP label: DetectorId.");
1977
- }
1401
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1978
1402
  let body;
1979
1403
  body = JSON.stringify({
1980
1404
  ...(input.AutoEnable != null && { autoEnable: input.AutoEnable }),
@@ -2000,26 +1424,8 @@ const serializeAws_restJson1UpdatePublishingDestinationCommand = async (input, c
2000
1424
  };
2001
1425
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
2002
1426
  "/detector/{DetectorId}/publishingDestination/{DestinationId}";
2003
- if (input.DetectorId !== undefined) {
2004
- const labelValue = input.DetectorId;
2005
- if (labelValue.length <= 0) {
2006
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
2007
- }
2008
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
2009
- }
2010
- else {
2011
- throw new Error("No value provided for input HTTP label: DetectorId.");
2012
- }
2013
- if (input.DestinationId !== undefined) {
2014
- const labelValue = input.DestinationId;
2015
- if (labelValue.length <= 0) {
2016
- throw new Error("Empty value provided for input HTTP label: DestinationId.");
2017
- }
2018
- resolvedPath = resolvedPath.replace("{DestinationId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
2019
- }
2020
- else {
2021
- throw new Error("No value provided for input HTTP label: DestinationId.");
2022
- }
1427
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1428
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DestinationId", () => input.DestinationId, "{DestinationId}", false);
2023
1429
  let body;
2024
1430
  body = JSON.stringify({
2025
1431
  ...(input.DestinationProperties != null && {
@@ -2044,26 +1450,8 @@ const serializeAws_restJson1UpdateThreatIntelSetCommand = async (input, context)
2044
1450
  };
2045
1451
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
2046
1452
  "/detector/{DetectorId}/threatintelset/{ThreatIntelSetId}";
2047
- if (input.DetectorId !== undefined) {
2048
- const labelValue = input.DetectorId;
2049
- if (labelValue.length <= 0) {
2050
- throw new Error("Empty value provided for input HTTP label: DetectorId.");
2051
- }
2052
- resolvedPath = resolvedPath.replace("{DetectorId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
2053
- }
2054
- else {
2055
- throw new Error("No value provided for input HTTP label: DetectorId.");
2056
- }
2057
- if (input.ThreatIntelSetId !== undefined) {
2058
- const labelValue = input.ThreatIntelSetId;
2059
- if (labelValue.length <= 0) {
2060
- throw new Error("Empty value provided for input HTTP label: ThreatIntelSetId.");
2061
- }
2062
- resolvedPath = resolvedPath.replace("{ThreatIntelSetId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
2063
- }
2064
- else {
2065
- throw new Error("No value provided for input HTTP label: ThreatIntelSetId.");
2066
- }
1453
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "DetectorId", () => input.DetectorId, "{DetectorId}", false);
1454
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ThreatIntelSetId", () => input.ThreatIntelSetId, "{ThreatIntelSetId}", false);
2067
1455
  let body;
2068
1456
  body = JSON.stringify({
2069
1457
  ...(input.Activate != null && { activate: input.Activate }),
@@ -2085,11 +1473,11 @@ const deserializeAws_restJson1AcceptAdministratorInvitationCommand = async (outp
2085
1473
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2086
1474
  return deserializeAws_restJson1AcceptAdministratorInvitationCommandError(output, context);
2087
1475
  }
2088
- const contents = {
1476
+ const contents = map({
2089
1477
  $metadata: deserializeMetadata(output),
2090
- };
1478
+ });
2091
1479
  await collectBody(output.body, context);
2092
- return Promise.resolve(contents);
1480
+ return contents;
2093
1481
  };
2094
1482
  exports.deserializeAws_restJson1AcceptAdministratorInvitationCommand = deserializeAws_restJson1AcceptAdministratorInvitationCommand;
2095
1483
  const deserializeAws_restJson1AcceptAdministratorInvitationCommandError = async (output, context) => {
@@ -2097,7 +1485,6 @@ const deserializeAws_restJson1AcceptAdministratorInvitationCommandError = async
2097
1485
  ...output,
2098
1486
  body: await parseBody(output.body, context),
2099
1487
  };
2100
- let response;
2101
1488
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2102
1489
  switch (errorCode) {
2103
1490
  case "BadRequestException":
@@ -2108,25 +1495,23 @@ const deserializeAws_restJson1AcceptAdministratorInvitationCommandError = async
2108
1495
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2109
1496
  default:
2110
1497
  const parsedBody = parsedOutput.body;
2111
- const $metadata = deserializeMetadata(output);
2112
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2113
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2114
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2115
- $fault: "client",
2116
- $metadata,
1498
+ (0, smithy_client_1.throwDefaultError)({
1499
+ output,
1500
+ parsedBody,
1501
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1502
+ errorCode,
2117
1503
  });
2118
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2119
1504
  }
2120
1505
  };
2121
1506
  const deserializeAws_restJson1AcceptInvitationCommand = async (output, context) => {
2122
1507
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2123
1508
  return deserializeAws_restJson1AcceptInvitationCommandError(output, context);
2124
1509
  }
2125
- const contents = {
1510
+ const contents = map({
2126
1511
  $metadata: deserializeMetadata(output),
2127
- };
1512
+ });
2128
1513
  await collectBody(output.body, context);
2129
- return Promise.resolve(contents);
1514
+ return contents;
2130
1515
  };
2131
1516
  exports.deserializeAws_restJson1AcceptInvitationCommand = deserializeAws_restJson1AcceptInvitationCommand;
2132
1517
  const deserializeAws_restJson1AcceptInvitationCommandError = async (output, context) => {
@@ -2134,7 +1519,6 @@ const deserializeAws_restJson1AcceptInvitationCommandError = async (output, cont
2134
1519
  ...output,
2135
1520
  body: await parseBody(output.body, context),
2136
1521
  };
2137
- let response;
2138
1522
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2139
1523
  switch (errorCode) {
2140
1524
  case "BadRequestException":
@@ -2145,25 +1529,23 @@ const deserializeAws_restJson1AcceptInvitationCommandError = async (output, cont
2145
1529
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2146
1530
  default:
2147
1531
  const parsedBody = parsedOutput.body;
2148
- const $metadata = deserializeMetadata(output);
2149
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2150
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2151
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2152
- $fault: "client",
2153
- $metadata,
1532
+ (0, smithy_client_1.throwDefaultError)({
1533
+ output,
1534
+ parsedBody,
1535
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1536
+ errorCode,
2154
1537
  });
2155
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2156
1538
  }
2157
1539
  };
2158
1540
  const deserializeAws_restJson1ArchiveFindingsCommand = async (output, context) => {
2159
1541
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2160
1542
  return deserializeAws_restJson1ArchiveFindingsCommandError(output, context);
2161
1543
  }
2162
- const contents = {
1544
+ const contents = map({
2163
1545
  $metadata: deserializeMetadata(output),
2164
- };
1546
+ });
2165
1547
  await collectBody(output.body, context);
2166
- return Promise.resolve(contents);
1548
+ return contents;
2167
1549
  };
2168
1550
  exports.deserializeAws_restJson1ArchiveFindingsCommand = deserializeAws_restJson1ArchiveFindingsCommand;
2169
1551
  const deserializeAws_restJson1ArchiveFindingsCommandError = async (output, context) => {
@@ -2171,7 +1553,6 @@ const deserializeAws_restJson1ArchiveFindingsCommandError = async (output, conte
2171
1553
  ...output,
2172
1554
  body: await parseBody(output.body, context),
2173
1555
  };
2174
- let response;
2175
1556
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2176
1557
  switch (errorCode) {
2177
1558
  case "BadRequestException":
@@ -2182,29 +1563,26 @@ const deserializeAws_restJson1ArchiveFindingsCommandError = async (output, conte
2182
1563
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2183
1564
  default:
2184
1565
  const parsedBody = parsedOutput.body;
2185
- const $metadata = deserializeMetadata(output);
2186
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2187
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2188
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2189
- $fault: "client",
2190
- $metadata,
1566
+ (0, smithy_client_1.throwDefaultError)({
1567
+ output,
1568
+ parsedBody,
1569
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1570
+ errorCode,
2191
1571
  });
2192
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2193
1572
  }
2194
1573
  };
2195
1574
  const deserializeAws_restJson1CreateDetectorCommand = async (output, context) => {
2196
1575
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2197
1576
  return deserializeAws_restJson1CreateDetectorCommandError(output, context);
2198
1577
  }
2199
- const contents = {
1578
+ const contents = map({
2200
1579
  $metadata: deserializeMetadata(output),
2201
- DetectorId: undefined,
2202
- };
1580
+ });
2203
1581
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2204
- if (data.detectorId !== undefined && data.detectorId !== null) {
1582
+ if (data.detectorId != null) {
2205
1583
  contents.DetectorId = (0, smithy_client_1.expectString)(data.detectorId);
2206
1584
  }
2207
- return Promise.resolve(contents);
1585
+ return contents;
2208
1586
  };
2209
1587
  exports.deserializeAws_restJson1CreateDetectorCommand = deserializeAws_restJson1CreateDetectorCommand;
2210
1588
  const deserializeAws_restJson1CreateDetectorCommandError = async (output, context) => {
@@ -2212,7 +1590,6 @@ const deserializeAws_restJson1CreateDetectorCommandError = async (output, contex
2212
1590
  ...output,
2213
1591
  body: await parseBody(output.body, context),
2214
1592
  };
2215
- let response;
2216
1593
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2217
1594
  switch (errorCode) {
2218
1595
  case "BadRequestException":
@@ -2223,29 +1600,26 @@ const deserializeAws_restJson1CreateDetectorCommandError = async (output, contex
2223
1600
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2224
1601
  default:
2225
1602
  const parsedBody = parsedOutput.body;
2226
- const $metadata = deserializeMetadata(output);
2227
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2228
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2229
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2230
- $fault: "client",
2231
- $metadata,
1603
+ (0, smithy_client_1.throwDefaultError)({
1604
+ output,
1605
+ parsedBody,
1606
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1607
+ errorCode,
2232
1608
  });
2233
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2234
1609
  }
2235
1610
  };
2236
1611
  const deserializeAws_restJson1CreateFilterCommand = async (output, context) => {
2237
1612
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2238
1613
  return deserializeAws_restJson1CreateFilterCommandError(output, context);
2239
1614
  }
2240
- const contents = {
1615
+ const contents = map({
2241
1616
  $metadata: deserializeMetadata(output),
2242
- Name: undefined,
2243
- };
1617
+ });
2244
1618
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2245
- if (data.name !== undefined && data.name !== null) {
1619
+ if (data.name != null) {
2246
1620
  contents.Name = (0, smithy_client_1.expectString)(data.name);
2247
1621
  }
2248
- return Promise.resolve(contents);
1622
+ return contents;
2249
1623
  };
2250
1624
  exports.deserializeAws_restJson1CreateFilterCommand = deserializeAws_restJson1CreateFilterCommand;
2251
1625
  const deserializeAws_restJson1CreateFilterCommandError = async (output, context) => {
@@ -2253,7 +1627,6 @@ const deserializeAws_restJson1CreateFilterCommandError = async (output, context)
2253
1627
  ...output,
2254
1628
  body: await parseBody(output.body, context),
2255
1629
  };
2256
- let response;
2257
1630
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2258
1631
  switch (errorCode) {
2259
1632
  case "BadRequestException":
@@ -2264,29 +1637,26 @@ const deserializeAws_restJson1CreateFilterCommandError = async (output, context)
2264
1637
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2265
1638
  default:
2266
1639
  const parsedBody = parsedOutput.body;
2267
- const $metadata = deserializeMetadata(output);
2268
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2269
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2270
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2271
- $fault: "client",
2272
- $metadata,
1640
+ (0, smithy_client_1.throwDefaultError)({
1641
+ output,
1642
+ parsedBody,
1643
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1644
+ errorCode,
2273
1645
  });
2274
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2275
1646
  }
2276
1647
  };
2277
1648
  const deserializeAws_restJson1CreateIPSetCommand = async (output, context) => {
2278
1649
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2279
1650
  return deserializeAws_restJson1CreateIPSetCommandError(output, context);
2280
1651
  }
2281
- const contents = {
1652
+ const contents = map({
2282
1653
  $metadata: deserializeMetadata(output),
2283
- IpSetId: undefined,
2284
- };
1654
+ });
2285
1655
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2286
- if (data.ipSetId !== undefined && data.ipSetId !== null) {
1656
+ if (data.ipSetId != null) {
2287
1657
  contents.IpSetId = (0, smithy_client_1.expectString)(data.ipSetId);
2288
1658
  }
2289
- return Promise.resolve(contents);
1659
+ return contents;
2290
1660
  };
2291
1661
  exports.deserializeAws_restJson1CreateIPSetCommand = deserializeAws_restJson1CreateIPSetCommand;
2292
1662
  const deserializeAws_restJson1CreateIPSetCommandError = async (output, context) => {
@@ -2294,7 +1664,6 @@ const deserializeAws_restJson1CreateIPSetCommandError = async (output, context)
2294
1664
  ...output,
2295
1665
  body: await parseBody(output.body, context),
2296
1666
  };
2297
- let response;
2298
1667
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2299
1668
  switch (errorCode) {
2300
1669
  case "BadRequestException":
@@ -2305,29 +1674,26 @@ const deserializeAws_restJson1CreateIPSetCommandError = async (output, context)
2305
1674
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2306
1675
  default:
2307
1676
  const parsedBody = parsedOutput.body;
2308
- const $metadata = deserializeMetadata(output);
2309
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2310
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2311
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2312
- $fault: "client",
2313
- $metadata,
1677
+ (0, smithy_client_1.throwDefaultError)({
1678
+ output,
1679
+ parsedBody,
1680
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1681
+ errorCode,
2314
1682
  });
2315
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2316
1683
  }
2317
1684
  };
2318
1685
  const deserializeAws_restJson1CreateMembersCommand = async (output, context) => {
2319
1686
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2320
1687
  return deserializeAws_restJson1CreateMembersCommandError(output, context);
2321
1688
  }
2322
- const contents = {
1689
+ const contents = map({
2323
1690
  $metadata: deserializeMetadata(output),
2324
- UnprocessedAccounts: undefined,
2325
- };
1691
+ });
2326
1692
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2327
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
1693
+ if (data.unprocessedAccounts != null) {
2328
1694
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
2329
1695
  }
2330
- return Promise.resolve(contents);
1696
+ return contents;
2331
1697
  };
2332
1698
  exports.deserializeAws_restJson1CreateMembersCommand = deserializeAws_restJson1CreateMembersCommand;
2333
1699
  const deserializeAws_restJson1CreateMembersCommandError = async (output, context) => {
@@ -2335,7 +1701,6 @@ const deserializeAws_restJson1CreateMembersCommandError = async (output, context
2335
1701
  ...output,
2336
1702
  body: await parseBody(output.body, context),
2337
1703
  };
2338
- let response;
2339
1704
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2340
1705
  switch (errorCode) {
2341
1706
  case "BadRequestException":
@@ -2346,29 +1711,26 @@ const deserializeAws_restJson1CreateMembersCommandError = async (output, context
2346
1711
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2347
1712
  default:
2348
1713
  const parsedBody = parsedOutput.body;
2349
- const $metadata = deserializeMetadata(output);
2350
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2351
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2352
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2353
- $fault: "client",
2354
- $metadata,
1714
+ (0, smithy_client_1.throwDefaultError)({
1715
+ output,
1716
+ parsedBody,
1717
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1718
+ errorCode,
2355
1719
  });
2356
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2357
1720
  }
2358
1721
  };
2359
1722
  const deserializeAws_restJson1CreatePublishingDestinationCommand = async (output, context) => {
2360
1723
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2361
1724
  return deserializeAws_restJson1CreatePublishingDestinationCommandError(output, context);
2362
1725
  }
2363
- const contents = {
1726
+ const contents = map({
2364
1727
  $metadata: deserializeMetadata(output),
2365
- DestinationId: undefined,
2366
- };
1728
+ });
2367
1729
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2368
- if (data.destinationId !== undefined && data.destinationId !== null) {
1730
+ if (data.destinationId != null) {
2369
1731
  contents.DestinationId = (0, smithy_client_1.expectString)(data.destinationId);
2370
1732
  }
2371
- return Promise.resolve(contents);
1733
+ return contents;
2372
1734
  };
2373
1735
  exports.deserializeAws_restJson1CreatePublishingDestinationCommand = deserializeAws_restJson1CreatePublishingDestinationCommand;
2374
1736
  const deserializeAws_restJson1CreatePublishingDestinationCommandError = async (output, context) => {
@@ -2376,7 +1738,6 @@ const deserializeAws_restJson1CreatePublishingDestinationCommandError = async (o
2376
1738
  ...output,
2377
1739
  body: await parseBody(output.body, context),
2378
1740
  };
2379
- let response;
2380
1741
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2381
1742
  switch (errorCode) {
2382
1743
  case "BadRequestException":
@@ -2387,25 +1748,23 @@ const deserializeAws_restJson1CreatePublishingDestinationCommandError = async (o
2387
1748
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2388
1749
  default:
2389
1750
  const parsedBody = parsedOutput.body;
2390
- const $metadata = deserializeMetadata(output);
2391
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2392
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2393
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2394
- $fault: "client",
2395
- $metadata,
1751
+ (0, smithy_client_1.throwDefaultError)({
1752
+ output,
1753
+ parsedBody,
1754
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1755
+ errorCode,
2396
1756
  });
2397
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2398
1757
  }
2399
1758
  };
2400
1759
  const deserializeAws_restJson1CreateSampleFindingsCommand = async (output, context) => {
2401
1760
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2402
1761
  return deserializeAws_restJson1CreateSampleFindingsCommandError(output, context);
2403
1762
  }
2404
- const contents = {
1763
+ const contents = map({
2405
1764
  $metadata: deserializeMetadata(output),
2406
- };
1765
+ });
2407
1766
  await collectBody(output.body, context);
2408
- return Promise.resolve(contents);
1767
+ return contents;
2409
1768
  };
2410
1769
  exports.deserializeAws_restJson1CreateSampleFindingsCommand = deserializeAws_restJson1CreateSampleFindingsCommand;
2411
1770
  const deserializeAws_restJson1CreateSampleFindingsCommandError = async (output, context) => {
@@ -2413,7 +1772,6 @@ const deserializeAws_restJson1CreateSampleFindingsCommandError = async (output,
2413
1772
  ...output,
2414
1773
  body: await parseBody(output.body, context),
2415
1774
  };
2416
- let response;
2417
1775
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2418
1776
  switch (errorCode) {
2419
1777
  case "BadRequestException":
@@ -2424,29 +1782,26 @@ const deserializeAws_restJson1CreateSampleFindingsCommandError = async (output,
2424
1782
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2425
1783
  default:
2426
1784
  const parsedBody = parsedOutput.body;
2427
- const $metadata = deserializeMetadata(output);
2428
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2429
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2430
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2431
- $fault: "client",
2432
- $metadata,
1785
+ (0, smithy_client_1.throwDefaultError)({
1786
+ output,
1787
+ parsedBody,
1788
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1789
+ errorCode,
2433
1790
  });
2434
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2435
1791
  }
2436
1792
  };
2437
1793
  const deserializeAws_restJson1CreateThreatIntelSetCommand = async (output, context) => {
2438
1794
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2439
1795
  return deserializeAws_restJson1CreateThreatIntelSetCommandError(output, context);
2440
1796
  }
2441
- const contents = {
1797
+ const contents = map({
2442
1798
  $metadata: deserializeMetadata(output),
2443
- ThreatIntelSetId: undefined,
2444
- };
1799
+ });
2445
1800
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2446
- if (data.threatIntelSetId !== undefined && data.threatIntelSetId !== null) {
1801
+ if (data.threatIntelSetId != null) {
2447
1802
  contents.ThreatIntelSetId = (0, smithy_client_1.expectString)(data.threatIntelSetId);
2448
1803
  }
2449
- return Promise.resolve(contents);
1804
+ return contents;
2450
1805
  };
2451
1806
  exports.deserializeAws_restJson1CreateThreatIntelSetCommand = deserializeAws_restJson1CreateThreatIntelSetCommand;
2452
1807
  const deserializeAws_restJson1CreateThreatIntelSetCommandError = async (output, context) => {
@@ -2454,7 +1809,6 @@ const deserializeAws_restJson1CreateThreatIntelSetCommandError = async (output,
2454
1809
  ...output,
2455
1810
  body: await parseBody(output.body, context),
2456
1811
  };
2457
- let response;
2458
1812
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2459
1813
  switch (errorCode) {
2460
1814
  case "BadRequestException":
@@ -2465,29 +1819,26 @@ const deserializeAws_restJson1CreateThreatIntelSetCommandError = async (output,
2465
1819
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2466
1820
  default:
2467
1821
  const parsedBody = parsedOutput.body;
2468
- const $metadata = deserializeMetadata(output);
2469
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2470
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2471
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2472
- $fault: "client",
2473
- $metadata,
1822
+ (0, smithy_client_1.throwDefaultError)({
1823
+ output,
1824
+ parsedBody,
1825
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1826
+ errorCode,
2474
1827
  });
2475
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2476
1828
  }
2477
1829
  };
2478
1830
  const deserializeAws_restJson1DeclineInvitationsCommand = async (output, context) => {
2479
1831
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2480
1832
  return deserializeAws_restJson1DeclineInvitationsCommandError(output, context);
2481
1833
  }
2482
- const contents = {
1834
+ const contents = map({
2483
1835
  $metadata: deserializeMetadata(output),
2484
- UnprocessedAccounts: undefined,
2485
- };
1836
+ });
2486
1837
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2487
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
1838
+ if (data.unprocessedAccounts != null) {
2488
1839
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
2489
1840
  }
2490
- return Promise.resolve(contents);
1841
+ return contents;
2491
1842
  };
2492
1843
  exports.deserializeAws_restJson1DeclineInvitationsCommand = deserializeAws_restJson1DeclineInvitationsCommand;
2493
1844
  const deserializeAws_restJson1DeclineInvitationsCommandError = async (output, context) => {
@@ -2495,7 +1846,6 @@ const deserializeAws_restJson1DeclineInvitationsCommandError = async (output, co
2495
1846
  ...output,
2496
1847
  body: await parseBody(output.body, context),
2497
1848
  };
2498
- let response;
2499
1849
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2500
1850
  switch (errorCode) {
2501
1851
  case "BadRequestException":
@@ -2506,25 +1856,23 @@ const deserializeAws_restJson1DeclineInvitationsCommandError = async (output, co
2506
1856
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2507
1857
  default:
2508
1858
  const parsedBody = parsedOutput.body;
2509
- const $metadata = deserializeMetadata(output);
2510
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2511
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2512
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2513
- $fault: "client",
2514
- $metadata,
1859
+ (0, smithy_client_1.throwDefaultError)({
1860
+ output,
1861
+ parsedBody,
1862
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1863
+ errorCode,
2515
1864
  });
2516
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2517
1865
  }
2518
1866
  };
2519
1867
  const deserializeAws_restJson1DeleteDetectorCommand = async (output, context) => {
2520
1868
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2521
1869
  return deserializeAws_restJson1DeleteDetectorCommandError(output, context);
2522
1870
  }
2523
- const contents = {
1871
+ const contents = map({
2524
1872
  $metadata: deserializeMetadata(output),
2525
- };
1873
+ });
2526
1874
  await collectBody(output.body, context);
2527
- return Promise.resolve(contents);
1875
+ return contents;
2528
1876
  };
2529
1877
  exports.deserializeAws_restJson1DeleteDetectorCommand = deserializeAws_restJson1DeleteDetectorCommand;
2530
1878
  const deserializeAws_restJson1DeleteDetectorCommandError = async (output, context) => {
@@ -2532,7 +1880,6 @@ const deserializeAws_restJson1DeleteDetectorCommandError = async (output, contex
2532
1880
  ...output,
2533
1881
  body: await parseBody(output.body, context),
2534
1882
  };
2535
- let response;
2536
1883
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2537
1884
  switch (errorCode) {
2538
1885
  case "BadRequestException":
@@ -2543,25 +1890,23 @@ const deserializeAws_restJson1DeleteDetectorCommandError = async (output, contex
2543
1890
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2544
1891
  default:
2545
1892
  const parsedBody = parsedOutput.body;
2546
- const $metadata = deserializeMetadata(output);
2547
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2548
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2549
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2550
- $fault: "client",
2551
- $metadata,
1893
+ (0, smithy_client_1.throwDefaultError)({
1894
+ output,
1895
+ parsedBody,
1896
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1897
+ errorCode,
2552
1898
  });
2553
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2554
1899
  }
2555
1900
  };
2556
1901
  const deserializeAws_restJson1DeleteFilterCommand = async (output, context) => {
2557
1902
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2558
1903
  return deserializeAws_restJson1DeleteFilterCommandError(output, context);
2559
1904
  }
2560
- const contents = {
1905
+ const contents = map({
2561
1906
  $metadata: deserializeMetadata(output),
2562
- };
1907
+ });
2563
1908
  await collectBody(output.body, context);
2564
- return Promise.resolve(contents);
1909
+ return contents;
2565
1910
  };
2566
1911
  exports.deserializeAws_restJson1DeleteFilterCommand = deserializeAws_restJson1DeleteFilterCommand;
2567
1912
  const deserializeAws_restJson1DeleteFilterCommandError = async (output, context) => {
@@ -2569,7 +1914,6 @@ const deserializeAws_restJson1DeleteFilterCommandError = async (output, context)
2569
1914
  ...output,
2570
1915
  body: await parseBody(output.body, context),
2571
1916
  };
2572
- let response;
2573
1917
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2574
1918
  switch (errorCode) {
2575
1919
  case "BadRequestException":
@@ -2580,29 +1924,26 @@ const deserializeAws_restJson1DeleteFilterCommandError = async (output, context)
2580
1924
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2581
1925
  default:
2582
1926
  const parsedBody = parsedOutput.body;
2583
- const $metadata = deserializeMetadata(output);
2584
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2585
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2586
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2587
- $fault: "client",
2588
- $metadata,
1927
+ (0, smithy_client_1.throwDefaultError)({
1928
+ output,
1929
+ parsedBody,
1930
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1931
+ errorCode,
2589
1932
  });
2590
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2591
1933
  }
2592
1934
  };
2593
1935
  const deserializeAws_restJson1DeleteInvitationsCommand = async (output, context) => {
2594
1936
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2595
1937
  return deserializeAws_restJson1DeleteInvitationsCommandError(output, context);
2596
1938
  }
2597
- const contents = {
1939
+ const contents = map({
2598
1940
  $metadata: deserializeMetadata(output),
2599
- UnprocessedAccounts: undefined,
2600
- };
1941
+ });
2601
1942
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2602
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
1943
+ if (data.unprocessedAccounts != null) {
2603
1944
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
2604
1945
  }
2605
- return Promise.resolve(contents);
1946
+ return contents;
2606
1947
  };
2607
1948
  exports.deserializeAws_restJson1DeleteInvitationsCommand = deserializeAws_restJson1DeleteInvitationsCommand;
2608
1949
  const deserializeAws_restJson1DeleteInvitationsCommandError = async (output, context) => {
@@ -2610,7 +1951,6 @@ const deserializeAws_restJson1DeleteInvitationsCommandError = async (output, con
2610
1951
  ...output,
2611
1952
  body: await parseBody(output.body, context),
2612
1953
  };
2613
- let response;
2614
1954
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2615
1955
  switch (errorCode) {
2616
1956
  case "BadRequestException":
@@ -2621,25 +1961,23 @@ const deserializeAws_restJson1DeleteInvitationsCommandError = async (output, con
2621
1961
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2622
1962
  default:
2623
1963
  const parsedBody = parsedOutput.body;
2624
- const $metadata = deserializeMetadata(output);
2625
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2626
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2627
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2628
- $fault: "client",
2629
- $metadata,
1964
+ (0, smithy_client_1.throwDefaultError)({
1965
+ output,
1966
+ parsedBody,
1967
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
1968
+ errorCode,
2630
1969
  });
2631
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2632
1970
  }
2633
1971
  };
2634
1972
  const deserializeAws_restJson1DeleteIPSetCommand = async (output, context) => {
2635
1973
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2636
1974
  return deserializeAws_restJson1DeleteIPSetCommandError(output, context);
2637
1975
  }
2638
- const contents = {
1976
+ const contents = map({
2639
1977
  $metadata: deserializeMetadata(output),
2640
- };
1978
+ });
2641
1979
  await collectBody(output.body, context);
2642
- return Promise.resolve(contents);
1980
+ return contents;
2643
1981
  };
2644
1982
  exports.deserializeAws_restJson1DeleteIPSetCommand = deserializeAws_restJson1DeleteIPSetCommand;
2645
1983
  const deserializeAws_restJson1DeleteIPSetCommandError = async (output, context) => {
@@ -2647,7 +1985,6 @@ const deserializeAws_restJson1DeleteIPSetCommandError = async (output, context)
2647
1985
  ...output,
2648
1986
  body: await parseBody(output.body, context),
2649
1987
  };
2650
- let response;
2651
1988
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2652
1989
  switch (errorCode) {
2653
1990
  case "BadRequestException":
@@ -2658,29 +1995,26 @@ const deserializeAws_restJson1DeleteIPSetCommandError = async (output, context)
2658
1995
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2659
1996
  default:
2660
1997
  const parsedBody = parsedOutput.body;
2661
- const $metadata = deserializeMetadata(output);
2662
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2663
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2664
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2665
- $fault: "client",
2666
- $metadata,
1998
+ (0, smithy_client_1.throwDefaultError)({
1999
+ output,
2000
+ parsedBody,
2001
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2002
+ errorCode,
2667
2003
  });
2668
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2669
2004
  }
2670
2005
  };
2671
2006
  const deserializeAws_restJson1DeleteMembersCommand = async (output, context) => {
2672
2007
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2673
2008
  return deserializeAws_restJson1DeleteMembersCommandError(output, context);
2674
2009
  }
2675
- const contents = {
2010
+ const contents = map({
2676
2011
  $metadata: deserializeMetadata(output),
2677
- UnprocessedAccounts: undefined,
2678
- };
2012
+ });
2679
2013
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2680
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
2014
+ if (data.unprocessedAccounts != null) {
2681
2015
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
2682
2016
  }
2683
- return Promise.resolve(contents);
2017
+ return contents;
2684
2018
  };
2685
2019
  exports.deserializeAws_restJson1DeleteMembersCommand = deserializeAws_restJson1DeleteMembersCommand;
2686
2020
  const deserializeAws_restJson1DeleteMembersCommandError = async (output, context) => {
@@ -2688,7 +2022,6 @@ const deserializeAws_restJson1DeleteMembersCommandError = async (output, context
2688
2022
  ...output,
2689
2023
  body: await parseBody(output.body, context),
2690
2024
  };
2691
- let response;
2692
2025
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2693
2026
  switch (errorCode) {
2694
2027
  case "BadRequestException":
@@ -2699,25 +2032,23 @@ const deserializeAws_restJson1DeleteMembersCommandError = async (output, context
2699
2032
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2700
2033
  default:
2701
2034
  const parsedBody = parsedOutput.body;
2702
- const $metadata = deserializeMetadata(output);
2703
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2704
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2705
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2706
- $fault: "client",
2707
- $metadata,
2035
+ (0, smithy_client_1.throwDefaultError)({
2036
+ output,
2037
+ parsedBody,
2038
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2039
+ errorCode,
2708
2040
  });
2709
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2710
2041
  }
2711
2042
  };
2712
2043
  const deserializeAws_restJson1DeletePublishingDestinationCommand = async (output, context) => {
2713
2044
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2714
2045
  return deserializeAws_restJson1DeletePublishingDestinationCommandError(output, context);
2715
2046
  }
2716
- const contents = {
2047
+ const contents = map({
2717
2048
  $metadata: deserializeMetadata(output),
2718
- };
2049
+ });
2719
2050
  await collectBody(output.body, context);
2720
- return Promise.resolve(contents);
2051
+ return contents;
2721
2052
  };
2722
2053
  exports.deserializeAws_restJson1DeletePublishingDestinationCommand = deserializeAws_restJson1DeletePublishingDestinationCommand;
2723
2054
  const deserializeAws_restJson1DeletePublishingDestinationCommandError = async (output, context) => {
@@ -2725,7 +2056,6 @@ const deserializeAws_restJson1DeletePublishingDestinationCommandError = async (o
2725
2056
  ...output,
2726
2057
  body: await parseBody(output.body, context),
2727
2058
  };
2728
- let response;
2729
2059
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2730
2060
  switch (errorCode) {
2731
2061
  case "BadRequestException":
@@ -2736,25 +2066,23 @@ const deserializeAws_restJson1DeletePublishingDestinationCommandError = async (o
2736
2066
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2737
2067
  default:
2738
2068
  const parsedBody = parsedOutput.body;
2739
- const $metadata = deserializeMetadata(output);
2740
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2741
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2742
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2743
- $fault: "client",
2744
- $metadata,
2069
+ (0, smithy_client_1.throwDefaultError)({
2070
+ output,
2071
+ parsedBody,
2072
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2073
+ errorCode,
2745
2074
  });
2746
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2747
2075
  }
2748
2076
  };
2749
2077
  const deserializeAws_restJson1DeleteThreatIntelSetCommand = async (output, context) => {
2750
2078
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2751
2079
  return deserializeAws_restJson1DeleteThreatIntelSetCommandError(output, context);
2752
2080
  }
2753
- const contents = {
2081
+ const contents = map({
2754
2082
  $metadata: deserializeMetadata(output),
2755
- };
2083
+ });
2756
2084
  await collectBody(output.body, context);
2757
- return Promise.resolve(contents);
2085
+ return contents;
2758
2086
  };
2759
2087
  exports.deserializeAws_restJson1DeleteThreatIntelSetCommand = deserializeAws_restJson1DeleteThreatIntelSetCommand;
2760
2088
  const deserializeAws_restJson1DeleteThreatIntelSetCommandError = async (output, context) => {
@@ -2762,7 +2090,6 @@ const deserializeAws_restJson1DeleteThreatIntelSetCommandError = async (output,
2762
2090
  ...output,
2763
2091
  body: await parseBody(output.body, context),
2764
2092
  };
2765
- let response;
2766
2093
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2767
2094
  switch (errorCode) {
2768
2095
  case "BadRequestException":
@@ -2773,33 +2100,29 @@ const deserializeAws_restJson1DeleteThreatIntelSetCommandError = async (output,
2773
2100
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2774
2101
  default:
2775
2102
  const parsedBody = parsedOutput.body;
2776
- const $metadata = deserializeMetadata(output);
2777
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2778
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2779
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2780
- $fault: "client",
2781
- $metadata,
2103
+ (0, smithy_client_1.throwDefaultError)({
2104
+ output,
2105
+ parsedBody,
2106
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2107
+ errorCode,
2782
2108
  });
2783
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2784
2109
  }
2785
2110
  };
2786
2111
  const deserializeAws_restJson1DescribeMalwareScansCommand = async (output, context) => {
2787
2112
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2788
2113
  return deserializeAws_restJson1DescribeMalwareScansCommandError(output, context);
2789
2114
  }
2790
- const contents = {
2115
+ const contents = map({
2791
2116
  $metadata: deserializeMetadata(output),
2792
- NextToken: undefined,
2793
- Scans: undefined,
2794
- };
2117
+ });
2795
2118
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2796
- if (data.nextToken !== undefined && data.nextToken !== null) {
2119
+ if (data.nextToken != null) {
2797
2120
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
2798
2121
  }
2799
- if (data.scans !== undefined && data.scans !== null) {
2122
+ if (data.scans != null) {
2800
2123
  contents.Scans = deserializeAws_restJson1Scans(data.scans, context);
2801
2124
  }
2802
- return Promise.resolve(contents);
2125
+ return contents;
2803
2126
  };
2804
2127
  exports.deserializeAws_restJson1DescribeMalwareScansCommand = deserializeAws_restJson1DescribeMalwareScansCommand;
2805
2128
  const deserializeAws_restJson1DescribeMalwareScansCommandError = async (output, context) => {
@@ -2807,7 +2130,6 @@ const deserializeAws_restJson1DescribeMalwareScansCommandError = async (output,
2807
2130
  ...output,
2808
2131
  body: await parseBody(output.body, context),
2809
2132
  };
2810
- let response;
2811
2133
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2812
2134
  switch (errorCode) {
2813
2135
  case "BadRequestException":
@@ -2818,37 +2140,32 @@ const deserializeAws_restJson1DescribeMalwareScansCommandError = async (output,
2818
2140
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2819
2141
  default:
2820
2142
  const parsedBody = parsedOutput.body;
2821
- const $metadata = deserializeMetadata(output);
2822
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2823
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2824
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2825
- $fault: "client",
2826
- $metadata,
2143
+ (0, smithy_client_1.throwDefaultError)({
2144
+ output,
2145
+ parsedBody,
2146
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2147
+ errorCode,
2827
2148
  });
2828
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2829
2149
  }
2830
2150
  };
2831
2151
  const deserializeAws_restJson1DescribeOrganizationConfigurationCommand = async (output, context) => {
2832
2152
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2833
2153
  return deserializeAws_restJson1DescribeOrganizationConfigurationCommandError(output, context);
2834
2154
  }
2835
- const contents = {
2155
+ const contents = map({
2836
2156
  $metadata: deserializeMetadata(output),
2837
- AutoEnable: undefined,
2838
- DataSources: undefined,
2839
- MemberAccountLimitReached: undefined,
2840
- };
2157
+ });
2841
2158
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2842
- if (data.autoEnable !== undefined && data.autoEnable !== null) {
2159
+ if (data.autoEnable != null) {
2843
2160
  contents.AutoEnable = (0, smithy_client_1.expectBoolean)(data.autoEnable);
2844
2161
  }
2845
- if (data.dataSources !== undefined && data.dataSources !== null) {
2162
+ if (data.dataSources != null) {
2846
2163
  contents.DataSources = deserializeAws_restJson1OrganizationDataSourceConfigurationsResult(data.dataSources, context);
2847
2164
  }
2848
- if (data.memberAccountLimitReached !== undefined && data.memberAccountLimitReached !== null) {
2165
+ if (data.memberAccountLimitReached != null) {
2849
2166
  contents.MemberAccountLimitReached = (0, smithy_client_1.expectBoolean)(data.memberAccountLimitReached);
2850
2167
  }
2851
- return Promise.resolve(contents);
2168
+ return contents;
2852
2169
  };
2853
2170
  exports.deserializeAws_restJson1DescribeOrganizationConfigurationCommand = deserializeAws_restJson1DescribeOrganizationConfigurationCommand;
2854
2171
  const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = async (output, context) => {
@@ -2856,7 +2173,6 @@ const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = as
2856
2173
  ...output,
2857
2174
  body: await parseBody(output.body, context),
2858
2175
  };
2859
- let response;
2860
2176
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2861
2177
  switch (errorCode) {
2862
2178
  case "BadRequestException":
@@ -2867,45 +2183,38 @@ const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = as
2867
2183
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2868
2184
  default:
2869
2185
  const parsedBody = parsedOutput.body;
2870
- const $metadata = deserializeMetadata(output);
2871
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2872
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2873
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2874
- $fault: "client",
2875
- $metadata,
2186
+ (0, smithy_client_1.throwDefaultError)({
2187
+ output,
2188
+ parsedBody,
2189
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2190
+ errorCode,
2876
2191
  });
2877
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2878
2192
  }
2879
2193
  };
2880
2194
  const deserializeAws_restJson1DescribePublishingDestinationCommand = async (output, context) => {
2881
2195
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2882
2196
  return deserializeAws_restJson1DescribePublishingDestinationCommandError(output, context);
2883
2197
  }
2884
- const contents = {
2198
+ const contents = map({
2885
2199
  $metadata: deserializeMetadata(output),
2886
- DestinationId: undefined,
2887
- DestinationProperties: undefined,
2888
- DestinationType: undefined,
2889
- PublishingFailureStartTimestamp: undefined,
2890
- Status: undefined,
2891
- };
2200
+ });
2892
2201
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2893
- if (data.destinationId !== undefined && data.destinationId !== null) {
2202
+ if (data.destinationId != null) {
2894
2203
  contents.DestinationId = (0, smithy_client_1.expectString)(data.destinationId);
2895
2204
  }
2896
- if (data.destinationProperties !== undefined && data.destinationProperties !== null) {
2205
+ if (data.destinationProperties != null) {
2897
2206
  contents.DestinationProperties = deserializeAws_restJson1DestinationProperties(data.destinationProperties, context);
2898
2207
  }
2899
- if (data.destinationType !== undefined && data.destinationType !== null) {
2208
+ if (data.destinationType != null) {
2900
2209
  contents.DestinationType = (0, smithy_client_1.expectString)(data.destinationType);
2901
2210
  }
2902
- if (data.publishingFailureStartTimestamp !== undefined && data.publishingFailureStartTimestamp !== null) {
2211
+ if (data.publishingFailureStartTimestamp != null) {
2903
2212
  contents.PublishingFailureStartTimestamp = (0, smithy_client_1.expectLong)(data.publishingFailureStartTimestamp);
2904
2213
  }
2905
- if (data.status !== undefined && data.status !== null) {
2214
+ if (data.status != null) {
2906
2215
  contents.Status = (0, smithy_client_1.expectString)(data.status);
2907
2216
  }
2908
- return Promise.resolve(contents);
2217
+ return contents;
2909
2218
  };
2910
2219
  exports.deserializeAws_restJson1DescribePublishingDestinationCommand = deserializeAws_restJson1DescribePublishingDestinationCommand;
2911
2220
  const deserializeAws_restJson1DescribePublishingDestinationCommandError = async (output, context) => {
@@ -2913,7 +2222,6 @@ const deserializeAws_restJson1DescribePublishingDestinationCommandError = async
2913
2222
  ...output,
2914
2223
  body: await parseBody(output.body, context),
2915
2224
  };
2916
- let response;
2917
2225
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2918
2226
  switch (errorCode) {
2919
2227
  case "BadRequestException":
@@ -2924,25 +2232,23 @@ const deserializeAws_restJson1DescribePublishingDestinationCommandError = async
2924
2232
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2925
2233
  default:
2926
2234
  const parsedBody = parsedOutput.body;
2927
- const $metadata = deserializeMetadata(output);
2928
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2929
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2930
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2931
- $fault: "client",
2932
- $metadata,
2235
+ (0, smithy_client_1.throwDefaultError)({
2236
+ output,
2237
+ parsedBody,
2238
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2239
+ errorCode,
2933
2240
  });
2934
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2935
2241
  }
2936
2242
  };
2937
2243
  const deserializeAws_restJson1DisableOrganizationAdminAccountCommand = async (output, context) => {
2938
2244
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2939
2245
  return deserializeAws_restJson1DisableOrganizationAdminAccountCommandError(output, context);
2940
2246
  }
2941
- const contents = {
2247
+ const contents = map({
2942
2248
  $metadata: deserializeMetadata(output),
2943
- };
2249
+ });
2944
2250
  await collectBody(output.body, context);
2945
- return Promise.resolve(contents);
2251
+ return contents;
2946
2252
  };
2947
2253
  exports.deserializeAws_restJson1DisableOrganizationAdminAccountCommand = deserializeAws_restJson1DisableOrganizationAdminAccountCommand;
2948
2254
  const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = async (output, context) => {
@@ -2950,7 +2256,6 @@ const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = asyn
2950
2256
  ...output,
2951
2257
  body: await parseBody(output.body, context),
2952
2258
  };
2953
- let response;
2954
2259
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2955
2260
  switch (errorCode) {
2956
2261
  case "BadRequestException":
@@ -2961,25 +2266,23 @@ const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = asyn
2961
2266
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2962
2267
  default:
2963
2268
  const parsedBody = parsedOutput.body;
2964
- const $metadata = deserializeMetadata(output);
2965
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2966
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
2967
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2968
- $fault: "client",
2969
- $metadata,
2269
+ (0, smithy_client_1.throwDefaultError)({
2270
+ output,
2271
+ parsedBody,
2272
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2273
+ errorCode,
2970
2274
  });
2971
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2972
2275
  }
2973
2276
  };
2974
2277
  const deserializeAws_restJson1DisassociateFromAdministratorAccountCommand = async (output, context) => {
2975
2278
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2976
2279
  return deserializeAws_restJson1DisassociateFromAdministratorAccountCommandError(output, context);
2977
2280
  }
2978
- const contents = {
2281
+ const contents = map({
2979
2282
  $metadata: deserializeMetadata(output),
2980
- };
2283
+ });
2981
2284
  await collectBody(output.body, context);
2982
- return Promise.resolve(contents);
2285
+ return contents;
2983
2286
  };
2984
2287
  exports.deserializeAws_restJson1DisassociateFromAdministratorAccountCommand = deserializeAws_restJson1DisassociateFromAdministratorAccountCommand;
2985
2288
  const deserializeAws_restJson1DisassociateFromAdministratorAccountCommandError = async (output, context) => {
@@ -2987,7 +2290,6 @@ const deserializeAws_restJson1DisassociateFromAdministratorAccountCommandError =
2987
2290
  ...output,
2988
2291
  body: await parseBody(output.body, context),
2989
2292
  };
2990
- let response;
2991
2293
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2992
2294
  switch (errorCode) {
2993
2295
  case "BadRequestException":
@@ -2998,25 +2300,23 @@ const deserializeAws_restJson1DisassociateFromAdministratorAccountCommandError =
2998
2300
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
2999
2301
  default:
3000
2302
  const parsedBody = parsedOutput.body;
3001
- const $metadata = deserializeMetadata(output);
3002
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3003
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3004
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3005
- $fault: "client",
3006
- $metadata,
2303
+ (0, smithy_client_1.throwDefaultError)({
2304
+ output,
2305
+ parsedBody,
2306
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2307
+ errorCode,
3007
2308
  });
3008
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3009
2309
  }
3010
2310
  };
3011
2311
  const deserializeAws_restJson1DisassociateFromMasterAccountCommand = async (output, context) => {
3012
2312
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3013
2313
  return deserializeAws_restJson1DisassociateFromMasterAccountCommandError(output, context);
3014
2314
  }
3015
- const contents = {
2315
+ const contents = map({
3016
2316
  $metadata: deserializeMetadata(output),
3017
- };
2317
+ });
3018
2318
  await collectBody(output.body, context);
3019
- return Promise.resolve(contents);
2319
+ return contents;
3020
2320
  };
3021
2321
  exports.deserializeAws_restJson1DisassociateFromMasterAccountCommand = deserializeAws_restJson1DisassociateFromMasterAccountCommand;
3022
2322
  const deserializeAws_restJson1DisassociateFromMasterAccountCommandError = async (output, context) => {
@@ -3024,7 +2324,6 @@ const deserializeAws_restJson1DisassociateFromMasterAccountCommandError = async
3024
2324
  ...output,
3025
2325
  body: await parseBody(output.body, context),
3026
2326
  };
3027
- let response;
3028
2327
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3029
2328
  switch (errorCode) {
3030
2329
  case "BadRequestException":
@@ -3035,29 +2334,26 @@ const deserializeAws_restJson1DisassociateFromMasterAccountCommandError = async
3035
2334
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3036
2335
  default:
3037
2336
  const parsedBody = parsedOutput.body;
3038
- const $metadata = deserializeMetadata(output);
3039
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3040
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3041
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3042
- $fault: "client",
3043
- $metadata,
2337
+ (0, smithy_client_1.throwDefaultError)({
2338
+ output,
2339
+ parsedBody,
2340
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2341
+ errorCode,
3044
2342
  });
3045
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3046
2343
  }
3047
2344
  };
3048
2345
  const deserializeAws_restJson1DisassociateMembersCommand = async (output, context) => {
3049
2346
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3050
2347
  return deserializeAws_restJson1DisassociateMembersCommandError(output, context);
3051
2348
  }
3052
- const contents = {
2349
+ const contents = map({
3053
2350
  $metadata: deserializeMetadata(output),
3054
- UnprocessedAccounts: undefined,
3055
- };
2351
+ });
3056
2352
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3057
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
2353
+ if (data.unprocessedAccounts != null) {
3058
2354
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
3059
2355
  }
3060
- return Promise.resolve(contents);
2356
+ return contents;
3061
2357
  };
3062
2358
  exports.deserializeAws_restJson1DisassociateMembersCommand = deserializeAws_restJson1DisassociateMembersCommand;
3063
2359
  const deserializeAws_restJson1DisassociateMembersCommandError = async (output, context) => {
@@ -3065,7 +2361,6 @@ const deserializeAws_restJson1DisassociateMembersCommandError = async (output, c
3065
2361
  ...output,
3066
2362
  body: await parseBody(output.body, context),
3067
2363
  };
3068
- let response;
3069
2364
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3070
2365
  switch (errorCode) {
3071
2366
  case "BadRequestException":
@@ -3076,25 +2371,23 @@ const deserializeAws_restJson1DisassociateMembersCommandError = async (output, c
3076
2371
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3077
2372
  default:
3078
2373
  const parsedBody = parsedOutput.body;
3079
- const $metadata = deserializeMetadata(output);
3080
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3081
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3082
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3083
- $fault: "client",
3084
- $metadata,
2374
+ (0, smithy_client_1.throwDefaultError)({
2375
+ output,
2376
+ parsedBody,
2377
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2378
+ errorCode,
3085
2379
  });
3086
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3087
2380
  }
3088
2381
  };
3089
2382
  const deserializeAws_restJson1EnableOrganizationAdminAccountCommand = async (output, context) => {
3090
2383
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3091
2384
  return deserializeAws_restJson1EnableOrganizationAdminAccountCommandError(output, context);
3092
2385
  }
3093
- const contents = {
2386
+ const contents = map({
3094
2387
  $metadata: deserializeMetadata(output),
3095
- };
2388
+ });
3096
2389
  await collectBody(output.body, context);
3097
- return Promise.resolve(contents);
2390
+ return contents;
3098
2391
  };
3099
2392
  exports.deserializeAws_restJson1EnableOrganizationAdminAccountCommand = deserializeAws_restJson1EnableOrganizationAdminAccountCommand;
3100
2393
  const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async (output, context) => {
@@ -3102,7 +2395,6 @@ const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async
3102
2395
  ...output,
3103
2396
  body: await parseBody(output.body, context),
3104
2397
  };
3105
- let response;
3106
2398
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3107
2399
  switch (errorCode) {
3108
2400
  case "BadRequestException":
@@ -3113,29 +2405,26 @@ const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async
3113
2405
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3114
2406
  default:
3115
2407
  const parsedBody = parsedOutput.body;
3116
- const $metadata = deserializeMetadata(output);
3117
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3118
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3119
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3120
- $fault: "client",
3121
- $metadata,
2408
+ (0, smithy_client_1.throwDefaultError)({
2409
+ output,
2410
+ parsedBody,
2411
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2412
+ errorCode,
3122
2413
  });
3123
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3124
2414
  }
3125
2415
  };
3126
2416
  const deserializeAws_restJson1GetAdministratorAccountCommand = async (output, context) => {
3127
2417
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3128
2418
  return deserializeAws_restJson1GetAdministratorAccountCommandError(output, context);
3129
2419
  }
3130
- const contents = {
2420
+ const contents = map({
3131
2421
  $metadata: deserializeMetadata(output),
3132
- Administrator: undefined,
3133
- };
2422
+ });
3134
2423
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3135
- if (data.administrator !== undefined && data.administrator !== null) {
2424
+ if (data.administrator != null) {
3136
2425
  contents.Administrator = deserializeAws_restJson1Administrator(data.administrator, context);
3137
2426
  }
3138
- return Promise.resolve(contents);
2427
+ return contents;
3139
2428
  };
3140
2429
  exports.deserializeAws_restJson1GetAdministratorAccountCommand = deserializeAws_restJson1GetAdministratorAccountCommand;
3141
2430
  const deserializeAws_restJson1GetAdministratorAccountCommandError = async (output, context) => {
@@ -3143,7 +2432,6 @@ const deserializeAws_restJson1GetAdministratorAccountCommandError = async (outpu
3143
2432
  ...output,
3144
2433
  body: await parseBody(output.body, context),
3145
2434
  };
3146
- let response;
3147
2435
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3148
2436
  switch (errorCode) {
3149
2437
  case "BadRequestException":
@@ -3154,53 +2442,44 @@ const deserializeAws_restJson1GetAdministratorAccountCommandError = async (outpu
3154
2442
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3155
2443
  default:
3156
2444
  const parsedBody = parsedOutput.body;
3157
- const $metadata = deserializeMetadata(output);
3158
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3159
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3160
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3161
- $fault: "client",
3162
- $metadata,
2445
+ (0, smithy_client_1.throwDefaultError)({
2446
+ output,
2447
+ parsedBody,
2448
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2449
+ errorCode,
3163
2450
  });
3164
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3165
2451
  }
3166
2452
  };
3167
2453
  const deserializeAws_restJson1GetDetectorCommand = async (output, context) => {
3168
2454
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3169
2455
  return deserializeAws_restJson1GetDetectorCommandError(output, context);
3170
2456
  }
3171
- const contents = {
2457
+ const contents = map({
3172
2458
  $metadata: deserializeMetadata(output),
3173
- CreatedAt: undefined,
3174
- DataSources: undefined,
3175
- FindingPublishingFrequency: undefined,
3176
- ServiceRole: undefined,
3177
- Status: undefined,
3178
- Tags: undefined,
3179
- UpdatedAt: undefined,
3180
- };
2459
+ });
3181
2460
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3182
- if (data.createdAt !== undefined && data.createdAt !== null) {
2461
+ if (data.createdAt != null) {
3183
2462
  contents.CreatedAt = (0, smithy_client_1.expectString)(data.createdAt);
3184
2463
  }
3185
- if (data.dataSources !== undefined && data.dataSources !== null) {
2464
+ if (data.dataSources != null) {
3186
2465
  contents.DataSources = deserializeAws_restJson1DataSourceConfigurationsResult(data.dataSources, context);
3187
2466
  }
3188
- if (data.findingPublishingFrequency !== undefined && data.findingPublishingFrequency !== null) {
2467
+ if (data.findingPublishingFrequency != null) {
3189
2468
  contents.FindingPublishingFrequency = (0, smithy_client_1.expectString)(data.findingPublishingFrequency);
3190
2469
  }
3191
- if (data.serviceRole !== undefined && data.serviceRole !== null) {
2470
+ if (data.serviceRole != null) {
3192
2471
  contents.ServiceRole = (0, smithy_client_1.expectString)(data.serviceRole);
3193
2472
  }
3194
- if (data.status !== undefined && data.status !== null) {
2473
+ if (data.status != null) {
3195
2474
  contents.Status = (0, smithy_client_1.expectString)(data.status);
3196
2475
  }
3197
- if (data.tags !== undefined && data.tags !== null) {
2476
+ if (data.tags != null) {
3198
2477
  contents.Tags = deserializeAws_restJson1TagMap(data.tags, context);
3199
2478
  }
3200
- if (data.updatedAt !== undefined && data.updatedAt !== null) {
2479
+ if (data.updatedAt != null) {
3201
2480
  contents.UpdatedAt = (0, smithy_client_1.expectString)(data.updatedAt);
3202
2481
  }
3203
- return Promise.resolve(contents);
2482
+ return contents;
3204
2483
  };
3205
2484
  exports.deserializeAws_restJson1GetDetectorCommand = deserializeAws_restJson1GetDetectorCommand;
3206
2485
  const deserializeAws_restJson1GetDetectorCommandError = async (output, context) => {
@@ -3208,7 +2487,6 @@ const deserializeAws_restJson1GetDetectorCommandError = async (output, context)
3208
2487
  ...output,
3209
2488
  body: await parseBody(output.body, context),
3210
2489
  };
3211
- let response;
3212
2490
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3213
2491
  switch (errorCode) {
3214
2492
  case "BadRequestException":
@@ -3219,49 +2497,41 @@ const deserializeAws_restJson1GetDetectorCommandError = async (output, context)
3219
2497
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3220
2498
  default:
3221
2499
  const parsedBody = parsedOutput.body;
3222
- const $metadata = deserializeMetadata(output);
3223
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3224
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3225
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3226
- $fault: "client",
3227
- $metadata,
2500
+ (0, smithy_client_1.throwDefaultError)({
2501
+ output,
2502
+ parsedBody,
2503
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2504
+ errorCode,
3228
2505
  });
3229
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3230
2506
  }
3231
2507
  };
3232
2508
  const deserializeAws_restJson1GetFilterCommand = async (output, context) => {
3233
2509
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3234
2510
  return deserializeAws_restJson1GetFilterCommandError(output, context);
3235
2511
  }
3236
- const contents = {
2512
+ const contents = map({
3237
2513
  $metadata: deserializeMetadata(output),
3238
- Action: undefined,
3239
- Description: undefined,
3240
- FindingCriteria: undefined,
3241
- Name: undefined,
3242
- Rank: undefined,
3243
- Tags: undefined,
3244
- };
2514
+ });
3245
2515
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3246
- if (data.action !== undefined && data.action !== null) {
2516
+ if (data.action != null) {
3247
2517
  contents.Action = (0, smithy_client_1.expectString)(data.action);
3248
2518
  }
3249
- if (data.description !== undefined && data.description !== null) {
2519
+ if (data.description != null) {
3250
2520
  contents.Description = (0, smithy_client_1.expectString)(data.description);
3251
2521
  }
3252
- if (data.findingCriteria !== undefined && data.findingCriteria !== null) {
2522
+ if (data.findingCriteria != null) {
3253
2523
  contents.FindingCriteria = deserializeAws_restJson1FindingCriteria(data.findingCriteria, context);
3254
2524
  }
3255
- if (data.name !== undefined && data.name !== null) {
2525
+ if (data.name != null) {
3256
2526
  contents.Name = (0, smithy_client_1.expectString)(data.name);
3257
2527
  }
3258
- if (data.rank !== undefined && data.rank !== null) {
2528
+ if (data.rank != null) {
3259
2529
  contents.Rank = (0, smithy_client_1.expectInt32)(data.rank);
3260
2530
  }
3261
- if (data.tags !== undefined && data.tags !== null) {
2531
+ if (data.tags != null) {
3262
2532
  contents.Tags = deserializeAws_restJson1TagMap(data.tags, context);
3263
2533
  }
3264
- return Promise.resolve(contents);
2534
+ return contents;
3265
2535
  };
3266
2536
  exports.deserializeAws_restJson1GetFilterCommand = deserializeAws_restJson1GetFilterCommand;
3267
2537
  const deserializeAws_restJson1GetFilterCommandError = async (output, context) => {
@@ -3269,7 +2539,6 @@ const deserializeAws_restJson1GetFilterCommandError = async (output, context) =>
3269
2539
  ...output,
3270
2540
  body: await parseBody(output.body, context),
3271
2541
  };
3272
- let response;
3273
2542
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3274
2543
  switch (errorCode) {
3275
2544
  case "BadRequestException":
@@ -3280,29 +2549,26 @@ const deserializeAws_restJson1GetFilterCommandError = async (output, context) =>
3280
2549
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3281
2550
  default:
3282
2551
  const parsedBody = parsedOutput.body;
3283
- const $metadata = deserializeMetadata(output);
3284
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3285
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3286
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3287
- $fault: "client",
3288
- $metadata,
2552
+ (0, smithy_client_1.throwDefaultError)({
2553
+ output,
2554
+ parsedBody,
2555
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2556
+ errorCode,
3289
2557
  });
3290
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3291
2558
  }
3292
2559
  };
3293
2560
  const deserializeAws_restJson1GetFindingsCommand = async (output, context) => {
3294
2561
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3295
2562
  return deserializeAws_restJson1GetFindingsCommandError(output, context);
3296
2563
  }
3297
- const contents = {
2564
+ const contents = map({
3298
2565
  $metadata: deserializeMetadata(output),
3299
- Findings: undefined,
3300
- };
2566
+ });
3301
2567
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3302
- if (data.findings !== undefined && data.findings !== null) {
2568
+ if (data.findings != null) {
3303
2569
  contents.Findings = deserializeAws_restJson1Findings(data.findings, context);
3304
2570
  }
3305
- return Promise.resolve(contents);
2571
+ return contents;
3306
2572
  };
3307
2573
  exports.deserializeAws_restJson1GetFindingsCommand = deserializeAws_restJson1GetFindingsCommand;
3308
2574
  const deserializeAws_restJson1GetFindingsCommandError = async (output, context) => {
@@ -3310,7 +2576,6 @@ const deserializeAws_restJson1GetFindingsCommandError = async (output, context)
3310
2576
  ...output,
3311
2577
  body: await parseBody(output.body, context),
3312
2578
  };
3313
- let response;
3314
2579
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3315
2580
  switch (errorCode) {
3316
2581
  case "BadRequestException":
@@ -3321,29 +2586,26 @@ const deserializeAws_restJson1GetFindingsCommandError = async (output, context)
3321
2586
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3322
2587
  default:
3323
2588
  const parsedBody = parsedOutput.body;
3324
- const $metadata = deserializeMetadata(output);
3325
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3326
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3327
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3328
- $fault: "client",
3329
- $metadata,
2589
+ (0, smithy_client_1.throwDefaultError)({
2590
+ output,
2591
+ parsedBody,
2592
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2593
+ errorCode,
3330
2594
  });
3331
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3332
2595
  }
3333
2596
  };
3334
2597
  const deserializeAws_restJson1GetFindingsStatisticsCommand = async (output, context) => {
3335
2598
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3336
2599
  return deserializeAws_restJson1GetFindingsStatisticsCommandError(output, context);
3337
2600
  }
3338
- const contents = {
2601
+ const contents = map({
3339
2602
  $metadata: deserializeMetadata(output),
3340
- FindingStatistics: undefined,
3341
- };
2603
+ });
3342
2604
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3343
- if (data.findingStatistics !== undefined && data.findingStatistics !== null) {
2605
+ if (data.findingStatistics != null) {
3344
2606
  contents.FindingStatistics = deserializeAws_restJson1FindingStatistics(data.findingStatistics, context);
3345
2607
  }
3346
- return Promise.resolve(contents);
2608
+ return contents;
3347
2609
  };
3348
2610
  exports.deserializeAws_restJson1GetFindingsStatisticsCommand = deserializeAws_restJson1GetFindingsStatisticsCommand;
3349
2611
  const deserializeAws_restJson1GetFindingsStatisticsCommandError = async (output, context) => {
@@ -3351,7 +2613,6 @@ const deserializeAws_restJson1GetFindingsStatisticsCommandError = async (output,
3351
2613
  ...output,
3352
2614
  body: await parseBody(output.body, context),
3353
2615
  };
3354
- let response;
3355
2616
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3356
2617
  switch (errorCode) {
3357
2618
  case "BadRequestException":
@@ -3362,29 +2623,26 @@ const deserializeAws_restJson1GetFindingsStatisticsCommandError = async (output,
3362
2623
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3363
2624
  default:
3364
2625
  const parsedBody = parsedOutput.body;
3365
- const $metadata = deserializeMetadata(output);
3366
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3367
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3368
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3369
- $fault: "client",
3370
- $metadata,
2626
+ (0, smithy_client_1.throwDefaultError)({
2627
+ output,
2628
+ parsedBody,
2629
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2630
+ errorCode,
3371
2631
  });
3372
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3373
2632
  }
3374
2633
  };
3375
2634
  const deserializeAws_restJson1GetInvitationsCountCommand = async (output, context) => {
3376
2635
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3377
2636
  return deserializeAws_restJson1GetInvitationsCountCommandError(output, context);
3378
2637
  }
3379
- const contents = {
2638
+ const contents = map({
3380
2639
  $metadata: deserializeMetadata(output),
3381
- InvitationsCount: undefined,
3382
- };
2640
+ });
3383
2641
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3384
- if (data.invitationsCount !== undefined && data.invitationsCount !== null) {
2642
+ if (data.invitationsCount != null) {
3385
2643
  contents.InvitationsCount = (0, smithy_client_1.expectInt32)(data.invitationsCount);
3386
2644
  }
3387
- return Promise.resolve(contents);
2645
+ return contents;
3388
2646
  };
3389
2647
  exports.deserializeAws_restJson1GetInvitationsCountCommand = deserializeAws_restJson1GetInvitationsCountCommand;
3390
2648
  const deserializeAws_restJson1GetInvitationsCountCommandError = async (output, context) => {
@@ -3392,7 +2650,6 @@ const deserializeAws_restJson1GetInvitationsCountCommandError = async (output, c
3392
2650
  ...output,
3393
2651
  body: await parseBody(output.body, context),
3394
2652
  };
3395
- let response;
3396
2653
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3397
2654
  switch (errorCode) {
3398
2655
  case "BadRequestException":
@@ -3403,45 +2660,38 @@ const deserializeAws_restJson1GetInvitationsCountCommandError = async (output, c
3403
2660
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3404
2661
  default:
3405
2662
  const parsedBody = parsedOutput.body;
3406
- const $metadata = deserializeMetadata(output);
3407
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3408
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3409
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3410
- $fault: "client",
3411
- $metadata,
2663
+ (0, smithy_client_1.throwDefaultError)({
2664
+ output,
2665
+ parsedBody,
2666
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2667
+ errorCode,
3412
2668
  });
3413
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3414
2669
  }
3415
2670
  };
3416
2671
  const deserializeAws_restJson1GetIPSetCommand = async (output, context) => {
3417
2672
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3418
2673
  return deserializeAws_restJson1GetIPSetCommandError(output, context);
3419
2674
  }
3420
- const contents = {
2675
+ const contents = map({
3421
2676
  $metadata: deserializeMetadata(output),
3422
- Format: undefined,
3423
- Location: undefined,
3424
- Name: undefined,
3425
- Status: undefined,
3426
- Tags: undefined,
3427
- };
2677
+ });
3428
2678
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3429
- if (data.format !== undefined && data.format !== null) {
2679
+ if (data.format != null) {
3430
2680
  contents.Format = (0, smithy_client_1.expectString)(data.format);
3431
2681
  }
3432
- if (data.location !== undefined && data.location !== null) {
2682
+ if (data.location != null) {
3433
2683
  contents.Location = (0, smithy_client_1.expectString)(data.location);
3434
2684
  }
3435
- if (data.name !== undefined && data.name !== null) {
2685
+ if (data.name != null) {
3436
2686
  contents.Name = (0, smithy_client_1.expectString)(data.name);
3437
2687
  }
3438
- if (data.status !== undefined && data.status !== null) {
2688
+ if (data.status != null) {
3439
2689
  contents.Status = (0, smithy_client_1.expectString)(data.status);
3440
2690
  }
3441
- if (data.tags !== undefined && data.tags !== null) {
2691
+ if (data.tags != null) {
3442
2692
  contents.Tags = deserializeAws_restJson1TagMap(data.tags, context);
3443
2693
  }
3444
- return Promise.resolve(contents);
2694
+ return contents;
3445
2695
  };
3446
2696
  exports.deserializeAws_restJson1GetIPSetCommand = deserializeAws_restJson1GetIPSetCommand;
3447
2697
  const deserializeAws_restJson1GetIPSetCommandError = async (output, context) => {
@@ -3449,7 +2699,6 @@ const deserializeAws_restJson1GetIPSetCommandError = async (output, context) =>
3449
2699
  ...output,
3450
2700
  body: await parseBody(output.body, context),
3451
2701
  };
3452
- let response;
3453
2702
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3454
2703
  switch (errorCode) {
3455
2704
  case "BadRequestException":
@@ -3460,33 +2709,29 @@ const deserializeAws_restJson1GetIPSetCommandError = async (output, context) =>
3460
2709
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3461
2710
  default:
3462
2711
  const parsedBody = parsedOutput.body;
3463
- const $metadata = deserializeMetadata(output);
3464
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3465
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3466
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3467
- $fault: "client",
3468
- $metadata,
2712
+ (0, smithy_client_1.throwDefaultError)({
2713
+ output,
2714
+ parsedBody,
2715
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2716
+ errorCode,
3469
2717
  });
3470
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3471
2718
  }
3472
2719
  };
3473
2720
  const deserializeAws_restJson1GetMalwareScanSettingsCommand = async (output, context) => {
3474
2721
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3475
2722
  return deserializeAws_restJson1GetMalwareScanSettingsCommandError(output, context);
3476
2723
  }
3477
- const contents = {
2724
+ const contents = map({
3478
2725
  $metadata: deserializeMetadata(output),
3479
- EbsSnapshotPreservation: undefined,
3480
- ScanResourceCriteria: undefined,
3481
- };
2726
+ });
3482
2727
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3483
- if (data.ebsSnapshotPreservation !== undefined && data.ebsSnapshotPreservation !== null) {
2728
+ if (data.ebsSnapshotPreservation != null) {
3484
2729
  contents.EbsSnapshotPreservation = (0, smithy_client_1.expectString)(data.ebsSnapshotPreservation);
3485
2730
  }
3486
- if (data.scanResourceCriteria !== undefined && data.scanResourceCriteria !== null) {
2731
+ if (data.scanResourceCriteria != null) {
3487
2732
  contents.ScanResourceCriteria = deserializeAws_restJson1ScanResourceCriteria(data.scanResourceCriteria, context);
3488
2733
  }
3489
- return Promise.resolve(contents);
2734
+ return contents;
3490
2735
  };
3491
2736
  exports.deserializeAws_restJson1GetMalwareScanSettingsCommand = deserializeAws_restJson1GetMalwareScanSettingsCommand;
3492
2737
  const deserializeAws_restJson1GetMalwareScanSettingsCommandError = async (output, context) => {
@@ -3494,7 +2739,6 @@ const deserializeAws_restJson1GetMalwareScanSettingsCommandError = async (output
3494
2739
  ...output,
3495
2740
  body: await parseBody(output.body, context),
3496
2741
  };
3497
- let response;
3498
2742
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3499
2743
  switch (errorCode) {
3500
2744
  case "BadRequestException":
@@ -3505,29 +2749,26 @@ const deserializeAws_restJson1GetMalwareScanSettingsCommandError = async (output
3505
2749
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3506
2750
  default:
3507
2751
  const parsedBody = parsedOutput.body;
3508
- const $metadata = deserializeMetadata(output);
3509
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3510
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3511
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3512
- $fault: "client",
3513
- $metadata,
2752
+ (0, smithy_client_1.throwDefaultError)({
2753
+ output,
2754
+ parsedBody,
2755
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2756
+ errorCode,
3514
2757
  });
3515
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3516
2758
  }
3517
2759
  };
3518
2760
  const deserializeAws_restJson1GetMasterAccountCommand = async (output, context) => {
3519
2761
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3520
2762
  return deserializeAws_restJson1GetMasterAccountCommandError(output, context);
3521
2763
  }
3522
- const contents = {
2764
+ const contents = map({
3523
2765
  $metadata: deserializeMetadata(output),
3524
- Master: undefined,
3525
- };
2766
+ });
3526
2767
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3527
- if (data.master !== undefined && data.master !== null) {
2768
+ if (data.master != null) {
3528
2769
  contents.Master = deserializeAws_restJson1Master(data.master, context);
3529
2770
  }
3530
- return Promise.resolve(contents);
2771
+ return contents;
3531
2772
  };
3532
2773
  exports.deserializeAws_restJson1GetMasterAccountCommand = deserializeAws_restJson1GetMasterAccountCommand;
3533
2774
  const deserializeAws_restJson1GetMasterAccountCommandError = async (output, context) => {
@@ -3535,7 +2776,6 @@ const deserializeAws_restJson1GetMasterAccountCommandError = async (output, cont
3535
2776
  ...output,
3536
2777
  body: await parseBody(output.body, context),
3537
2778
  };
3538
- let response;
3539
2779
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3540
2780
  switch (errorCode) {
3541
2781
  case "BadRequestException":
@@ -3546,33 +2786,29 @@ const deserializeAws_restJson1GetMasterAccountCommandError = async (output, cont
3546
2786
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3547
2787
  default:
3548
2788
  const parsedBody = parsedOutput.body;
3549
- const $metadata = deserializeMetadata(output);
3550
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3551
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3552
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3553
- $fault: "client",
3554
- $metadata,
2789
+ (0, smithy_client_1.throwDefaultError)({
2790
+ output,
2791
+ parsedBody,
2792
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2793
+ errorCode,
3555
2794
  });
3556
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3557
2795
  }
3558
2796
  };
3559
2797
  const deserializeAws_restJson1GetMemberDetectorsCommand = async (output, context) => {
3560
2798
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3561
2799
  return deserializeAws_restJson1GetMemberDetectorsCommandError(output, context);
3562
2800
  }
3563
- const contents = {
2801
+ const contents = map({
3564
2802
  $metadata: deserializeMetadata(output),
3565
- MemberDataSourceConfigurations: undefined,
3566
- UnprocessedAccounts: undefined,
3567
- };
2803
+ });
3568
2804
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3569
- if (data.members !== undefined && data.members !== null) {
2805
+ if (data.members != null) {
3570
2806
  contents.MemberDataSourceConfigurations = deserializeAws_restJson1MemberDataSourceConfigurations(data.members, context);
3571
2807
  }
3572
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
2808
+ if (data.unprocessedAccounts != null) {
3573
2809
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
3574
2810
  }
3575
- return Promise.resolve(contents);
2811
+ return contents;
3576
2812
  };
3577
2813
  exports.deserializeAws_restJson1GetMemberDetectorsCommand = deserializeAws_restJson1GetMemberDetectorsCommand;
3578
2814
  const deserializeAws_restJson1GetMemberDetectorsCommandError = async (output, context) => {
@@ -3580,7 +2816,6 @@ const deserializeAws_restJson1GetMemberDetectorsCommandError = async (output, co
3580
2816
  ...output,
3581
2817
  body: await parseBody(output.body, context),
3582
2818
  };
3583
- let response;
3584
2819
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3585
2820
  switch (errorCode) {
3586
2821
  case "BadRequestException":
@@ -3591,33 +2826,29 @@ const deserializeAws_restJson1GetMemberDetectorsCommandError = async (output, co
3591
2826
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3592
2827
  default:
3593
2828
  const parsedBody = parsedOutput.body;
3594
- const $metadata = deserializeMetadata(output);
3595
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3596
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3597
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3598
- $fault: "client",
3599
- $metadata,
2829
+ (0, smithy_client_1.throwDefaultError)({
2830
+ output,
2831
+ parsedBody,
2832
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2833
+ errorCode,
3600
2834
  });
3601
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3602
2835
  }
3603
2836
  };
3604
2837
  const deserializeAws_restJson1GetMembersCommand = async (output, context) => {
3605
2838
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3606
2839
  return deserializeAws_restJson1GetMembersCommandError(output, context);
3607
2840
  }
3608
- const contents = {
2841
+ const contents = map({
3609
2842
  $metadata: deserializeMetadata(output),
3610
- Members: undefined,
3611
- UnprocessedAccounts: undefined,
3612
- };
2843
+ });
3613
2844
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3614
- if (data.members !== undefined && data.members !== null) {
2845
+ if (data.members != null) {
3615
2846
  contents.Members = deserializeAws_restJson1Members(data.members, context);
3616
2847
  }
3617
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
2848
+ if (data.unprocessedAccounts != null) {
3618
2849
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
3619
2850
  }
3620
- return Promise.resolve(contents);
2851
+ return contents;
3621
2852
  };
3622
2853
  exports.deserializeAws_restJson1GetMembersCommand = deserializeAws_restJson1GetMembersCommand;
3623
2854
  const deserializeAws_restJson1GetMembersCommandError = async (output, context) => {
@@ -3625,7 +2856,6 @@ const deserializeAws_restJson1GetMembersCommandError = async (output, context) =
3625
2856
  ...output,
3626
2857
  body: await parseBody(output.body, context),
3627
2858
  };
3628
- let response;
3629
2859
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3630
2860
  switch (errorCode) {
3631
2861
  case "BadRequestException":
@@ -3636,33 +2866,29 @@ const deserializeAws_restJson1GetMembersCommandError = async (output, context) =
3636
2866
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3637
2867
  default:
3638
2868
  const parsedBody = parsedOutput.body;
3639
- const $metadata = deserializeMetadata(output);
3640
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3641
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3642
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3643
- $fault: "client",
3644
- $metadata,
2869
+ (0, smithy_client_1.throwDefaultError)({
2870
+ output,
2871
+ parsedBody,
2872
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2873
+ errorCode,
3645
2874
  });
3646
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3647
2875
  }
3648
2876
  };
3649
2877
  const deserializeAws_restJson1GetRemainingFreeTrialDaysCommand = async (output, context) => {
3650
2878
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3651
2879
  return deserializeAws_restJson1GetRemainingFreeTrialDaysCommandError(output, context);
3652
2880
  }
3653
- const contents = {
2881
+ const contents = map({
3654
2882
  $metadata: deserializeMetadata(output),
3655
- Accounts: undefined,
3656
- UnprocessedAccounts: undefined,
3657
- };
2883
+ });
3658
2884
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3659
- if (data.accounts !== undefined && data.accounts !== null) {
2885
+ if (data.accounts != null) {
3660
2886
  contents.Accounts = deserializeAws_restJson1AccountFreeTrialInfos(data.accounts, context);
3661
2887
  }
3662
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
2888
+ if (data.unprocessedAccounts != null) {
3663
2889
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
3664
2890
  }
3665
- return Promise.resolve(contents);
2891
+ return contents;
3666
2892
  };
3667
2893
  exports.deserializeAws_restJson1GetRemainingFreeTrialDaysCommand = deserializeAws_restJson1GetRemainingFreeTrialDaysCommand;
3668
2894
  const deserializeAws_restJson1GetRemainingFreeTrialDaysCommandError = async (output, context) => {
@@ -3670,7 +2896,6 @@ const deserializeAws_restJson1GetRemainingFreeTrialDaysCommandError = async (out
3670
2896
  ...output,
3671
2897
  body: await parseBody(output.body, context),
3672
2898
  };
3673
- let response;
3674
2899
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3675
2900
  switch (errorCode) {
3676
2901
  case "BadRequestException":
@@ -3681,45 +2906,38 @@ const deserializeAws_restJson1GetRemainingFreeTrialDaysCommandError = async (out
3681
2906
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3682
2907
  default:
3683
2908
  const parsedBody = parsedOutput.body;
3684
- const $metadata = deserializeMetadata(output);
3685
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3686
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3687
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3688
- $fault: "client",
3689
- $metadata,
2909
+ (0, smithy_client_1.throwDefaultError)({
2910
+ output,
2911
+ parsedBody,
2912
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2913
+ errorCode,
3690
2914
  });
3691
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3692
2915
  }
3693
2916
  };
3694
2917
  const deserializeAws_restJson1GetThreatIntelSetCommand = async (output, context) => {
3695
2918
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3696
2919
  return deserializeAws_restJson1GetThreatIntelSetCommandError(output, context);
3697
2920
  }
3698
- const contents = {
2921
+ const contents = map({
3699
2922
  $metadata: deserializeMetadata(output),
3700
- Format: undefined,
3701
- Location: undefined,
3702
- Name: undefined,
3703
- Status: undefined,
3704
- Tags: undefined,
3705
- };
2923
+ });
3706
2924
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3707
- if (data.format !== undefined && data.format !== null) {
2925
+ if (data.format != null) {
3708
2926
  contents.Format = (0, smithy_client_1.expectString)(data.format);
3709
2927
  }
3710
- if (data.location !== undefined && data.location !== null) {
2928
+ if (data.location != null) {
3711
2929
  contents.Location = (0, smithy_client_1.expectString)(data.location);
3712
2930
  }
3713
- if (data.name !== undefined && data.name !== null) {
2931
+ if (data.name != null) {
3714
2932
  contents.Name = (0, smithy_client_1.expectString)(data.name);
3715
2933
  }
3716
- if (data.status !== undefined && data.status !== null) {
2934
+ if (data.status != null) {
3717
2935
  contents.Status = (0, smithy_client_1.expectString)(data.status);
3718
2936
  }
3719
- if (data.tags !== undefined && data.tags !== null) {
2937
+ if (data.tags != null) {
3720
2938
  contents.Tags = deserializeAws_restJson1TagMap(data.tags, context);
3721
2939
  }
3722
- return Promise.resolve(contents);
2940
+ return contents;
3723
2941
  };
3724
2942
  exports.deserializeAws_restJson1GetThreatIntelSetCommand = deserializeAws_restJson1GetThreatIntelSetCommand;
3725
2943
  const deserializeAws_restJson1GetThreatIntelSetCommandError = async (output, context) => {
@@ -3727,7 +2945,6 @@ const deserializeAws_restJson1GetThreatIntelSetCommandError = async (output, con
3727
2945
  ...output,
3728
2946
  body: await parseBody(output.body, context),
3729
2947
  };
3730
- let response;
3731
2948
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3732
2949
  switch (errorCode) {
3733
2950
  case "BadRequestException":
@@ -3738,33 +2955,29 @@ const deserializeAws_restJson1GetThreatIntelSetCommandError = async (output, con
3738
2955
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3739
2956
  default:
3740
2957
  const parsedBody = parsedOutput.body;
3741
- const $metadata = deserializeMetadata(output);
3742
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3743
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3744
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3745
- $fault: "client",
3746
- $metadata,
2958
+ (0, smithy_client_1.throwDefaultError)({
2959
+ output,
2960
+ parsedBody,
2961
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
2962
+ errorCode,
3747
2963
  });
3748
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3749
2964
  }
3750
2965
  };
3751
2966
  const deserializeAws_restJson1GetUsageStatisticsCommand = async (output, context) => {
3752
2967
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3753
2968
  return deserializeAws_restJson1GetUsageStatisticsCommandError(output, context);
3754
2969
  }
3755
- const contents = {
2970
+ const contents = map({
3756
2971
  $metadata: deserializeMetadata(output),
3757
- NextToken: undefined,
3758
- UsageStatistics: undefined,
3759
- };
2972
+ });
3760
2973
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3761
- if (data.nextToken !== undefined && data.nextToken !== null) {
2974
+ if (data.nextToken != null) {
3762
2975
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
3763
2976
  }
3764
- if (data.usageStatistics !== undefined && data.usageStatistics !== null) {
2977
+ if (data.usageStatistics != null) {
3765
2978
  contents.UsageStatistics = deserializeAws_restJson1UsageStatistics(data.usageStatistics, context);
3766
2979
  }
3767
- return Promise.resolve(contents);
2980
+ return contents;
3768
2981
  };
3769
2982
  exports.deserializeAws_restJson1GetUsageStatisticsCommand = deserializeAws_restJson1GetUsageStatisticsCommand;
3770
2983
  const deserializeAws_restJson1GetUsageStatisticsCommandError = async (output, context) => {
@@ -3772,7 +2985,6 @@ const deserializeAws_restJson1GetUsageStatisticsCommandError = async (output, co
3772
2985
  ...output,
3773
2986
  body: await parseBody(output.body, context),
3774
2987
  };
3775
- let response;
3776
2988
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3777
2989
  switch (errorCode) {
3778
2990
  case "BadRequestException":
@@ -3783,29 +2995,26 @@ const deserializeAws_restJson1GetUsageStatisticsCommandError = async (output, co
3783
2995
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3784
2996
  default:
3785
2997
  const parsedBody = parsedOutput.body;
3786
- const $metadata = deserializeMetadata(output);
3787
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3788
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3789
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3790
- $fault: "client",
3791
- $metadata,
2998
+ (0, smithy_client_1.throwDefaultError)({
2999
+ output,
3000
+ parsedBody,
3001
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3002
+ errorCode,
3792
3003
  });
3793
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3794
3004
  }
3795
3005
  };
3796
3006
  const deserializeAws_restJson1InviteMembersCommand = async (output, context) => {
3797
3007
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3798
3008
  return deserializeAws_restJson1InviteMembersCommandError(output, context);
3799
3009
  }
3800
- const contents = {
3010
+ const contents = map({
3801
3011
  $metadata: deserializeMetadata(output),
3802
- UnprocessedAccounts: undefined,
3803
- };
3012
+ });
3804
3013
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3805
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
3014
+ if (data.unprocessedAccounts != null) {
3806
3015
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
3807
3016
  }
3808
- return Promise.resolve(contents);
3017
+ return contents;
3809
3018
  };
3810
3019
  exports.deserializeAws_restJson1InviteMembersCommand = deserializeAws_restJson1InviteMembersCommand;
3811
3020
  const deserializeAws_restJson1InviteMembersCommandError = async (output, context) => {
@@ -3813,7 +3022,6 @@ const deserializeAws_restJson1InviteMembersCommandError = async (output, context
3813
3022
  ...output,
3814
3023
  body: await parseBody(output.body, context),
3815
3024
  };
3816
- let response;
3817
3025
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3818
3026
  switch (errorCode) {
3819
3027
  case "BadRequestException":
@@ -3824,33 +3032,29 @@ const deserializeAws_restJson1InviteMembersCommandError = async (output, context
3824
3032
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3825
3033
  default:
3826
3034
  const parsedBody = parsedOutput.body;
3827
- const $metadata = deserializeMetadata(output);
3828
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3829
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3830
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3831
- $fault: "client",
3832
- $metadata,
3035
+ (0, smithy_client_1.throwDefaultError)({
3036
+ output,
3037
+ parsedBody,
3038
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3039
+ errorCode,
3833
3040
  });
3834
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3835
3041
  }
3836
3042
  };
3837
3043
  const deserializeAws_restJson1ListDetectorsCommand = async (output, context) => {
3838
3044
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3839
3045
  return deserializeAws_restJson1ListDetectorsCommandError(output, context);
3840
3046
  }
3841
- const contents = {
3047
+ const contents = map({
3842
3048
  $metadata: deserializeMetadata(output),
3843
- DetectorIds: undefined,
3844
- NextToken: undefined,
3845
- };
3049
+ });
3846
3050
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3847
- if (data.detectorIds !== undefined && data.detectorIds !== null) {
3051
+ if (data.detectorIds != null) {
3848
3052
  contents.DetectorIds = deserializeAws_restJson1DetectorIds(data.detectorIds, context);
3849
3053
  }
3850
- if (data.nextToken !== undefined && data.nextToken !== null) {
3054
+ if (data.nextToken != null) {
3851
3055
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
3852
3056
  }
3853
- return Promise.resolve(contents);
3057
+ return contents;
3854
3058
  };
3855
3059
  exports.deserializeAws_restJson1ListDetectorsCommand = deserializeAws_restJson1ListDetectorsCommand;
3856
3060
  const deserializeAws_restJson1ListDetectorsCommandError = async (output, context) => {
@@ -3858,7 +3062,6 @@ const deserializeAws_restJson1ListDetectorsCommandError = async (output, context
3858
3062
  ...output,
3859
3063
  body: await parseBody(output.body, context),
3860
3064
  };
3861
- let response;
3862
3065
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3863
3066
  switch (errorCode) {
3864
3067
  case "BadRequestException":
@@ -3869,33 +3072,29 @@ const deserializeAws_restJson1ListDetectorsCommandError = async (output, context
3869
3072
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3870
3073
  default:
3871
3074
  const parsedBody = parsedOutput.body;
3872
- const $metadata = deserializeMetadata(output);
3873
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3874
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3875
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3876
- $fault: "client",
3877
- $metadata,
3075
+ (0, smithy_client_1.throwDefaultError)({
3076
+ output,
3077
+ parsedBody,
3078
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3079
+ errorCode,
3878
3080
  });
3879
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3880
3081
  }
3881
3082
  };
3882
3083
  const deserializeAws_restJson1ListFiltersCommand = async (output, context) => {
3883
3084
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3884
3085
  return deserializeAws_restJson1ListFiltersCommandError(output, context);
3885
3086
  }
3886
- const contents = {
3087
+ const contents = map({
3887
3088
  $metadata: deserializeMetadata(output),
3888
- FilterNames: undefined,
3889
- NextToken: undefined,
3890
- };
3089
+ });
3891
3090
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3892
- if (data.filterNames !== undefined && data.filterNames !== null) {
3091
+ if (data.filterNames != null) {
3893
3092
  contents.FilterNames = deserializeAws_restJson1FilterNames(data.filterNames, context);
3894
3093
  }
3895
- if (data.nextToken !== undefined && data.nextToken !== null) {
3094
+ if (data.nextToken != null) {
3896
3095
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
3897
3096
  }
3898
- return Promise.resolve(contents);
3097
+ return contents;
3899
3098
  };
3900
3099
  exports.deserializeAws_restJson1ListFiltersCommand = deserializeAws_restJson1ListFiltersCommand;
3901
3100
  const deserializeAws_restJson1ListFiltersCommandError = async (output, context) => {
@@ -3903,7 +3102,6 @@ const deserializeAws_restJson1ListFiltersCommandError = async (output, context)
3903
3102
  ...output,
3904
3103
  body: await parseBody(output.body, context),
3905
3104
  };
3906
- let response;
3907
3105
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3908
3106
  switch (errorCode) {
3909
3107
  case "BadRequestException":
@@ -3914,33 +3112,29 @@ const deserializeAws_restJson1ListFiltersCommandError = async (output, context)
3914
3112
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3915
3113
  default:
3916
3114
  const parsedBody = parsedOutput.body;
3917
- const $metadata = deserializeMetadata(output);
3918
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3919
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3920
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3921
- $fault: "client",
3922
- $metadata,
3115
+ (0, smithy_client_1.throwDefaultError)({
3116
+ output,
3117
+ parsedBody,
3118
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3119
+ errorCode,
3923
3120
  });
3924
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3925
3121
  }
3926
3122
  };
3927
3123
  const deserializeAws_restJson1ListFindingsCommand = async (output, context) => {
3928
3124
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3929
3125
  return deserializeAws_restJson1ListFindingsCommandError(output, context);
3930
3126
  }
3931
- const contents = {
3127
+ const contents = map({
3932
3128
  $metadata: deserializeMetadata(output),
3933
- FindingIds: undefined,
3934
- NextToken: undefined,
3935
- };
3129
+ });
3936
3130
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3937
- if (data.findingIds !== undefined && data.findingIds !== null) {
3131
+ if (data.findingIds != null) {
3938
3132
  contents.FindingIds = deserializeAws_restJson1FindingIds(data.findingIds, context);
3939
3133
  }
3940
- if (data.nextToken !== undefined && data.nextToken !== null) {
3134
+ if (data.nextToken != null) {
3941
3135
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
3942
3136
  }
3943
- return Promise.resolve(contents);
3137
+ return contents;
3944
3138
  };
3945
3139
  exports.deserializeAws_restJson1ListFindingsCommand = deserializeAws_restJson1ListFindingsCommand;
3946
3140
  const deserializeAws_restJson1ListFindingsCommandError = async (output, context) => {
@@ -3948,7 +3142,6 @@ const deserializeAws_restJson1ListFindingsCommandError = async (output, context)
3948
3142
  ...output,
3949
3143
  body: await parseBody(output.body, context),
3950
3144
  };
3951
- let response;
3952
3145
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3953
3146
  switch (errorCode) {
3954
3147
  case "BadRequestException":
@@ -3959,33 +3152,29 @@ const deserializeAws_restJson1ListFindingsCommandError = async (output, context)
3959
3152
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
3960
3153
  default:
3961
3154
  const parsedBody = parsedOutput.body;
3962
- const $metadata = deserializeMetadata(output);
3963
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3964
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
3965
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3966
- $fault: "client",
3967
- $metadata,
3155
+ (0, smithy_client_1.throwDefaultError)({
3156
+ output,
3157
+ parsedBody,
3158
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3159
+ errorCode,
3968
3160
  });
3969
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3970
3161
  }
3971
3162
  };
3972
3163
  const deserializeAws_restJson1ListInvitationsCommand = async (output, context) => {
3973
3164
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3974
3165
  return deserializeAws_restJson1ListInvitationsCommandError(output, context);
3975
3166
  }
3976
- const contents = {
3167
+ const contents = map({
3977
3168
  $metadata: deserializeMetadata(output),
3978
- Invitations: undefined,
3979
- NextToken: undefined,
3980
- };
3169
+ });
3981
3170
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3982
- if (data.invitations !== undefined && data.invitations !== null) {
3171
+ if (data.invitations != null) {
3983
3172
  contents.Invitations = deserializeAws_restJson1Invitations(data.invitations, context);
3984
3173
  }
3985
- if (data.nextToken !== undefined && data.nextToken !== null) {
3174
+ if (data.nextToken != null) {
3986
3175
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
3987
3176
  }
3988
- return Promise.resolve(contents);
3177
+ return contents;
3989
3178
  };
3990
3179
  exports.deserializeAws_restJson1ListInvitationsCommand = deserializeAws_restJson1ListInvitationsCommand;
3991
3180
  const deserializeAws_restJson1ListInvitationsCommandError = async (output, context) => {
@@ -3993,7 +3182,6 @@ const deserializeAws_restJson1ListInvitationsCommandError = async (output, conte
3993
3182
  ...output,
3994
3183
  body: await parseBody(output.body, context),
3995
3184
  };
3996
- let response;
3997
3185
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3998
3186
  switch (errorCode) {
3999
3187
  case "BadRequestException":
@@ -4004,33 +3192,29 @@ const deserializeAws_restJson1ListInvitationsCommandError = async (output, conte
4004
3192
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4005
3193
  default:
4006
3194
  const parsedBody = parsedOutput.body;
4007
- const $metadata = deserializeMetadata(output);
4008
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4009
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4010
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4011
- $fault: "client",
4012
- $metadata,
3195
+ (0, smithy_client_1.throwDefaultError)({
3196
+ output,
3197
+ parsedBody,
3198
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3199
+ errorCode,
4013
3200
  });
4014
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4015
3201
  }
4016
3202
  };
4017
3203
  const deserializeAws_restJson1ListIPSetsCommand = async (output, context) => {
4018
3204
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4019
3205
  return deserializeAws_restJson1ListIPSetsCommandError(output, context);
4020
3206
  }
4021
- const contents = {
3207
+ const contents = map({
4022
3208
  $metadata: deserializeMetadata(output),
4023
- IpSetIds: undefined,
4024
- NextToken: undefined,
4025
- };
3209
+ });
4026
3210
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4027
- if (data.ipSetIds !== undefined && data.ipSetIds !== null) {
3211
+ if (data.ipSetIds != null) {
4028
3212
  contents.IpSetIds = deserializeAws_restJson1IpSetIds(data.ipSetIds, context);
4029
3213
  }
4030
- if (data.nextToken !== undefined && data.nextToken !== null) {
3214
+ if (data.nextToken != null) {
4031
3215
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
4032
3216
  }
4033
- return Promise.resolve(contents);
3217
+ return contents;
4034
3218
  };
4035
3219
  exports.deserializeAws_restJson1ListIPSetsCommand = deserializeAws_restJson1ListIPSetsCommand;
4036
3220
  const deserializeAws_restJson1ListIPSetsCommandError = async (output, context) => {
@@ -4038,7 +3222,6 @@ const deserializeAws_restJson1ListIPSetsCommandError = async (output, context) =
4038
3222
  ...output,
4039
3223
  body: await parseBody(output.body, context),
4040
3224
  };
4041
- let response;
4042
3225
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4043
3226
  switch (errorCode) {
4044
3227
  case "BadRequestException":
@@ -4049,33 +3232,29 @@ const deserializeAws_restJson1ListIPSetsCommandError = async (output, context) =
4049
3232
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4050
3233
  default:
4051
3234
  const parsedBody = parsedOutput.body;
4052
- const $metadata = deserializeMetadata(output);
4053
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4054
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4055
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4056
- $fault: "client",
4057
- $metadata,
3235
+ (0, smithy_client_1.throwDefaultError)({
3236
+ output,
3237
+ parsedBody,
3238
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3239
+ errorCode,
4058
3240
  });
4059
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4060
3241
  }
4061
3242
  };
4062
3243
  const deserializeAws_restJson1ListMembersCommand = async (output, context) => {
4063
3244
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4064
3245
  return deserializeAws_restJson1ListMembersCommandError(output, context);
4065
3246
  }
4066
- const contents = {
3247
+ const contents = map({
4067
3248
  $metadata: deserializeMetadata(output),
4068
- Members: undefined,
4069
- NextToken: undefined,
4070
- };
3249
+ });
4071
3250
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4072
- if (data.members !== undefined && data.members !== null) {
3251
+ if (data.members != null) {
4073
3252
  contents.Members = deserializeAws_restJson1Members(data.members, context);
4074
3253
  }
4075
- if (data.nextToken !== undefined && data.nextToken !== null) {
3254
+ if (data.nextToken != null) {
4076
3255
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
4077
3256
  }
4078
- return Promise.resolve(contents);
3257
+ return contents;
4079
3258
  };
4080
3259
  exports.deserializeAws_restJson1ListMembersCommand = deserializeAws_restJson1ListMembersCommand;
4081
3260
  const deserializeAws_restJson1ListMembersCommandError = async (output, context) => {
@@ -4083,7 +3262,6 @@ const deserializeAws_restJson1ListMembersCommandError = async (output, context)
4083
3262
  ...output,
4084
3263
  body: await parseBody(output.body, context),
4085
3264
  };
4086
- let response;
4087
3265
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4088
3266
  switch (errorCode) {
4089
3267
  case "BadRequestException":
@@ -4094,33 +3272,29 @@ const deserializeAws_restJson1ListMembersCommandError = async (output, context)
4094
3272
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4095
3273
  default:
4096
3274
  const parsedBody = parsedOutput.body;
4097
- const $metadata = deserializeMetadata(output);
4098
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4099
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4100
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4101
- $fault: "client",
4102
- $metadata,
3275
+ (0, smithy_client_1.throwDefaultError)({
3276
+ output,
3277
+ parsedBody,
3278
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3279
+ errorCode,
4103
3280
  });
4104
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4105
3281
  }
4106
3282
  };
4107
3283
  const deserializeAws_restJson1ListOrganizationAdminAccountsCommand = async (output, context) => {
4108
3284
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4109
3285
  return deserializeAws_restJson1ListOrganizationAdminAccountsCommandError(output, context);
4110
3286
  }
4111
- const contents = {
3287
+ const contents = map({
4112
3288
  $metadata: deserializeMetadata(output),
4113
- AdminAccounts: undefined,
4114
- NextToken: undefined,
4115
- };
3289
+ });
4116
3290
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4117
- if (data.adminAccounts !== undefined && data.adminAccounts !== null) {
3291
+ if (data.adminAccounts != null) {
4118
3292
  contents.AdminAccounts = deserializeAws_restJson1AdminAccounts(data.adminAccounts, context);
4119
3293
  }
4120
- if (data.nextToken !== undefined && data.nextToken !== null) {
3294
+ if (data.nextToken != null) {
4121
3295
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
4122
3296
  }
4123
- return Promise.resolve(contents);
3297
+ return contents;
4124
3298
  };
4125
3299
  exports.deserializeAws_restJson1ListOrganizationAdminAccountsCommand = deserializeAws_restJson1ListOrganizationAdminAccountsCommand;
4126
3300
  const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async (output, context) => {
@@ -4128,7 +3302,6 @@ const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async
4128
3302
  ...output,
4129
3303
  body: await parseBody(output.body, context),
4130
3304
  };
4131
- let response;
4132
3305
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4133
3306
  switch (errorCode) {
4134
3307
  case "BadRequestException":
@@ -4139,33 +3312,29 @@ const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async
4139
3312
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4140
3313
  default:
4141
3314
  const parsedBody = parsedOutput.body;
4142
- const $metadata = deserializeMetadata(output);
4143
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4144
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4145
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4146
- $fault: "client",
4147
- $metadata,
3315
+ (0, smithy_client_1.throwDefaultError)({
3316
+ output,
3317
+ parsedBody,
3318
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3319
+ errorCode,
4148
3320
  });
4149
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4150
3321
  }
4151
3322
  };
4152
3323
  const deserializeAws_restJson1ListPublishingDestinationsCommand = async (output, context) => {
4153
3324
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4154
3325
  return deserializeAws_restJson1ListPublishingDestinationsCommandError(output, context);
4155
3326
  }
4156
- const contents = {
3327
+ const contents = map({
4157
3328
  $metadata: deserializeMetadata(output),
4158
- Destinations: undefined,
4159
- NextToken: undefined,
4160
- };
3329
+ });
4161
3330
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4162
- if (data.destinations !== undefined && data.destinations !== null) {
3331
+ if (data.destinations != null) {
4163
3332
  contents.Destinations = deserializeAws_restJson1Destinations(data.destinations, context);
4164
3333
  }
4165
- if (data.nextToken !== undefined && data.nextToken !== null) {
3334
+ if (data.nextToken != null) {
4166
3335
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
4167
3336
  }
4168
- return Promise.resolve(contents);
3337
+ return contents;
4169
3338
  };
4170
3339
  exports.deserializeAws_restJson1ListPublishingDestinationsCommand = deserializeAws_restJson1ListPublishingDestinationsCommand;
4171
3340
  const deserializeAws_restJson1ListPublishingDestinationsCommandError = async (output, context) => {
@@ -4173,7 +3342,6 @@ const deserializeAws_restJson1ListPublishingDestinationsCommandError = async (ou
4173
3342
  ...output,
4174
3343
  body: await parseBody(output.body, context),
4175
3344
  };
4176
- let response;
4177
3345
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4178
3346
  switch (errorCode) {
4179
3347
  case "BadRequestException":
@@ -4184,29 +3352,26 @@ const deserializeAws_restJson1ListPublishingDestinationsCommandError = async (ou
4184
3352
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4185
3353
  default:
4186
3354
  const parsedBody = parsedOutput.body;
4187
- const $metadata = deserializeMetadata(output);
4188
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4189
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4190
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4191
- $fault: "client",
4192
- $metadata,
3355
+ (0, smithy_client_1.throwDefaultError)({
3356
+ output,
3357
+ parsedBody,
3358
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3359
+ errorCode,
4193
3360
  });
4194
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4195
3361
  }
4196
3362
  };
4197
3363
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
4198
3364
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4199
3365
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
4200
3366
  }
4201
- const contents = {
3367
+ const contents = map({
4202
3368
  $metadata: deserializeMetadata(output),
4203
- Tags: undefined,
4204
- };
3369
+ });
4205
3370
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4206
- if (data.tags !== undefined && data.tags !== null) {
3371
+ if (data.tags != null) {
4207
3372
  contents.Tags = deserializeAws_restJson1TagMap(data.tags, context);
4208
3373
  }
4209
- return Promise.resolve(contents);
3374
+ return contents;
4210
3375
  };
4211
3376
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
4212
3377
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -4214,7 +3379,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
4214
3379
  ...output,
4215
3380
  body: await parseBody(output.body, context),
4216
3381
  };
4217
- let response;
4218
3382
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4219
3383
  switch (errorCode) {
4220
3384
  case "BadRequestException":
@@ -4225,33 +3389,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
4225
3389
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4226
3390
  default:
4227
3391
  const parsedBody = parsedOutput.body;
4228
- const $metadata = deserializeMetadata(output);
4229
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4230
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4231
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4232
- $fault: "client",
4233
- $metadata,
3392
+ (0, smithy_client_1.throwDefaultError)({
3393
+ output,
3394
+ parsedBody,
3395
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3396
+ errorCode,
4234
3397
  });
4235
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4236
3398
  }
4237
3399
  };
4238
3400
  const deserializeAws_restJson1ListThreatIntelSetsCommand = async (output, context) => {
4239
3401
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4240
3402
  return deserializeAws_restJson1ListThreatIntelSetsCommandError(output, context);
4241
3403
  }
4242
- const contents = {
3404
+ const contents = map({
4243
3405
  $metadata: deserializeMetadata(output),
4244
- NextToken: undefined,
4245
- ThreatIntelSetIds: undefined,
4246
- };
3406
+ });
4247
3407
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4248
- if (data.nextToken !== undefined && data.nextToken !== null) {
3408
+ if (data.nextToken != null) {
4249
3409
  contents.NextToken = (0, smithy_client_1.expectString)(data.nextToken);
4250
3410
  }
4251
- if (data.threatIntelSetIds !== undefined && data.threatIntelSetIds !== null) {
3411
+ if (data.threatIntelSetIds != null) {
4252
3412
  contents.ThreatIntelSetIds = deserializeAws_restJson1ThreatIntelSetIds(data.threatIntelSetIds, context);
4253
3413
  }
4254
- return Promise.resolve(contents);
3414
+ return contents;
4255
3415
  };
4256
3416
  exports.deserializeAws_restJson1ListThreatIntelSetsCommand = deserializeAws_restJson1ListThreatIntelSetsCommand;
4257
3417
  const deserializeAws_restJson1ListThreatIntelSetsCommandError = async (output, context) => {
@@ -4259,7 +3419,6 @@ const deserializeAws_restJson1ListThreatIntelSetsCommandError = async (output, c
4259
3419
  ...output,
4260
3420
  body: await parseBody(output.body, context),
4261
3421
  };
4262
- let response;
4263
3422
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4264
3423
  switch (errorCode) {
4265
3424
  case "BadRequestException":
@@ -4270,29 +3429,26 @@ const deserializeAws_restJson1ListThreatIntelSetsCommandError = async (output, c
4270
3429
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4271
3430
  default:
4272
3431
  const parsedBody = parsedOutput.body;
4273
- const $metadata = deserializeMetadata(output);
4274
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4275
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4276
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4277
- $fault: "client",
4278
- $metadata,
3432
+ (0, smithy_client_1.throwDefaultError)({
3433
+ output,
3434
+ parsedBody,
3435
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3436
+ errorCode,
4279
3437
  });
4280
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4281
3438
  }
4282
3439
  };
4283
3440
  const deserializeAws_restJson1StartMonitoringMembersCommand = async (output, context) => {
4284
3441
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4285
3442
  return deserializeAws_restJson1StartMonitoringMembersCommandError(output, context);
4286
3443
  }
4287
- const contents = {
3444
+ const contents = map({
4288
3445
  $metadata: deserializeMetadata(output),
4289
- UnprocessedAccounts: undefined,
4290
- };
3446
+ });
4291
3447
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4292
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
3448
+ if (data.unprocessedAccounts != null) {
4293
3449
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
4294
3450
  }
4295
- return Promise.resolve(contents);
3451
+ return contents;
4296
3452
  };
4297
3453
  exports.deserializeAws_restJson1StartMonitoringMembersCommand = deserializeAws_restJson1StartMonitoringMembersCommand;
4298
3454
  const deserializeAws_restJson1StartMonitoringMembersCommandError = async (output, context) => {
@@ -4300,7 +3456,6 @@ const deserializeAws_restJson1StartMonitoringMembersCommandError = async (output
4300
3456
  ...output,
4301
3457
  body: await parseBody(output.body, context),
4302
3458
  };
4303
- let response;
4304
3459
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4305
3460
  switch (errorCode) {
4306
3461
  case "BadRequestException":
@@ -4311,29 +3466,26 @@ const deserializeAws_restJson1StartMonitoringMembersCommandError = async (output
4311
3466
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4312
3467
  default:
4313
3468
  const parsedBody = parsedOutput.body;
4314
- const $metadata = deserializeMetadata(output);
4315
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4316
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4317
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4318
- $fault: "client",
4319
- $metadata,
3469
+ (0, smithy_client_1.throwDefaultError)({
3470
+ output,
3471
+ parsedBody,
3472
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3473
+ errorCode,
4320
3474
  });
4321
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4322
3475
  }
4323
3476
  };
4324
3477
  const deserializeAws_restJson1StopMonitoringMembersCommand = async (output, context) => {
4325
3478
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4326
3479
  return deserializeAws_restJson1StopMonitoringMembersCommandError(output, context);
4327
3480
  }
4328
- const contents = {
3481
+ const contents = map({
4329
3482
  $metadata: deserializeMetadata(output),
4330
- UnprocessedAccounts: undefined,
4331
- };
3483
+ });
4332
3484
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4333
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
3485
+ if (data.unprocessedAccounts != null) {
4334
3486
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
4335
3487
  }
4336
- return Promise.resolve(contents);
3488
+ return contents;
4337
3489
  };
4338
3490
  exports.deserializeAws_restJson1StopMonitoringMembersCommand = deserializeAws_restJson1StopMonitoringMembersCommand;
4339
3491
  const deserializeAws_restJson1StopMonitoringMembersCommandError = async (output, context) => {
@@ -4341,7 +3493,6 @@ const deserializeAws_restJson1StopMonitoringMembersCommandError = async (output,
4341
3493
  ...output,
4342
3494
  body: await parseBody(output.body, context),
4343
3495
  };
4344
- let response;
4345
3496
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4346
3497
  switch (errorCode) {
4347
3498
  case "BadRequestException":
@@ -4352,25 +3503,23 @@ const deserializeAws_restJson1StopMonitoringMembersCommandError = async (output,
4352
3503
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4353
3504
  default:
4354
3505
  const parsedBody = parsedOutput.body;
4355
- const $metadata = deserializeMetadata(output);
4356
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4357
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4358
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4359
- $fault: "client",
4360
- $metadata,
3506
+ (0, smithy_client_1.throwDefaultError)({
3507
+ output,
3508
+ parsedBody,
3509
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3510
+ errorCode,
4361
3511
  });
4362
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4363
3512
  }
4364
3513
  };
4365
3514
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
4366
3515
  if (output.statusCode !== 204 && output.statusCode >= 300) {
4367
3516
  return deserializeAws_restJson1TagResourceCommandError(output, context);
4368
3517
  }
4369
- const contents = {
3518
+ const contents = map({
4370
3519
  $metadata: deserializeMetadata(output),
4371
- };
3520
+ });
4372
3521
  await collectBody(output.body, context);
4373
- return Promise.resolve(contents);
3522
+ return contents;
4374
3523
  };
4375
3524
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
4376
3525
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -4378,7 +3527,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
4378
3527
  ...output,
4379
3528
  body: await parseBody(output.body, context),
4380
3529
  };
4381
- let response;
4382
3530
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4383
3531
  switch (errorCode) {
4384
3532
  case "BadRequestException":
@@ -4389,25 +3537,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
4389
3537
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4390
3538
  default:
4391
3539
  const parsedBody = parsedOutput.body;
4392
- const $metadata = deserializeMetadata(output);
4393
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4394
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4395
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4396
- $fault: "client",
4397
- $metadata,
3540
+ (0, smithy_client_1.throwDefaultError)({
3541
+ output,
3542
+ parsedBody,
3543
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3544
+ errorCode,
4398
3545
  });
4399
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4400
3546
  }
4401
3547
  };
4402
3548
  const deserializeAws_restJson1UnarchiveFindingsCommand = async (output, context) => {
4403
3549
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4404
3550
  return deserializeAws_restJson1UnarchiveFindingsCommandError(output, context);
4405
3551
  }
4406
- const contents = {
3552
+ const contents = map({
4407
3553
  $metadata: deserializeMetadata(output),
4408
- };
3554
+ });
4409
3555
  await collectBody(output.body, context);
4410
- return Promise.resolve(contents);
3556
+ return contents;
4411
3557
  };
4412
3558
  exports.deserializeAws_restJson1UnarchiveFindingsCommand = deserializeAws_restJson1UnarchiveFindingsCommand;
4413
3559
  const deserializeAws_restJson1UnarchiveFindingsCommandError = async (output, context) => {
@@ -4415,7 +3561,6 @@ const deserializeAws_restJson1UnarchiveFindingsCommandError = async (output, con
4415
3561
  ...output,
4416
3562
  body: await parseBody(output.body, context),
4417
3563
  };
4418
- let response;
4419
3564
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4420
3565
  switch (errorCode) {
4421
3566
  case "BadRequestException":
@@ -4426,25 +3571,23 @@ const deserializeAws_restJson1UnarchiveFindingsCommandError = async (output, con
4426
3571
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4427
3572
  default:
4428
3573
  const parsedBody = parsedOutput.body;
4429
- const $metadata = deserializeMetadata(output);
4430
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4431
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4432
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4433
- $fault: "client",
4434
- $metadata,
3574
+ (0, smithy_client_1.throwDefaultError)({
3575
+ output,
3576
+ parsedBody,
3577
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3578
+ errorCode,
4435
3579
  });
4436
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4437
3580
  }
4438
3581
  };
4439
3582
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
4440
3583
  if (output.statusCode !== 204 && output.statusCode >= 300) {
4441
3584
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
4442
3585
  }
4443
- const contents = {
3586
+ const contents = map({
4444
3587
  $metadata: deserializeMetadata(output),
4445
- };
3588
+ });
4446
3589
  await collectBody(output.body, context);
4447
- return Promise.resolve(contents);
3590
+ return contents;
4448
3591
  };
4449
3592
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
4450
3593
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -4452,7 +3595,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
4452
3595
  ...output,
4453
3596
  body: await parseBody(output.body, context),
4454
3597
  };
4455
- let response;
4456
3598
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4457
3599
  switch (errorCode) {
4458
3600
  case "BadRequestException":
@@ -4463,25 +3605,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
4463
3605
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4464
3606
  default:
4465
3607
  const parsedBody = parsedOutput.body;
4466
- const $metadata = deserializeMetadata(output);
4467
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4468
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4469
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4470
- $fault: "client",
4471
- $metadata,
3608
+ (0, smithy_client_1.throwDefaultError)({
3609
+ output,
3610
+ parsedBody,
3611
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3612
+ errorCode,
4472
3613
  });
4473
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4474
3614
  }
4475
3615
  };
4476
3616
  const deserializeAws_restJson1UpdateDetectorCommand = async (output, context) => {
4477
3617
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4478
3618
  return deserializeAws_restJson1UpdateDetectorCommandError(output, context);
4479
3619
  }
4480
- const contents = {
3620
+ const contents = map({
4481
3621
  $metadata: deserializeMetadata(output),
4482
- };
3622
+ });
4483
3623
  await collectBody(output.body, context);
4484
- return Promise.resolve(contents);
3624
+ return contents;
4485
3625
  };
4486
3626
  exports.deserializeAws_restJson1UpdateDetectorCommand = deserializeAws_restJson1UpdateDetectorCommand;
4487
3627
  const deserializeAws_restJson1UpdateDetectorCommandError = async (output, context) => {
@@ -4489,7 +3629,6 @@ const deserializeAws_restJson1UpdateDetectorCommandError = async (output, contex
4489
3629
  ...output,
4490
3630
  body: await parseBody(output.body, context),
4491
3631
  };
4492
- let response;
4493
3632
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4494
3633
  switch (errorCode) {
4495
3634
  case "BadRequestException":
@@ -4500,29 +3639,26 @@ const deserializeAws_restJson1UpdateDetectorCommandError = async (output, contex
4500
3639
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4501
3640
  default:
4502
3641
  const parsedBody = parsedOutput.body;
4503
- const $metadata = deserializeMetadata(output);
4504
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4505
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4506
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4507
- $fault: "client",
4508
- $metadata,
3642
+ (0, smithy_client_1.throwDefaultError)({
3643
+ output,
3644
+ parsedBody,
3645
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3646
+ errorCode,
4509
3647
  });
4510
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4511
3648
  }
4512
3649
  };
4513
3650
  const deserializeAws_restJson1UpdateFilterCommand = async (output, context) => {
4514
3651
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4515
3652
  return deserializeAws_restJson1UpdateFilterCommandError(output, context);
4516
3653
  }
4517
- const contents = {
3654
+ const contents = map({
4518
3655
  $metadata: deserializeMetadata(output),
4519
- Name: undefined,
4520
- };
3656
+ });
4521
3657
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4522
- if (data.name !== undefined && data.name !== null) {
3658
+ if (data.name != null) {
4523
3659
  contents.Name = (0, smithy_client_1.expectString)(data.name);
4524
3660
  }
4525
- return Promise.resolve(contents);
3661
+ return contents;
4526
3662
  };
4527
3663
  exports.deserializeAws_restJson1UpdateFilterCommand = deserializeAws_restJson1UpdateFilterCommand;
4528
3664
  const deserializeAws_restJson1UpdateFilterCommandError = async (output, context) => {
@@ -4530,7 +3666,6 @@ const deserializeAws_restJson1UpdateFilterCommandError = async (output, context)
4530
3666
  ...output,
4531
3667
  body: await parseBody(output.body, context),
4532
3668
  };
4533
- let response;
4534
3669
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4535
3670
  switch (errorCode) {
4536
3671
  case "BadRequestException":
@@ -4541,25 +3676,23 @@ const deserializeAws_restJson1UpdateFilterCommandError = async (output, context)
4541
3676
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4542
3677
  default:
4543
3678
  const parsedBody = parsedOutput.body;
4544
- const $metadata = deserializeMetadata(output);
4545
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4546
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4547
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4548
- $fault: "client",
4549
- $metadata,
3679
+ (0, smithy_client_1.throwDefaultError)({
3680
+ output,
3681
+ parsedBody,
3682
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3683
+ errorCode,
4550
3684
  });
4551
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4552
3685
  }
4553
3686
  };
4554
3687
  const deserializeAws_restJson1UpdateFindingsFeedbackCommand = async (output, context) => {
4555
3688
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4556
3689
  return deserializeAws_restJson1UpdateFindingsFeedbackCommandError(output, context);
4557
3690
  }
4558
- const contents = {
3691
+ const contents = map({
4559
3692
  $metadata: deserializeMetadata(output),
4560
- };
3693
+ });
4561
3694
  await collectBody(output.body, context);
4562
- return Promise.resolve(contents);
3695
+ return contents;
4563
3696
  };
4564
3697
  exports.deserializeAws_restJson1UpdateFindingsFeedbackCommand = deserializeAws_restJson1UpdateFindingsFeedbackCommand;
4565
3698
  const deserializeAws_restJson1UpdateFindingsFeedbackCommandError = async (output, context) => {
@@ -4567,7 +3700,6 @@ const deserializeAws_restJson1UpdateFindingsFeedbackCommandError = async (output
4567
3700
  ...output,
4568
3701
  body: await parseBody(output.body, context),
4569
3702
  };
4570
- let response;
4571
3703
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4572
3704
  switch (errorCode) {
4573
3705
  case "BadRequestException":
@@ -4578,25 +3710,23 @@ const deserializeAws_restJson1UpdateFindingsFeedbackCommandError = async (output
4578
3710
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4579
3711
  default:
4580
3712
  const parsedBody = parsedOutput.body;
4581
- const $metadata = deserializeMetadata(output);
4582
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4583
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4584
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4585
- $fault: "client",
4586
- $metadata,
3713
+ (0, smithy_client_1.throwDefaultError)({
3714
+ output,
3715
+ parsedBody,
3716
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3717
+ errorCode,
4587
3718
  });
4588
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4589
3719
  }
4590
3720
  };
4591
3721
  const deserializeAws_restJson1UpdateIPSetCommand = async (output, context) => {
4592
3722
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4593
3723
  return deserializeAws_restJson1UpdateIPSetCommandError(output, context);
4594
3724
  }
4595
- const contents = {
3725
+ const contents = map({
4596
3726
  $metadata: deserializeMetadata(output),
4597
- };
3727
+ });
4598
3728
  await collectBody(output.body, context);
4599
- return Promise.resolve(contents);
3729
+ return contents;
4600
3730
  };
4601
3731
  exports.deserializeAws_restJson1UpdateIPSetCommand = deserializeAws_restJson1UpdateIPSetCommand;
4602
3732
  const deserializeAws_restJson1UpdateIPSetCommandError = async (output, context) => {
@@ -4604,7 +3734,6 @@ const deserializeAws_restJson1UpdateIPSetCommandError = async (output, context)
4604
3734
  ...output,
4605
3735
  body: await parseBody(output.body, context),
4606
3736
  };
4607
- let response;
4608
3737
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4609
3738
  switch (errorCode) {
4610
3739
  case "BadRequestException":
@@ -4615,25 +3744,23 @@ const deserializeAws_restJson1UpdateIPSetCommandError = async (output, context)
4615
3744
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4616
3745
  default:
4617
3746
  const parsedBody = parsedOutput.body;
4618
- const $metadata = deserializeMetadata(output);
4619
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4620
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4621
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4622
- $fault: "client",
4623
- $metadata,
3747
+ (0, smithy_client_1.throwDefaultError)({
3748
+ output,
3749
+ parsedBody,
3750
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3751
+ errorCode,
4624
3752
  });
4625
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4626
3753
  }
4627
3754
  };
4628
3755
  const deserializeAws_restJson1UpdateMalwareScanSettingsCommand = async (output, context) => {
4629
3756
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4630
3757
  return deserializeAws_restJson1UpdateMalwareScanSettingsCommandError(output, context);
4631
3758
  }
4632
- const contents = {
3759
+ const contents = map({
4633
3760
  $metadata: deserializeMetadata(output),
4634
- };
3761
+ });
4635
3762
  await collectBody(output.body, context);
4636
- return Promise.resolve(contents);
3763
+ return contents;
4637
3764
  };
4638
3765
  exports.deserializeAws_restJson1UpdateMalwareScanSettingsCommand = deserializeAws_restJson1UpdateMalwareScanSettingsCommand;
4639
3766
  const deserializeAws_restJson1UpdateMalwareScanSettingsCommandError = async (output, context) => {
@@ -4641,7 +3768,6 @@ const deserializeAws_restJson1UpdateMalwareScanSettingsCommandError = async (out
4641
3768
  ...output,
4642
3769
  body: await parseBody(output.body, context),
4643
3770
  };
4644
- let response;
4645
3771
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4646
3772
  switch (errorCode) {
4647
3773
  case "BadRequestException":
@@ -4652,29 +3778,26 @@ const deserializeAws_restJson1UpdateMalwareScanSettingsCommandError = async (out
4652
3778
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4653
3779
  default:
4654
3780
  const parsedBody = parsedOutput.body;
4655
- const $metadata = deserializeMetadata(output);
4656
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4657
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4658
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4659
- $fault: "client",
4660
- $metadata,
3781
+ (0, smithy_client_1.throwDefaultError)({
3782
+ output,
3783
+ parsedBody,
3784
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3785
+ errorCode,
4661
3786
  });
4662
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4663
3787
  }
4664
3788
  };
4665
3789
  const deserializeAws_restJson1UpdateMemberDetectorsCommand = async (output, context) => {
4666
3790
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4667
3791
  return deserializeAws_restJson1UpdateMemberDetectorsCommandError(output, context);
4668
3792
  }
4669
- const contents = {
3793
+ const contents = map({
4670
3794
  $metadata: deserializeMetadata(output),
4671
- UnprocessedAccounts: undefined,
4672
- };
3795
+ });
4673
3796
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4674
- if (data.unprocessedAccounts !== undefined && data.unprocessedAccounts !== null) {
3797
+ if (data.unprocessedAccounts != null) {
4675
3798
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccounts(data.unprocessedAccounts, context);
4676
3799
  }
4677
- return Promise.resolve(contents);
3800
+ return contents;
4678
3801
  };
4679
3802
  exports.deserializeAws_restJson1UpdateMemberDetectorsCommand = deserializeAws_restJson1UpdateMemberDetectorsCommand;
4680
3803
  const deserializeAws_restJson1UpdateMemberDetectorsCommandError = async (output, context) => {
@@ -4682,7 +3805,6 @@ const deserializeAws_restJson1UpdateMemberDetectorsCommandError = async (output,
4682
3805
  ...output,
4683
3806
  body: await parseBody(output.body, context),
4684
3807
  };
4685
- let response;
4686
3808
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4687
3809
  switch (errorCode) {
4688
3810
  case "BadRequestException":
@@ -4693,25 +3815,23 @@ const deserializeAws_restJson1UpdateMemberDetectorsCommandError = async (output,
4693
3815
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4694
3816
  default:
4695
3817
  const parsedBody = parsedOutput.body;
4696
- const $metadata = deserializeMetadata(output);
4697
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4698
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4699
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4700
- $fault: "client",
4701
- $metadata,
3818
+ (0, smithy_client_1.throwDefaultError)({
3819
+ output,
3820
+ parsedBody,
3821
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3822
+ errorCode,
4702
3823
  });
4703
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4704
3824
  }
4705
3825
  };
4706
3826
  const deserializeAws_restJson1UpdateOrganizationConfigurationCommand = async (output, context) => {
4707
3827
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4708
3828
  return deserializeAws_restJson1UpdateOrganizationConfigurationCommandError(output, context);
4709
3829
  }
4710
- const contents = {
3830
+ const contents = map({
4711
3831
  $metadata: deserializeMetadata(output),
4712
- };
3832
+ });
4713
3833
  await collectBody(output.body, context);
4714
- return Promise.resolve(contents);
3834
+ return contents;
4715
3835
  };
4716
3836
  exports.deserializeAws_restJson1UpdateOrganizationConfigurationCommand = deserializeAws_restJson1UpdateOrganizationConfigurationCommand;
4717
3837
  const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = async (output, context) => {
@@ -4719,7 +3839,6 @@ const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = asyn
4719
3839
  ...output,
4720
3840
  body: await parseBody(output.body, context),
4721
3841
  };
4722
- let response;
4723
3842
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4724
3843
  switch (errorCode) {
4725
3844
  case "BadRequestException":
@@ -4730,25 +3849,23 @@ const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = asyn
4730
3849
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4731
3850
  default:
4732
3851
  const parsedBody = parsedOutput.body;
4733
- const $metadata = deserializeMetadata(output);
4734
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4735
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4736
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4737
- $fault: "client",
4738
- $metadata,
3852
+ (0, smithy_client_1.throwDefaultError)({
3853
+ output,
3854
+ parsedBody,
3855
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3856
+ errorCode,
4739
3857
  });
4740
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4741
3858
  }
4742
3859
  };
4743
3860
  const deserializeAws_restJson1UpdatePublishingDestinationCommand = async (output, context) => {
4744
3861
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4745
3862
  return deserializeAws_restJson1UpdatePublishingDestinationCommandError(output, context);
4746
3863
  }
4747
- const contents = {
3864
+ const contents = map({
4748
3865
  $metadata: deserializeMetadata(output),
4749
- };
3866
+ });
4750
3867
  await collectBody(output.body, context);
4751
- return Promise.resolve(contents);
3868
+ return contents;
4752
3869
  };
4753
3870
  exports.deserializeAws_restJson1UpdatePublishingDestinationCommand = deserializeAws_restJson1UpdatePublishingDestinationCommand;
4754
3871
  const deserializeAws_restJson1UpdatePublishingDestinationCommandError = async (output, context) => {
@@ -4756,7 +3873,6 @@ const deserializeAws_restJson1UpdatePublishingDestinationCommandError = async (o
4756
3873
  ...output,
4757
3874
  body: await parseBody(output.body, context),
4758
3875
  };
4759
- let response;
4760
3876
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4761
3877
  switch (errorCode) {
4762
3878
  case "BadRequestException":
@@ -4767,25 +3883,23 @@ const deserializeAws_restJson1UpdatePublishingDestinationCommandError = async (o
4767
3883
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4768
3884
  default:
4769
3885
  const parsedBody = parsedOutput.body;
4770
- const $metadata = deserializeMetadata(output);
4771
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4772
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4773
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4774
- $fault: "client",
4775
- $metadata,
3886
+ (0, smithy_client_1.throwDefaultError)({
3887
+ output,
3888
+ parsedBody,
3889
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3890
+ errorCode,
4776
3891
  });
4777
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4778
3892
  }
4779
3893
  };
4780
3894
  const deserializeAws_restJson1UpdateThreatIntelSetCommand = async (output, context) => {
4781
3895
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4782
3896
  return deserializeAws_restJson1UpdateThreatIntelSetCommandError(output, context);
4783
3897
  }
4784
- const contents = {
3898
+ const contents = map({
4785
3899
  $metadata: deserializeMetadata(output),
4786
- };
3900
+ });
4787
3901
  await collectBody(output.body, context);
4788
- return Promise.resolve(contents);
3902
+ return contents;
4789
3903
  };
4790
3904
  exports.deserializeAws_restJson1UpdateThreatIntelSetCommand = deserializeAws_restJson1UpdateThreatIntelSetCommand;
4791
3905
  const deserializeAws_restJson1UpdateThreatIntelSetCommandError = async (output, context) => {
@@ -4793,7 +3907,6 @@ const deserializeAws_restJson1UpdateThreatIntelSetCommandError = async (output,
4793
3907
  ...output,
4794
3908
  body: await parseBody(output.body, context),
4795
3909
  };
4796
- let response;
4797
3910
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4798
3911
  switch (errorCode) {
4799
3912
  case "BadRequestException":
@@ -4804,23 +3917,22 @@ const deserializeAws_restJson1UpdateThreatIntelSetCommandError = async (output,
4804
3917
  throw await deserializeAws_restJson1InternalServerErrorExceptionResponse(parsedOutput, context);
4805
3918
  default:
4806
3919
  const parsedBody = parsedOutput.body;
4807
- const $metadata = deserializeMetadata(output);
4808
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4809
- response = new GuardDutyServiceException_1.GuardDutyServiceException({
4810
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4811
- $fault: "client",
4812
- $metadata,
3920
+ (0, smithy_client_1.throwDefaultError)({
3921
+ output,
3922
+ parsedBody,
3923
+ exceptionCtor: GuardDutyServiceException_1.GuardDutyServiceException,
3924
+ errorCode,
4813
3925
  });
4814
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4815
3926
  }
4816
3927
  };
3928
+ const map = smithy_client_1.map;
4817
3929
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
4818
- const contents = {};
3930
+ const contents = map({});
4819
3931
  const data = parsedOutput.body;
4820
- if (data.message !== undefined && data.message !== null) {
3932
+ if (data.message != null) {
4821
3933
  contents.Message = (0, smithy_client_1.expectString)(data.message);
4822
3934
  }
4823
- if (data.__type !== undefined && data.__type !== null) {
3935
+ if (data.__type != null) {
4824
3936
  contents.Type = (0, smithy_client_1.expectString)(data.__type);
4825
3937
  }
4826
3938
  const exception = new models_0_1.BadRequestException({
@@ -4830,12 +3942,12 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
4830
3942
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4831
3943
  };
4832
3944
  const deserializeAws_restJson1InternalServerErrorExceptionResponse = async (parsedOutput, context) => {
4833
- const contents = {};
3945
+ const contents = map({});
4834
3946
  const data = parsedOutput.body;
4835
- if (data.message !== undefined && data.message !== null) {
3947
+ if (data.message != null) {
4836
3948
  contents.Message = (0, smithy_client_1.expectString)(data.message);
4837
3949
  }
4838
- if (data.__type !== undefined && data.__type !== null) {
3950
+ if (data.__type != null) {
4839
3951
  contents.Type = (0, smithy_client_1.expectString)(data.__type);
4840
3952
  }
4841
3953
  const exception = new models_0_1.InternalServerErrorException({
@@ -4854,9 +3966,6 @@ const serializeAws_restJson1AccountDetails = (input, context) => {
4854
3966
  return input
4855
3967
  .filter((e) => e != null)
4856
3968
  .map((entry) => {
4857
- if (entry === null) {
4858
- return null;
4859
- }
4860
3969
  return serializeAws_restJson1AccountDetail(entry, context);
4861
3970
  });
4862
3971
  };
@@ -4864,9 +3973,6 @@ const serializeAws_restJson1AccountIds = (input, context) => {
4864
3973
  return input
4865
3974
  .filter((e) => e != null)
4866
3975
  .map((entry) => {
4867
- if (entry === null) {
4868
- return null;
4869
- }
4870
3976
  return entry;
4871
3977
  });
4872
3978
  };
@@ -4912,9 +4018,6 @@ const serializeAws_restJson1DataSourceList = (input, context) => {
4912
4018
  return input
4913
4019
  .filter((e) => e != null)
4914
4020
  .map((entry) => {
4915
- if (entry === null) {
4916
- return null;
4917
- }
4918
4021
  return entry;
4919
4022
  });
4920
4023
  };
@@ -4928,9 +4031,6 @@ const serializeAws_restJson1Eq = (input, context) => {
4928
4031
  return input
4929
4032
  .filter((e) => e != null)
4930
4033
  .map((entry) => {
4931
- if (entry === null) {
4932
- return null;
4933
- }
4934
4034
  return entry;
4935
4035
  });
4936
4036
  };
@@ -4938,9 +4038,6 @@ const serializeAws_restJson1Equals = (input, context) => {
4938
4038
  return input
4939
4039
  .filter((e) => e != null)
4940
4040
  .map((entry) => {
4941
- if (entry === null) {
4942
- return null;
4943
- }
4944
4041
  return entry;
4945
4042
  });
4946
4043
  };
@@ -4970,9 +4067,6 @@ const serializeAws_restJson1FilterCriterionList = (input, context) => {
4970
4067
  return input
4971
4068
  .filter((e) => e != null)
4972
4069
  .map((entry) => {
4973
- if (entry === null) {
4974
- return null;
4975
- }
4976
4070
  return serializeAws_restJson1FilterCriterion(entry, context);
4977
4071
  });
4978
4072
  };
@@ -4985,9 +4079,6 @@ const serializeAws_restJson1FindingIds = (input, context) => {
4985
4079
  return input
4986
4080
  .filter((e) => e != null)
4987
4081
  .map((entry) => {
4988
- if (entry === null) {
4989
- return null;
4990
- }
4991
4082
  return entry;
4992
4083
  });
4993
4084
  };
@@ -4995,9 +4086,6 @@ const serializeAws_restJson1FindingStatisticTypes = (input, context) => {
4995
4086
  return input
4996
4087
  .filter((e) => e != null)
4997
4088
  .map((entry) => {
4998
- if (entry === null) {
4999
- return null;
5000
- }
5001
4089
  return entry;
5002
4090
  });
5003
4091
  };
@@ -5005,9 +4093,6 @@ const serializeAws_restJson1FindingTypes = (input, context) => {
5005
4093
  return input
5006
4094
  .filter((e) => e != null)
5007
4095
  .map((entry) => {
5008
- if (entry === null) {
5009
- return null;
5010
- }
5011
4096
  return entry;
5012
4097
  });
5013
4098
  };
@@ -5034,9 +4119,6 @@ const serializeAws_restJson1MapEquals = (input, context) => {
5034
4119
  return input
5035
4120
  .filter((e) => e != null)
5036
4121
  .map((entry) => {
5037
- if (entry === null) {
5038
- return null;
5039
- }
5040
4122
  return serializeAws_restJson1ScanConditionPair(entry, context);
5041
4123
  });
5042
4124
  };
@@ -5044,9 +4126,6 @@ const serializeAws_restJson1Neq = (input, context) => {
5044
4126
  return input
5045
4127
  .filter((e) => e != null)
5046
4128
  .map((entry) => {
5047
- if (entry === null) {
5048
- return null;
5049
- }
5050
4129
  return entry;
5051
4130
  });
5052
4131
  };
@@ -5054,9 +4133,6 @@ const serializeAws_restJson1NotEquals = (input, context) => {
5054
4133
  return input
5055
4134
  .filter((e) => e != null)
5056
4135
  .map((entry) => {
5057
- if (entry === null) {
5058
- return null;
5059
- }
5060
4136
  return entry;
5061
4137
  });
5062
4138
  };
@@ -5113,9 +4189,6 @@ const serializeAws_restJson1ResourceList = (input, context) => {
5113
4189
  return input
5114
4190
  .filter((e) => e != null)
5115
4191
  .map((entry) => {
5116
- if (entry === null) {
5117
- return null;
5118
- }
5119
4192
  return entry;
5120
4193
  });
5121
4194
  };