@aws-sdk/client-internetmonitor 3.310.0 → 3.315.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.
@@ -1,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map as __map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, resolvedPath as __resolvedPath, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { v4 as generateIdempotencyToken } from "uuid";
4
4
  import { InternetMonitorServiceException as __BaseException } from "../models/InternetMonitorServiceException";
5
5
  import { AccessDeniedException, BadRequestException, ConflictException, InternalServerErrorException, InternalServerException, LimitExceededException, NotFoundException, ResourceNotFoundException, ThrottlingException, TooManyRequestsException, ValidationException, } from "../models/models_0";
@@ -10,16 +10,15 @@ export const se_CreateMonitorCommand = async (input, context) => {
10
10
  };
11
11
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20210603/Monitors";
12
12
  let body;
13
- body = JSON.stringify({
14
- ClientToken: input.ClientToken ?? generateIdempotencyToken(),
15
- ...(input.InternetMeasurementsLogDelivery != null && {
16
- InternetMeasurementsLogDelivery: se_InternetMeasurementsLogDelivery(input.InternetMeasurementsLogDelivery, context),
17
- }),
18
- ...(input.MaxCityNetworksToMonitor != null && { MaxCityNetworksToMonitor: input.MaxCityNetworksToMonitor }),
19
- ...(input.MonitorName != null && { MonitorName: input.MonitorName }),
20
- ...(input.Resources != null && { Resources: se_SetOfARNs(input.Resources, context) }),
21
- ...(input.Tags != null && { Tags: se_TagMap(input.Tags, context) }),
22
- });
13
+ body = JSON.stringify(take(input, {
14
+ ClientToken: (_) => _ ?? generateIdempotencyToken(),
15
+ InternetMeasurementsLogDelivery: (_) => _json(_),
16
+ MaxCityNetworksToMonitor: [],
17
+ MonitorName: [],
18
+ Resources: (_) => _json(_),
19
+ Tags: (_) => _json(_),
20
+ TrafficPercentageToMonitor: [],
21
+ }));
23
22
  return new __HttpRequest({
24
23
  protocol,
25
24
  hostname,
@@ -153,9 +152,9 @@ export const se_TagResourceCommand = async (input, context) => {
153
152
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
154
153
  resolvedPath = __resolvedPath(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
155
154
  let body;
156
- body = JSON.stringify({
157
- ...(input.Tags != null && { Tags: se_TagMap(input.Tags, context) }),
158
- });
155
+ body = JSON.stringify(take(input, {
156
+ Tags: (_) => _json(_),
157
+ }));
159
158
  return new __HttpRequest({
160
159
  protocol,
161
160
  hostname,
@@ -197,16 +196,15 @@ export const se_UpdateMonitorCommand = async (input, context) => {
197
196
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20210603/Monitors/{MonitorName}";
198
197
  resolvedPath = __resolvedPath(resolvedPath, input, "MonitorName", () => input.MonitorName, "{MonitorName}", false);
199
198
  let body;
200
- body = JSON.stringify({
201
- ClientToken: input.ClientToken ?? generateIdempotencyToken(),
202
- ...(input.InternetMeasurementsLogDelivery != null && {
203
- InternetMeasurementsLogDelivery: se_InternetMeasurementsLogDelivery(input.InternetMeasurementsLogDelivery, context),
204
- }),
205
- ...(input.MaxCityNetworksToMonitor != null && { MaxCityNetworksToMonitor: input.MaxCityNetworksToMonitor }),
206
- ...(input.ResourcesToAdd != null && { ResourcesToAdd: se_SetOfARNs(input.ResourcesToAdd, context) }),
207
- ...(input.ResourcesToRemove != null && { ResourcesToRemove: se_SetOfARNs(input.ResourcesToRemove, context) }),
208
- ...(input.Status != null && { Status: input.Status }),
209
- });
199
+ body = JSON.stringify(take(input, {
200
+ ClientToken: (_) => _ ?? generateIdempotencyToken(),
201
+ InternetMeasurementsLogDelivery: (_) => _json(_),
202
+ MaxCityNetworksToMonitor: [],
203
+ ResourcesToAdd: (_) => _json(_),
204
+ ResourcesToRemove: (_) => _json(_),
205
+ Status: [],
206
+ TrafficPercentageToMonitor: [],
207
+ }));
210
208
  return new __HttpRequest({
211
209
  protocol,
212
210
  hostname,
@@ -225,12 +223,11 @@ export const de_CreateMonitorCommand = async (output, context) => {
225
223
  $metadata: deserializeMetadata(output),
226
224
  });
227
225
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
228
- if (data.Arn != null) {
229
- contents.Arn = __expectString(data.Arn);
230
- }
231
- if (data.Status != null) {
232
- contents.Status = __expectString(data.Status);
233
- }
226
+ const doc = take(data, {
227
+ Arn: __expectString,
228
+ Status: __expectString,
229
+ });
230
+ Object.assign(contents, doc);
234
231
  return contents;
235
232
  };
236
233
  const de_CreateMonitorCommandError = async (output, context) => {
@@ -260,10 +257,9 @@ const de_CreateMonitorCommandError = async (output, context) => {
260
257
  throw await de_ValidationExceptionRes(parsedOutput, context);
261
258
  default:
262
259
  const parsedBody = parsedOutput.body;
263
- throwDefaultError({
260
+ return throwDefaultError({
264
261
  output,
265
262
  parsedBody,
266
- exceptionCtor: __BaseException,
267
263
  errorCode,
268
264
  });
269
265
  }
@@ -299,10 +295,9 @@ const de_DeleteMonitorCommandError = async (output, context) => {
299
295
  throw await de_ValidationExceptionRes(parsedOutput, context);
300
296
  default:
301
297
  const parsedBody = parsedOutput.body;
302
- throwDefaultError({
298
+ return throwDefaultError({
303
299
  output,
304
300
  parsedBody,
305
- exceptionCtor: __BaseException,
306
301
  errorCode,
307
302
  });
308
303
  }
@@ -315,36 +310,19 @@ export const de_GetHealthEventCommand = async (output, context) => {
315
310
  $metadata: deserializeMetadata(output),
316
311
  });
317
312
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
318
- if (data.CreatedAt != null) {
319
- contents.CreatedAt = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.CreatedAt));
320
- }
321
- if (data.EndedAt != null) {
322
- contents.EndedAt = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.EndedAt));
323
- }
324
- if (data.EventArn != null) {
325
- contents.EventArn = __expectString(data.EventArn);
326
- }
327
- if (data.EventId != null) {
328
- contents.EventId = __expectString(data.EventId);
329
- }
330
- if (data.ImpactType != null) {
331
- contents.ImpactType = __expectString(data.ImpactType);
332
- }
333
- if (data.ImpactedLocations != null) {
334
- contents.ImpactedLocations = de_ImpactedLocationsList(data.ImpactedLocations, context);
335
- }
336
- if (data.LastUpdatedAt != null) {
337
- contents.LastUpdatedAt = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.LastUpdatedAt));
338
- }
339
- if (data.PercentOfTotalTrafficImpacted != null) {
340
- contents.PercentOfTotalTrafficImpacted = __limitedParseDouble(data.PercentOfTotalTrafficImpacted);
341
- }
342
- if (data.StartedAt != null) {
343
- contents.StartedAt = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.StartedAt));
344
- }
345
- if (data.Status != null) {
346
- contents.Status = __expectString(data.Status);
347
- }
313
+ const doc = take(data, {
314
+ CreatedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
315
+ EndedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
316
+ EventArn: __expectString,
317
+ EventId: __expectString,
318
+ ImpactType: __expectString,
319
+ ImpactedLocations: (_) => de_ImpactedLocationsList(_, context),
320
+ LastUpdatedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
321
+ PercentOfTotalTrafficImpacted: __limitedParseDouble,
322
+ StartedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
323
+ Status: __expectString,
324
+ });
325
+ Object.assign(contents, doc);
348
326
  return contents;
349
327
  };
350
328
  const de_GetHealthEventCommandError = async (output, context) => {
@@ -368,10 +346,9 @@ const de_GetHealthEventCommandError = async (output, context) => {
368
346
  throw await de_ValidationExceptionRes(parsedOutput, context);
369
347
  default:
370
348
  const parsedBody = parsedOutput.body;
371
- throwDefaultError({
349
+ return throwDefaultError({
372
350
  output,
373
351
  parsedBody,
374
- exceptionCtor: __BaseException,
375
352
  errorCode,
376
353
  });
377
354
  }
@@ -384,39 +361,21 @@ export const de_GetMonitorCommand = async (output, context) => {
384
361
  $metadata: deserializeMetadata(output),
385
362
  });
386
363
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
387
- if (data.CreatedAt != null) {
388
- contents.CreatedAt = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.CreatedAt));
389
- }
390
- if (data.InternetMeasurementsLogDelivery != null) {
391
- contents.InternetMeasurementsLogDelivery = de_InternetMeasurementsLogDelivery(data.InternetMeasurementsLogDelivery, context);
392
- }
393
- if (data.MaxCityNetworksToMonitor != null) {
394
- contents.MaxCityNetworksToMonitor = __expectInt32(data.MaxCityNetworksToMonitor);
395
- }
396
- if (data.ModifiedAt != null) {
397
- contents.ModifiedAt = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.ModifiedAt));
398
- }
399
- if (data.MonitorArn != null) {
400
- contents.MonitorArn = __expectString(data.MonitorArn);
401
- }
402
- if (data.MonitorName != null) {
403
- contents.MonitorName = __expectString(data.MonitorName);
404
- }
405
- if (data.ProcessingStatus != null) {
406
- contents.ProcessingStatus = __expectString(data.ProcessingStatus);
407
- }
408
- if (data.ProcessingStatusInfo != null) {
409
- contents.ProcessingStatusInfo = __expectString(data.ProcessingStatusInfo);
410
- }
411
- if (data.Resources != null) {
412
- contents.Resources = de_SetOfARNs(data.Resources, context);
413
- }
414
- if (data.Status != null) {
415
- contents.Status = __expectString(data.Status);
416
- }
417
- if (data.Tags != null) {
418
- contents.Tags = de_TagMap(data.Tags, context);
419
- }
364
+ const doc = take(data, {
365
+ CreatedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
366
+ InternetMeasurementsLogDelivery: _json,
367
+ MaxCityNetworksToMonitor: __expectInt32,
368
+ ModifiedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
369
+ MonitorArn: __expectString,
370
+ MonitorName: __expectString,
371
+ ProcessingStatus: __expectString,
372
+ ProcessingStatusInfo: __expectString,
373
+ Resources: _json,
374
+ Status: __expectString,
375
+ Tags: _json,
376
+ TrafficPercentageToMonitor: __expectInt32,
377
+ });
378
+ Object.assign(contents, doc);
420
379
  return contents;
421
380
  };
422
381
  const de_GetMonitorCommandError = async (output, context) => {
@@ -440,10 +399,9 @@ const de_GetMonitorCommandError = async (output, context) => {
440
399
  throw await de_ValidationExceptionRes(parsedOutput, context);
441
400
  default:
442
401
  const parsedBody = parsedOutput.body;
443
- throwDefaultError({
402
+ return throwDefaultError({
444
403
  output,
445
404
  parsedBody,
446
- exceptionCtor: __BaseException,
447
405
  errorCode,
448
406
  });
449
407
  }
@@ -456,12 +414,11 @@ export const de_ListHealthEventsCommand = async (output, context) => {
456
414
  $metadata: deserializeMetadata(output),
457
415
  });
458
416
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
459
- if (data.HealthEvents != null) {
460
- contents.HealthEvents = de_HealthEventList(data.HealthEvents, context);
461
- }
462
- if (data.NextToken != null) {
463
- contents.NextToken = __expectString(data.NextToken);
464
- }
417
+ const doc = take(data, {
418
+ HealthEvents: (_) => de_HealthEventList(_, context),
419
+ NextToken: __expectString,
420
+ });
421
+ Object.assign(contents, doc);
465
422
  return contents;
466
423
  };
467
424
  const de_ListHealthEventsCommandError = async (output, context) => {
@@ -485,10 +442,9 @@ const de_ListHealthEventsCommandError = async (output, context) => {
485
442
  throw await de_ValidationExceptionRes(parsedOutput, context);
486
443
  default:
487
444
  const parsedBody = parsedOutput.body;
488
- throwDefaultError({
445
+ return throwDefaultError({
489
446
  output,
490
447
  parsedBody,
491
- exceptionCtor: __BaseException,
492
448
  errorCode,
493
449
  });
494
450
  }
@@ -501,12 +457,11 @@ export const de_ListMonitorsCommand = async (output, context) => {
501
457
  $metadata: deserializeMetadata(output),
502
458
  });
503
459
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
504
- if (data.Monitors != null) {
505
- contents.Monitors = de_MonitorList(data.Monitors, context);
506
- }
507
- if (data.NextToken != null) {
508
- contents.NextToken = __expectString(data.NextToken);
509
- }
460
+ const doc = take(data, {
461
+ Monitors: _json,
462
+ NextToken: __expectString,
463
+ });
464
+ Object.assign(contents, doc);
510
465
  return contents;
511
466
  };
512
467
  const de_ListMonitorsCommandError = async (output, context) => {
@@ -530,10 +485,9 @@ const de_ListMonitorsCommandError = async (output, context) => {
530
485
  throw await de_ValidationExceptionRes(parsedOutput, context);
531
486
  default:
532
487
  const parsedBody = parsedOutput.body;
533
- throwDefaultError({
488
+ return throwDefaultError({
534
489
  output,
535
490
  parsedBody,
536
- exceptionCtor: __BaseException,
537
491
  errorCode,
538
492
  });
539
493
  }
@@ -546,9 +500,10 @@ export const de_ListTagsForResourceCommand = async (output, context) => {
546
500
  $metadata: deserializeMetadata(output),
547
501
  });
548
502
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
549
- if (data.Tags != null) {
550
- contents.Tags = de_TagMap(data.Tags, context);
551
- }
503
+ const doc = take(data, {
504
+ Tags: _json,
505
+ });
506
+ Object.assign(contents, doc);
552
507
  return contents;
553
508
  };
554
509
  const de_ListTagsForResourceCommandError = async (output, context) => {
@@ -575,10 +530,9 @@ const de_ListTagsForResourceCommandError = async (output, context) => {
575
530
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
576
531
  default:
577
532
  const parsedBody = parsedOutput.body;
578
- throwDefaultError({
533
+ return throwDefaultError({
579
534
  output,
580
535
  parsedBody,
581
- exceptionCtor: __BaseException,
582
536
  errorCode,
583
537
  });
584
538
  }
@@ -617,10 +571,9 @@ const de_TagResourceCommandError = async (output, context) => {
617
571
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
618
572
  default:
619
573
  const parsedBody = parsedOutput.body;
620
- throwDefaultError({
574
+ return throwDefaultError({
621
575
  output,
622
576
  parsedBody,
623
- exceptionCtor: __BaseException,
624
577
  errorCode,
625
578
  });
626
579
  }
@@ -659,10 +612,9 @@ const de_UntagResourceCommandError = async (output, context) => {
659
612
  throw await de_TooManyRequestsExceptionRes(parsedOutput, context);
660
613
  default:
661
614
  const parsedBody = parsedOutput.body;
662
- throwDefaultError({
615
+ return throwDefaultError({
663
616
  output,
664
617
  parsedBody,
665
- exceptionCtor: __BaseException,
666
618
  errorCode,
667
619
  });
668
620
  }
@@ -675,12 +627,11 @@ export const de_UpdateMonitorCommand = async (output, context) => {
675
627
  $metadata: deserializeMetadata(output),
676
628
  });
677
629
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
678
- if (data.MonitorArn != null) {
679
- contents.MonitorArn = __expectString(data.MonitorArn);
680
- }
681
- if (data.Status != null) {
682
- contents.Status = __expectString(data.Status);
683
- }
630
+ const doc = take(data, {
631
+ MonitorArn: __expectString,
632
+ Status: __expectString,
633
+ });
634
+ Object.assign(contents, doc);
684
635
  return contents;
685
636
  };
686
637
  const de_UpdateMonitorCommandError = async (output, context) => {
@@ -710,21 +661,21 @@ const de_UpdateMonitorCommandError = async (output, context) => {
710
661
  throw await de_ValidationExceptionRes(parsedOutput, context);
711
662
  default:
712
663
  const parsedBody = parsedOutput.body;
713
- throwDefaultError({
664
+ return throwDefaultError({
714
665
  output,
715
666
  parsedBody,
716
- exceptionCtor: __BaseException,
717
667
  errorCode,
718
668
  });
719
669
  }
720
670
  };
721
- const map = __map;
671
+ const throwDefaultError = withBaseException(__BaseException);
722
672
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
723
673
  const contents = map({});
724
674
  const data = parsedOutput.body;
725
- if (data.message != null) {
726
- contents.message = __expectString(data.message);
727
- }
675
+ const doc = take(data, {
676
+ message: __expectString,
677
+ });
678
+ Object.assign(contents, doc);
728
679
  const exception = new AccessDeniedException({
729
680
  $metadata: deserializeMetadata(parsedOutput),
730
681
  ...contents,
@@ -734,9 +685,10 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
734
685
  const de_BadRequestExceptionRes = async (parsedOutput, context) => {
735
686
  const contents = map({});
736
687
  const data = parsedOutput.body;
737
- if (data.message != null) {
738
- contents.message = __expectString(data.message);
739
- }
688
+ const doc = take(data, {
689
+ message: __expectString,
690
+ });
691
+ Object.assign(contents, doc);
740
692
  const exception = new BadRequestException({
741
693
  $metadata: deserializeMetadata(parsedOutput),
742
694
  ...contents,
@@ -746,9 +698,10 @@ const de_BadRequestExceptionRes = async (parsedOutput, context) => {
746
698
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
747
699
  const contents = map({});
748
700
  const data = parsedOutput.body;
749
- if (data.message != null) {
750
- contents.message = __expectString(data.message);
751
- }
701
+ const doc = take(data, {
702
+ message: __expectString,
703
+ });
704
+ Object.assign(contents, doc);
752
705
  const exception = new ConflictException({
753
706
  $metadata: deserializeMetadata(parsedOutput),
754
707
  ...contents,
@@ -758,9 +711,10 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
758
711
  const de_InternalServerErrorExceptionRes = async (parsedOutput, context) => {
759
712
  const contents = map({});
760
713
  const data = parsedOutput.body;
761
- if (data.message != null) {
762
- contents.message = __expectString(data.message);
763
- }
714
+ const doc = take(data, {
715
+ message: __expectString,
716
+ });
717
+ Object.assign(contents, doc);
764
718
  const exception = new InternalServerErrorException({
765
719
  $metadata: deserializeMetadata(parsedOutput),
766
720
  ...contents,
@@ -770,9 +724,10 @@ const de_InternalServerErrorExceptionRes = async (parsedOutput, context) => {
770
724
  const de_InternalServerExceptionRes = async (parsedOutput, context) => {
771
725
  const contents = map({});
772
726
  const data = parsedOutput.body;
773
- if (data.message != null) {
774
- contents.message = __expectString(data.message);
775
- }
727
+ const doc = take(data, {
728
+ message: __expectString,
729
+ });
730
+ Object.assign(contents, doc);
776
731
  const exception = new InternalServerException({
777
732
  $metadata: deserializeMetadata(parsedOutput),
778
733
  ...contents,
@@ -782,9 +737,10 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
782
737
  const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
783
738
  const contents = map({});
784
739
  const data = parsedOutput.body;
785
- if (data.message != null) {
786
- contents.message = __expectString(data.message);
787
- }
740
+ const doc = take(data, {
741
+ message: __expectString,
742
+ });
743
+ Object.assign(contents, doc);
788
744
  const exception = new LimitExceededException({
789
745
  $metadata: deserializeMetadata(parsedOutput),
790
746
  ...contents,
@@ -794,9 +750,10 @@ const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
794
750
  const de_NotFoundExceptionRes = async (parsedOutput, context) => {
795
751
  const contents = map({});
796
752
  const data = parsedOutput.body;
797
- if (data.message != null) {
798
- contents.message = __expectString(data.message);
799
- }
753
+ const doc = take(data, {
754
+ message: __expectString,
755
+ });
756
+ Object.assign(contents, doc);
800
757
  const exception = new NotFoundException({
801
758
  $metadata: deserializeMetadata(parsedOutput),
802
759
  ...contents,
@@ -806,9 +763,10 @@ const de_NotFoundExceptionRes = async (parsedOutput, context) => {
806
763
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
807
764
  const contents = map({});
808
765
  const data = parsedOutput.body;
809
- if (data.message != null) {
810
- contents.message = __expectString(data.message);
811
- }
766
+ const doc = take(data, {
767
+ message: __expectString,
768
+ });
769
+ Object.assign(contents, doc);
812
770
  const exception = new ResourceNotFoundException({
813
771
  $metadata: deserializeMetadata(parsedOutput),
814
772
  ...contents,
@@ -818,9 +776,10 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
818
776
  const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
819
777
  const contents = map({});
820
778
  const data = parsedOutput.body;
821
- if (data.message != null) {
822
- contents.message = __expectString(data.message);
823
- }
779
+ const doc = take(data, {
780
+ message: __expectString,
781
+ });
782
+ Object.assign(contents, doc);
824
783
  const exception = new ThrottlingException({
825
784
  $metadata: deserializeMetadata(parsedOutput),
826
785
  ...contents,
@@ -830,9 +789,10 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
830
789
  const de_TooManyRequestsExceptionRes = async (parsedOutput, context) => {
831
790
  const contents = map({});
832
791
  const data = parsedOutput.body;
833
- if (data.message != null) {
834
- contents.message = __expectString(data.message);
835
- }
792
+ const doc = take(data, {
793
+ message: __expectString,
794
+ });
795
+ Object.assign(contents, doc);
836
796
  const exception = new TooManyRequestsException({
837
797
  $metadata: deserializeMetadata(parsedOutput),
838
798
  ...contents,
@@ -842,201 +802,91 @@ const de_TooManyRequestsExceptionRes = async (parsedOutput, context) => {
842
802
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
843
803
  const contents = map({});
844
804
  const data = parsedOutput.body;
845
- if (data.message != null) {
846
- contents.message = __expectString(data.message);
847
- }
805
+ const doc = take(data, {
806
+ message: __expectString,
807
+ });
808
+ Object.assign(contents, doc);
848
809
  const exception = new ValidationException({
849
810
  $metadata: deserializeMetadata(parsedOutput),
850
811
  ...contents,
851
812
  });
852
813
  return __decorateServiceException(exception, parsedOutput.body);
853
814
  };
854
- const se_InternetMeasurementsLogDelivery = (input, context) => {
855
- return {
856
- ...(input.S3Config != null && { S3Config: se_S3Config(input.S3Config, context) }),
857
- };
858
- };
859
- const se_S3Config = (input, context) => {
860
- return {
861
- ...(input.BucketName != null && { BucketName: input.BucketName }),
862
- ...(input.BucketPrefix != null && { BucketPrefix: input.BucketPrefix }),
863
- ...(input.LogDeliveryStatus != null && { LogDeliveryStatus: input.LogDeliveryStatus }),
864
- };
865
- };
866
- const se_SetOfARNs = (input, context) => {
867
- return input
868
- .filter((e) => e != null)
869
- .map((entry) => {
870
- return entry;
871
- });
872
- };
873
- const se_TagMap = (input, context) => {
874
- return Object.entries(input).reduce((acc, [key, value]) => {
875
- if (value === null) {
876
- return acc;
877
- }
878
- acc[key] = value;
879
- return acc;
880
- }, {});
881
- };
882
815
  const de_AvailabilityMeasurement = (output, context) => {
883
- return {
884
- ExperienceScore: __limitedParseDouble(output.ExperienceScore),
885
- PercentOfClientLocationImpacted: __limitedParseDouble(output.PercentOfClientLocationImpacted),
886
- PercentOfTotalTrafficImpacted: __limitedParseDouble(output.PercentOfTotalTrafficImpacted),
887
- };
816
+ return take(output, {
817
+ ExperienceScore: __limitedParseDouble,
818
+ PercentOfClientLocationImpacted: __limitedParseDouble,
819
+ PercentOfTotalTrafficImpacted: __limitedParseDouble,
820
+ });
888
821
  };
889
822
  const de_HealthEvent = (output, context) => {
890
- return {
891
- CreatedAt: output.CreatedAt != null ? __expectNonNull(__parseRfc3339DateTimeWithOffset(output.CreatedAt)) : undefined,
892
- EndedAt: output.EndedAt != null ? __expectNonNull(__parseRfc3339DateTimeWithOffset(output.EndedAt)) : undefined,
893
- EventArn: __expectString(output.EventArn),
894
- EventId: __expectString(output.EventId),
895
- ImpactType: __expectString(output.ImpactType),
896
- ImpactedLocations: output.ImpactedLocations != null ? de_ImpactedLocationsList(output.ImpactedLocations, context) : undefined,
897
- LastUpdatedAt: output.LastUpdatedAt != null
898
- ? __expectNonNull(__parseRfc3339DateTimeWithOffset(output.LastUpdatedAt))
899
- : undefined,
900
- PercentOfTotalTrafficImpacted: __limitedParseDouble(output.PercentOfTotalTrafficImpacted),
901
- StartedAt: output.StartedAt != null ? __expectNonNull(__parseRfc3339DateTimeWithOffset(output.StartedAt)) : undefined,
902
- Status: __expectString(output.Status),
903
- };
823
+ return take(output, {
824
+ CreatedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
825
+ EndedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
826
+ EventArn: __expectString,
827
+ EventId: __expectString,
828
+ ImpactType: __expectString,
829
+ ImpactedLocations: (_) => de_ImpactedLocationsList(_, context),
830
+ LastUpdatedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
831
+ PercentOfTotalTrafficImpacted: __limitedParseDouble,
832
+ StartedAt: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
833
+ Status: __expectString,
834
+ });
904
835
  };
905
836
  const de_HealthEventList = (output, context) => {
906
837
  const retVal = (output || [])
907
838
  .filter((e) => e != null)
908
839
  .map((entry) => {
909
- if (entry === null) {
910
- return null;
911
- }
912
840
  return de_HealthEvent(entry, context);
913
841
  });
914
842
  return retVal;
915
843
  };
916
844
  const de_ImpactedLocation = (output, context) => {
917
- return {
918
- ASName: __expectString(output.ASName),
919
- ASNumber: __expectLong(output.ASNumber),
920
- CausedBy: output.CausedBy != null ? de_NetworkImpairment(output.CausedBy, context) : undefined,
921
- City: __expectString(output.City),
922
- Country: __expectString(output.Country),
923
- CountryCode: __expectString(output.CountryCode),
924
- InternetHealth: output.InternetHealth != null ? de_InternetHealth(output.InternetHealth, context) : undefined,
925
- Latitude: __limitedParseDouble(output.Latitude),
926
- Longitude: __limitedParseDouble(output.Longitude),
927
- Metro: __expectString(output.Metro),
928
- ServiceLocation: __expectString(output.ServiceLocation),
929
- Status: __expectString(output.Status),
930
- Subdivision: __expectString(output.Subdivision),
931
- SubdivisionCode: __expectString(output.SubdivisionCode),
932
- };
845
+ return take(output, {
846
+ ASName: __expectString,
847
+ ASNumber: __expectLong,
848
+ CausedBy: _json,
849
+ City: __expectString,
850
+ Country: __expectString,
851
+ CountryCode: __expectString,
852
+ InternetHealth: (_) => de_InternetHealth(_, context),
853
+ Latitude: __limitedParseDouble,
854
+ Longitude: __limitedParseDouble,
855
+ Metro: __expectString,
856
+ ServiceLocation: __expectString,
857
+ Status: __expectString,
858
+ Subdivision: __expectString,
859
+ SubdivisionCode: __expectString,
860
+ });
933
861
  };
934
862
  const de_ImpactedLocationsList = (output, context) => {
935
863
  const retVal = (output || [])
936
864
  .filter((e) => e != null)
937
865
  .map((entry) => {
938
- if (entry === null) {
939
- return null;
940
- }
941
866
  return de_ImpactedLocation(entry, context);
942
867
  });
943
868
  return retVal;
944
869
  };
945
870
  const de_InternetHealth = (output, context) => {
946
- return {
947
- Availability: output.Availability != null ? de_AvailabilityMeasurement(output.Availability, context) : undefined,
948
- Performance: output.Performance != null ? de_PerformanceMeasurement(output.Performance, context) : undefined,
949
- };
950
- };
951
- const de_InternetMeasurementsLogDelivery = (output, context) => {
952
- return {
953
- S3Config: output.S3Config != null ? de_S3Config(output.S3Config, context) : undefined,
954
- };
955
- };
956
- const de_Monitor = (output, context) => {
957
- return {
958
- MonitorArn: __expectString(output.MonitorArn),
959
- MonitorName: __expectString(output.MonitorName),
960
- ProcessingStatus: __expectString(output.ProcessingStatus),
961
- Status: __expectString(output.Status),
962
- };
963
- };
964
- const de_MonitorList = (output, context) => {
965
- const retVal = (output || [])
966
- .filter((e) => e != null)
967
- .map((entry) => {
968
- if (entry === null) {
969
- return null;
970
- }
971
- return de_Monitor(entry, context);
972
- });
973
- return retVal;
974
- };
975
- const de_Network = (output, context) => {
976
- return {
977
- ASName: __expectString(output.ASName),
978
- ASNumber: __expectLong(output.ASNumber),
979
- };
980
- };
981
- const de_NetworkImpairment = (output, context) => {
982
- return {
983
- AsPath: output.AsPath != null ? de_NetworkList(output.AsPath, context) : undefined,
984
- NetworkEventType: __expectString(output.NetworkEventType),
985
- Networks: output.Networks != null ? de_NetworkList(output.Networks, context) : undefined,
986
- };
987
- };
988
- const de_NetworkList = (output, context) => {
989
- const retVal = (output || [])
990
- .filter((e) => e != null)
991
- .map((entry) => {
992
- if (entry === null) {
993
- return null;
994
- }
995
- return de_Network(entry, context);
871
+ return take(output, {
872
+ Availability: (_) => de_AvailabilityMeasurement(_, context),
873
+ Performance: (_) => de_PerformanceMeasurement(_, context),
996
874
  });
997
- return retVal;
998
875
  };
999
876
  const de_PerformanceMeasurement = (output, context) => {
1000
- return {
1001
- ExperienceScore: __limitedParseDouble(output.ExperienceScore),
1002
- PercentOfClientLocationImpacted: __limitedParseDouble(output.PercentOfClientLocationImpacted),
1003
- PercentOfTotalTrafficImpacted: __limitedParseDouble(output.PercentOfTotalTrafficImpacted),
1004
- RoundTripTime: output.RoundTripTime != null ? de_RoundTripTime(output.RoundTripTime, context) : undefined,
1005
- };
877
+ return take(output, {
878
+ ExperienceScore: __limitedParseDouble,
879
+ PercentOfClientLocationImpacted: __limitedParseDouble,
880
+ PercentOfTotalTrafficImpacted: __limitedParseDouble,
881
+ RoundTripTime: (_) => de_RoundTripTime(_, context),
882
+ });
1006
883
  };
1007
884
  const de_RoundTripTime = (output, context) => {
1008
- return {
1009
- P50: __limitedParseDouble(output.P50),
1010
- P90: __limitedParseDouble(output.P90),
1011
- P95: __limitedParseDouble(output.P95),
1012
- };
1013
- };
1014
- const de_S3Config = (output, context) => {
1015
- return {
1016
- BucketName: __expectString(output.BucketName),
1017
- BucketPrefix: __expectString(output.BucketPrefix),
1018
- LogDeliveryStatus: __expectString(output.LogDeliveryStatus),
1019
- };
1020
- };
1021
- const de_SetOfARNs = (output, context) => {
1022
- const retVal = (output || [])
1023
- .filter((e) => e != null)
1024
- .map((entry) => {
1025
- if (entry === null) {
1026
- return null;
1027
- }
1028
- return __expectString(entry);
885
+ return take(output, {
886
+ P50: __limitedParseDouble,
887
+ P90: __limitedParseDouble,
888
+ P95: __limitedParseDouble,
1029
889
  });
1030
- return retVal;
1031
- };
1032
- const de_TagMap = (output, context) => {
1033
- return Object.entries(output).reduce((acc, [key, value]) => {
1034
- if (value === null) {
1035
- return acc;
1036
- }
1037
- acc[key] = __expectString(value);
1038
- return acc;
1039
- }, {});
1040
890
  };
1041
891
  const deserializeMetadata = (output) => ({
1042
892
  httpStatusCode: output.statusCode,