@aws-sdk/client-iot-events-data 3.52.0 → 3.53.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.
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeAws_restJson1ListDetectorsCommand = exports.deserializeAws_restJson1ListAlarmsCommand = exports.deserializeAws_restJson1DescribeDetectorCommand = exports.deserializeAws_restJson1DescribeAlarmCommand = exports.deserializeAws_restJson1BatchUpdateDetectorCommand = exports.deserializeAws_restJson1BatchSnoozeAlarmCommand = exports.deserializeAws_restJson1BatchResetAlarmCommand = exports.deserializeAws_restJson1BatchPutMessageCommand = exports.deserializeAws_restJson1BatchEnableAlarmCommand = exports.deserializeAws_restJson1BatchDisableAlarmCommand = exports.deserializeAws_restJson1BatchAcknowledgeAlarmCommand = exports.serializeAws_restJson1ListDetectorsCommand = exports.serializeAws_restJson1ListAlarmsCommand = exports.serializeAws_restJson1DescribeDetectorCommand = exports.serializeAws_restJson1DescribeAlarmCommand = exports.serializeAws_restJson1BatchUpdateDetectorCommand = exports.serializeAws_restJson1BatchSnoozeAlarmCommand = exports.serializeAws_restJson1BatchResetAlarmCommand = exports.serializeAws_restJson1BatchPutMessageCommand = exports.serializeAws_restJson1BatchEnableAlarmCommand = exports.serializeAws_restJson1BatchDisableAlarmCommand = exports.serializeAws_restJson1BatchAcknowledgeAlarmCommand = void 0;
4
4
  const protocol_http_1 = require("@aws-sdk/protocol-http");
5
5
  const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const IoTEventsDataServiceException_1 = require("../models/IoTEventsDataServiceException");
7
+ const models_0_1 = require("../models/models_0");
6
8
  const serializeAws_restJson1BatchAcknowledgeAlarmCommand = async (input, context) => {
7
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
10
  const headers = {
@@ -318,51 +320,25 @@ const deserializeAws_restJson1BatchAcknowledgeAlarmCommandError = async (output,
318
320
  switch (errorCode) {
319
321
  case "InternalFailureException":
320
322
  case "com.amazonaws.ioteventsdata#InternalFailureException":
321
- response = {
322
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
323
- name: errorCode,
324
- $metadata: deserializeMetadata(output),
325
- };
326
- break;
323
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
327
324
  case "InvalidRequestException":
328
325
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
329
- response = {
330
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
331
- name: errorCode,
332
- $metadata: deserializeMetadata(output),
333
- };
334
- break;
326
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
335
327
  case "ServiceUnavailableException":
336
328
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
337
- response = {
338
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
339
- name: errorCode,
340
- $metadata: deserializeMetadata(output),
341
- };
342
- break;
329
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
343
330
  case "ThrottlingException":
344
331
  case "com.amazonaws.ioteventsdata#ThrottlingException":
345
- response = {
346
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
347
- name: errorCode,
348
- $metadata: deserializeMetadata(output),
349
- };
350
- break;
332
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
351
333
  default:
352
334
  const parsedBody = parsedOutput.body;
353
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
354
- response = {
355
- ...parsedBody,
356
- name: `${errorCode}`,
357
- message: parsedBody.message || parsedBody.Message || errorCode,
335
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
336
+ name: parsedBody.code || parsedBody.Code || errorCode,
358
337
  $fault: "client",
359
338
  $metadata: deserializeMetadata(output),
360
- };
339
+ });
340
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
361
341
  }
362
- const message = response.message || response.Message || errorCode;
363
- response.message = message;
364
- delete response.Message;
365
- return Promise.reject(Object.assign(new Error(message), response));
366
342
  };
367
343
  const deserializeAws_restJson1BatchDisableAlarmCommand = async (output, context) => {
368
344
  if (output.statusCode !== 202 && output.statusCode >= 300) {
@@ -390,51 +366,25 @@ const deserializeAws_restJson1BatchDisableAlarmCommandError = async (output, con
390
366
  switch (errorCode) {
391
367
  case "InternalFailureException":
392
368
  case "com.amazonaws.ioteventsdata#InternalFailureException":
393
- response = {
394
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
395
- name: errorCode,
396
- $metadata: deserializeMetadata(output),
397
- };
398
- break;
369
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
399
370
  case "InvalidRequestException":
400
371
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
401
- response = {
402
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
403
- name: errorCode,
404
- $metadata: deserializeMetadata(output),
405
- };
406
- break;
372
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
407
373
  case "ServiceUnavailableException":
408
374
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
409
- response = {
410
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
411
- name: errorCode,
412
- $metadata: deserializeMetadata(output),
413
- };
414
- break;
375
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
415
376
  case "ThrottlingException":
416
377
  case "com.amazonaws.ioteventsdata#ThrottlingException":
417
- response = {
418
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
419
- name: errorCode,
420
- $metadata: deserializeMetadata(output),
421
- };
422
- break;
378
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
423
379
  default:
424
380
  const parsedBody = parsedOutput.body;
425
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
426
- response = {
427
- ...parsedBody,
428
- name: `${errorCode}`,
429
- message: parsedBody.message || parsedBody.Message || errorCode,
381
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
382
+ name: parsedBody.code || parsedBody.Code || errorCode,
430
383
  $fault: "client",
431
384
  $metadata: deserializeMetadata(output),
432
- };
385
+ });
386
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
433
387
  }
434
- const message = response.message || response.Message || errorCode;
435
- response.message = message;
436
- delete response.Message;
437
- return Promise.reject(Object.assign(new Error(message), response));
438
388
  };
439
389
  const deserializeAws_restJson1BatchEnableAlarmCommand = async (output, context) => {
440
390
  if (output.statusCode !== 202 && output.statusCode >= 300) {
@@ -462,51 +412,25 @@ const deserializeAws_restJson1BatchEnableAlarmCommandError = async (output, cont
462
412
  switch (errorCode) {
463
413
  case "InternalFailureException":
464
414
  case "com.amazonaws.ioteventsdata#InternalFailureException":
465
- response = {
466
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
467
- name: errorCode,
468
- $metadata: deserializeMetadata(output),
469
- };
470
- break;
415
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
471
416
  case "InvalidRequestException":
472
417
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
473
- response = {
474
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
475
- name: errorCode,
476
- $metadata: deserializeMetadata(output),
477
- };
478
- break;
418
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
479
419
  case "ServiceUnavailableException":
480
420
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
481
- response = {
482
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
483
- name: errorCode,
484
- $metadata: deserializeMetadata(output),
485
- };
486
- break;
421
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
487
422
  case "ThrottlingException":
488
423
  case "com.amazonaws.ioteventsdata#ThrottlingException":
489
- response = {
490
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
491
- name: errorCode,
492
- $metadata: deserializeMetadata(output),
493
- };
494
- break;
424
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
495
425
  default:
496
426
  const parsedBody = parsedOutput.body;
497
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
498
- response = {
499
- ...parsedBody,
500
- name: `${errorCode}`,
501
- message: parsedBody.message || parsedBody.Message || errorCode,
427
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
428
+ name: parsedBody.code || parsedBody.Code || errorCode,
502
429
  $fault: "client",
503
430
  $metadata: deserializeMetadata(output),
504
- };
431
+ });
432
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
505
433
  }
506
- const message = response.message || response.Message || errorCode;
507
- response.message = message;
508
- delete response.Message;
509
- return Promise.reject(Object.assign(new Error(message), response));
510
434
  };
511
435
  const deserializeAws_restJson1BatchPutMessageCommand = async (output, context) => {
512
436
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -534,51 +458,25 @@ const deserializeAws_restJson1BatchPutMessageCommandError = async (output, conte
534
458
  switch (errorCode) {
535
459
  case "InternalFailureException":
536
460
  case "com.amazonaws.ioteventsdata#InternalFailureException":
537
- response = {
538
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
539
- name: errorCode,
540
- $metadata: deserializeMetadata(output),
541
- };
542
- break;
461
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
543
462
  case "InvalidRequestException":
544
463
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
545
- response = {
546
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
547
- name: errorCode,
548
- $metadata: deserializeMetadata(output),
549
- };
550
- break;
464
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
551
465
  case "ServiceUnavailableException":
552
466
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
553
- response = {
554
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
555
- name: errorCode,
556
- $metadata: deserializeMetadata(output),
557
- };
558
- break;
467
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
559
468
  case "ThrottlingException":
560
469
  case "com.amazonaws.ioteventsdata#ThrottlingException":
561
- response = {
562
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
563
- name: errorCode,
564
- $metadata: deserializeMetadata(output),
565
- };
566
- break;
470
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
567
471
  default:
568
472
  const parsedBody = parsedOutput.body;
569
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
570
- response = {
571
- ...parsedBody,
572
- name: `${errorCode}`,
573
- message: parsedBody.message || parsedBody.Message || errorCode,
473
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
474
+ name: parsedBody.code || parsedBody.Code || errorCode,
574
475
  $fault: "client",
575
476
  $metadata: deserializeMetadata(output),
576
- };
477
+ });
478
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
577
479
  }
578
- const message = response.message || response.Message || errorCode;
579
- response.message = message;
580
- delete response.Message;
581
- return Promise.reject(Object.assign(new Error(message), response));
582
480
  };
583
481
  const deserializeAws_restJson1BatchResetAlarmCommand = async (output, context) => {
584
482
  if (output.statusCode !== 202 && output.statusCode >= 300) {
@@ -606,51 +504,25 @@ const deserializeAws_restJson1BatchResetAlarmCommandError = async (output, conte
606
504
  switch (errorCode) {
607
505
  case "InternalFailureException":
608
506
  case "com.amazonaws.ioteventsdata#InternalFailureException":
609
- response = {
610
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
611
- name: errorCode,
612
- $metadata: deserializeMetadata(output),
613
- };
614
- break;
507
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
615
508
  case "InvalidRequestException":
616
509
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
617
- response = {
618
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
619
- name: errorCode,
620
- $metadata: deserializeMetadata(output),
621
- };
622
- break;
510
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
623
511
  case "ServiceUnavailableException":
624
512
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
625
- response = {
626
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
627
- name: errorCode,
628
- $metadata: deserializeMetadata(output),
629
- };
630
- break;
513
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
631
514
  case "ThrottlingException":
632
515
  case "com.amazonaws.ioteventsdata#ThrottlingException":
633
- response = {
634
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
635
- name: errorCode,
636
- $metadata: deserializeMetadata(output),
637
- };
638
- break;
516
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
639
517
  default:
640
518
  const parsedBody = parsedOutput.body;
641
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
642
- response = {
643
- ...parsedBody,
644
- name: `${errorCode}`,
645
- message: parsedBody.message || parsedBody.Message || errorCode,
519
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
520
+ name: parsedBody.code || parsedBody.Code || errorCode,
646
521
  $fault: "client",
647
522
  $metadata: deserializeMetadata(output),
648
- };
523
+ });
524
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
649
525
  }
650
- const message = response.message || response.Message || errorCode;
651
- response.message = message;
652
- delete response.Message;
653
- return Promise.reject(Object.assign(new Error(message), response));
654
526
  };
655
527
  const deserializeAws_restJson1BatchSnoozeAlarmCommand = async (output, context) => {
656
528
  if (output.statusCode !== 202 && output.statusCode >= 300) {
@@ -678,51 +550,25 @@ const deserializeAws_restJson1BatchSnoozeAlarmCommandError = async (output, cont
678
550
  switch (errorCode) {
679
551
  case "InternalFailureException":
680
552
  case "com.amazonaws.ioteventsdata#InternalFailureException":
681
- response = {
682
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
683
- name: errorCode,
684
- $metadata: deserializeMetadata(output),
685
- };
686
- break;
553
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
687
554
  case "InvalidRequestException":
688
555
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
689
- response = {
690
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
691
- name: errorCode,
692
- $metadata: deserializeMetadata(output),
693
- };
694
- break;
556
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
695
557
  case "ServiceUnavailableException":
696
558
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
697
- response = {
698
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
699
- name: errorCode,
700
- $metadata: deserializeMetadata(output),
701
- };
702
- break;
559
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
703
560
  case "ThrottlingException":
704
561
  case "com.amazonaws.ioteventsdata#ThrottlingException":
705
- response = {
706
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
707
- name: errorCode,
708
- $metadata: deserializeMetadata(output),
709
- };
710
- break;
562
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
711
563
  default:
712
564
  const parsedBody = parsedOutput.body;
713
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
714
- response = {
715
- ...parsedBody,
716
- name: `${errorCode}`,
717
- message: parsedBody.message || parsedBody.Message || errorCode,
565
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
566
+ name: parsedBody.code || parsedBody.Code || errorCode,
718
567
  $fault: "client",
719
568
  $metadata: deserializeMetadata(output),
720
- };
569
+ });
570
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
721
571
  }
722
- const message = response.message || response.Message || errorCode;
723
- response.message = message;
724
- delete response.Message;
725
- return Promise.reject(Object.assign(new Error(message), response));
726
572
  };
727
573
  const deserializeAws_restJson1BatchUpdateDetectorCommand = async (output, context) => {
728
574
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -750,51 +596,25 @@ const deserializeAws_restJson1BatchUpdateDetectorCommandError = async (output, c
750
596
  switch (errorCode) {
751
597
  case "InternalFailureException":
752
598
  case "com.amazonaws.ioteventsdata#InternalFailureException":
753
- response = {
754
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
755
- name: errorCode,
756
- $metadata: deserializeMetadata(output),
757
- };
758
- break;
599
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
759
600
  case "InvalidRequestException":
760
601
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
761
- response = {
762
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
763
- name: errorCode,
764
- $metadata: deserializeMetadata(output),
765
- };
766
- break;
602
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
767
603
  case "ServiceUnavailableException":
768
604
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
769
- response = {
770
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
771
- name: errorCode,
772
- $metadata: deserializeMetadata(output),
773
- };
774
- break;
605
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
775
606
  case "ThrottlingException":
776
607
  case "com.amazonaws.ioteventsdata#ThrottlingException":
777
- response = {
778
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
779
- name: errorCode,
780
- $metadata: deserializeMetadata(output),
781
- };
782
- break;
608
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
783
609
  default:
784
610
  const parsedBody = parsedOutput.body;
785
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
786
- response = {
787
- ...parsedBody,
788
- name: `${errorCode}`,
789
- message: parsedBody.message || parsedBody.Message || errorCode,
611
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
612
+ name: parsedBody.code || parsedBody.Code || errorCode,
790
613
  $fault: "client",
791
614
  $metadata: deserializeMetadata(output),
792
- };
615
+ });
616
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
793
617
  }
794
- const message = response.message || response.Message || errorCode;
795
- response.message = message;
796
- delete response.Message;
797
- return Promise.reject(Object.assign(new Error(message), response));
798
618
  };
799
619
  const deserializeAws_restJson1DescribeAlarmCommand = async (output, context) => {
800
620
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -822,59 +642,28 @@ const deserializeAws_restJson1DescribeAlarmCommandError = async (output, context
822
642
  switch (errorCode) {
823
643
  case "InternalFailureException":
824
644
  case "com.amazonaws.ioteventsdata#InternalFailureException":
825
- response = {
826
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
827
- name: errorCode,
828
- $metadata: deserializeMetadata(output),
829
- };
830
- break;
645
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
831
646
  case "InvalidRequestException":
832
647
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
833
- response = {
834
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
835
- name: errorCode,
836
- $metadata: deserializeMetadata(output),
837
- };
838
- break;
648
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
839
649
  case "ResourceNotFoundException":
840
650
  case "com.amazonaws.ioteventsdata#ResourceNotFoundException":
841
- response = {
842
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
843
- name: errorCode,
844
- $metadata: deserializeMetadata(output),
845
- };
846
- break;
651
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
847
652
  case "ServiceUnavailableException":
848
653
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
849
- response = {
850
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
851
- name: errorCode,
852
- $metadata: deserializeMetadata(output),
853
- };
854
- break;
654
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
855
655
  case "ThrottlingException":
856
656
  case "com.amazonaws.ioteventsdata#ThrottlingException":
857
- response = {
858
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
859
- name: errorCode,
860
- $metadata: deserializeMetadata(output),
861
- };
862
- break;
657
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
863
658
  default:
864
659
  const parsedBody = parsedOutput.body;
865
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
866
- response = {
867
- ...parsedBody,
868
- name: `${errorCode}`,
869
- message: parsedBody.message || parsedBody.Message || errorCode,
660
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
661
+ name: parsedBody.code || parsedBody.Code || errorCode,
870
662
  $fault: "client",
871
663
  $metadata: deserializeMetadata(output),
872
- };
664
+ });
665
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
873
666
  }
874
- const message = response.message || response.Message || errorCode;
875
- response.message = message;
876
- delete response.Message;
877
- return Promise.reject(Object.assign(new Error(message), response));
878
667
  };
879
668
  const deserializeAws_restJson1DescribeDetectorCommand = async (output, context) => {
880
669
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -902,59 +691,28 @@ const deserializeAws_restJson1DescribeDetectorCommandError = async (output, cont
902
691
  switch (errorCode) {
903
692
  case "InternalFailureException":
904
693
  case "com.amazonaws.ioteventsdata#InternalFailureException":
905
- response = {
906
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
907
- name: errorCode,
908
- $metadata: deserializeMetadata(output),
909
- };
910
- break;
694
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
911
695
  case "InvalidRequestException":
912
696
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
913
- response = {
914
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
915
- name: errorCode,
916
- $metadata: deserializeMetadata(output),
917
- };
918
- break;
697
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
919
698
  case "ResourceNotFoundException":
920
699
  case "com.amazonaws.ioteventsdata#ResourceNotFoundException":
921
- response = {
922
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
923
- name: errorCode,
924
- $metadata: deserializeMetadata(output),
925
- };
926
- break;
700
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
927
701
  case "ServiceUnavailableException":
928
702
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
929
- response = {
930
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
931
- name: errorCode,
932
- $metadata: deserializeMetadata(output),
933
- };
934
- break;
703
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
935
704
  case "ThrottlingException":
936
705
  case "com.amazonaws.ioteventsdata#ThrottlingException":
937
- response = {
938
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
939
- name: errorCode,
940
- $metadata: deserializeMetadata(output),
941
- };
942
- break;
706
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
943
707
  default:
944
708
  const parsedBody = parsedOutput.body;
945
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
946
- response = {
947
- ...parsedBody,
948
- name: `${errorCode}`,
949
- message: parsedBody.message || parsedBody.Message || errorCode,
709
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
710
+ name: parsedBody.code || parsedBody.Code || errorCode,
950
711
  $fault: "client",
951
712
  $metadata: deserializeMetadata(output),
952
- };
713
+ });
714
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
953
715
  }
954
- const message = response.message || response.Message || errorCode;
955
- response.message = message;
956
- delete response.Message;
957
- return Promise.reject(Object.assign(new Error(message), response));
958
716
  };
959
717
  const deserializeAws_restJson1ListAlarmsCommand = async (output, context) => {
960
718
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -986,59 +744,28 @@ const deserializeAws_restJson1ListAlarmsCommandError = async (output, context) =
986
744
  switch (errorCode) {
987
745
  case "InternalFailureException":
988
746
  case "com.amazonaws.ioteventsdata#InternalFailureException":
989
- response = {
990
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
991
- name: errorCode,
992
- $metadata: deserializeMetadata(output),
993
- };
994
- break;
747
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
995
748
  case "InvalidRequestException":
996
749
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
997
- response = {
998
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
999
- name: errorCode,
1000
- $metadata: deserializeMetadata(output),
1001
- };
1002
- break;
750
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
1003
751
  case "ResourceNotFoundException":
1004
752
  case "com.amazonaws.ioteventsdata#ResourceNotFoundException":
1005
- response = {
1006
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1007
- name: errorCode,
1008
- $metadata: deserializeMetadata(output),
1009
- };
1010
- break;
753
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1011
754
  case "ServiceUnavailableException":
1012
755
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
1013
- response = {
1014
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
1015
- name: errorCode,
1016
- $metadata: deserializeMetadata(output),
1017
- };
1018
- break;
756
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
1019
757
  case "ThrottlingException":
1020
758
  case "com.amazonaws.ioteventsdata#ThrottlingException":
1021
- response = {
1022
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1023
- name: errorCode,
1024
- $metadata: deserializeMetadata(output),
1025
- };
1026
- break;
759
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1027
760
  default:
1028
761
  const parsedBody = parsedOutput.body;
1029
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1030
- response = {
1031
- ...parsedBody,
1032
- name: `${errorCode}`,
1033
- message: parsedBody.message || parsedBody.Message || errorCode,
762
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
763
+ name: parsedBody.code || parsedBody.Code || errorCode,
1034
764
  $fault: "client",
1035
765
  $metadata: deserializeMetadata(output),
1036
- };
766
+ });
767
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1037
768
  }
1038
- const message = response.message || response.Message || errorCode;
1039
- response.message = message;
1040
- delete response.Message;
1041
- return Promise.reject(Object.assign(new Error(message), response));
1042
769
  };
1043
770
  const deserializeAws_restJson1ListDetectorsCommand = async (output, context) => {
1044
771
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1070,124 +797,88 @@ const deserializeAws_restJson1ListDetectorsCommandError = async (output, context
1070
797
  switch (errorCode) {
1071
798
  case "InternalFailureException":
1072
799
  case "com.amazonaws.ioteventsdata#InternalFailureException":
1073
- response = {
1074
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1075
- name: errorCode,
1076
- $metadata: deserializeMetadata(output),
1077
- };
1078
- break;
800
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1079
801
  case "InvalidRequestException":
1080
802
  case "com.amazonaws.ioteventsdata#InvalidRequestException":
1081
- response = {
1082
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
1083
- name: errorCode,
1084
- $metadata: deserializeMetadata(output),
1085
- };
1086
- break;
803
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
1087
804
  case "ResourceNotFoundException":
1088
805
  case "com.amazonaws.ioteventsdata#ResourceNotFoundException":
1089
- response = {
1090
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1091
- name: errorCode,
1092
- $metadata: deserializeMetadata(output),
1093
- };
1094
- break;
806
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1095
807
  case "ServiceUnavailableException":
1096
808
  case "com.amazonaws.ioteventsdata#ServiceUnavailableException":
1097
- response = {
1098
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
1099
- name: errorCode,
1100
- $metadata: deserializeMetadata(output),
1101
- };
1102
- break;
809
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
1103
810
  case "ThrottlingException":
1104
811
  case "com.amazonaws.ioteventsdata#ThrottlingException":
1105
- response = {
1106
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1107
- name: errorCode,
1108
- $metadata: deserializeMetadata(output),
1109
- };
1110
- break;
812
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1111
813
  default:
1112
814
  const parsedBody = parsedOutput.body;
1113
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1114
- response = {
1115
- ...parsedBody,
1116
- name: `${errorCode}`,
1117
- message: parsedBody.message || parsedBody.Message || errorCode,
815
+ response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
816
+ name: parsedBody.code || parsedBody.Code || errorCode,
1118
817
  $fault: "client",
1119
818
  $metadata: deserializeMetadata(output),
1120
- };
819
+ });
820
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1121
821
  }
1122
- const message = response.message || response.Message || errorCode;
1123
- response.message = message;
1124
- delete response.Message;
1125
- return Promise.reject(Object.assign(new Error(message), response));
1126
822
  };
1127
823
  const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
1128
- const contents = {
1129
- name: "InternalFailureException",
1130
- $fault: "server",
1131
- $metadata: deserializeMetadata(parsedOutput),
1132
- message: undefined,
1133
- };
824
+ const contents = {};
1134
825
  const data = parsedOutput.body;
1135
826
  if (data.message !== undefined && data.message !== null) {
1136
827
  contents.message = smithy_client_1.expectString(data.message);
1137
828
  }
1138
- return contents;
829
+ const exception = new models_0_1.InternalFailureException({
830
+ $metadata: deserializeMetadata(parsedOutput),
831
+ ...contents,
832
+ });
833
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1139
834
  };
1140
835
  const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
1141
- const contents = {
1142
- name: "InvalidRequestException",
1143
- $fault: "client",
1144
- $metadata: deserializeMetadata(parsedOutput),
1145
- message: undefined,
1146
- };
836
+ const contents = {};
1147
837
  const data = parsedOutput.body;
1148
838
  if (data.message !== undefined && data.message !== null) {
1149
839
  contents.message = smithy_client_1.expectString(data.message);
1150
840
  }
1151
- return contents;
841
+ const exception = new models_0_1.InvalidRequestException({
842
+ $metadata: deserializeMetadata(parsedOutput),
843
+ ...contents,
844
+ });
845
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1152
846
  };
1153
847
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1154
- const contents = {
1155
- name: "ResourceNotFoundException",
1156
- $fault: "client",
1157
- $metadata: deserializeMetadata(parsedOutput),
1158
- message: undefined,
1159
- };
848
+ const contents = {};
1160
849
  const data = parsedOutput.body;
1161
850
  if (data.message !== undefined && data.message !== null) {
1162
851
  contents.message = smithy_client_1.expectString(data.message);
1163
852
  }
1164
- return contents;
853
+ const exception = new models_0_1.ResourceNotFoundException({
854
+ $metadata: deserializeMetadata(parsedOutput),
855
+ ...contents,
856
+ });
857
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1165
858
  };
1166
859
  const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
1167
- const contents = {
1168
- name: "ServiceUnavailableException",
1169
- $fault: "server",
1170
- $metadata: deserializeMetadata(parsedOutput),
1171
- message: undefined,
1172
- };
860
+ const contents = {};
1173
861
  const data = parsedOutput.body;
1174
862
  if (data.message !== undefined && data.message !== null) {
1175
863
  contents.message = smithy_client_1.expectString(data.message);
1176
864
  }
1177
- return contents;
865
+ const exception = new models_0_1.ServiceUnavailableException({
866
+ $metadata: deserializeMetadata(parsedOutput),
867
+ ...contents,
868
+ });
869
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1178
870
  };
1179
871
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1180
- const contents = {
1181
- name: "ThrottlingException",
1182
- $fault: "client",
1183
- $metadata: deserializeMetadata(parsedOutput),
1184
- message: undefined,
1185
- };
872
+ const contents = {};
1186
873
  const data = parsedOutput.body;
1187
874
  if (data.message !== undefined && data.message !== null) {
1188
875
  contents.message = smithy_client_1.expectString(data.message);
1189
876
  }
1190
- return contents;
877
+ const exception = new models_0_1.ThrottlingException({
878
+ $metadata: deserializeMetadata(parsedOutput),
879
+ ...contents,
880
+ });
881
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1191
882
  };
1192
883
  const serializeAws_restJson1AcknowledgeAlarmActionRequest = (input, context) => {
1193
884
  return {
@@ -1408,7 +1099,7 @@ const deserializeAws_restJson1AlarmState = (output, context) => {
1408
1099
  };
1409
1100
  };
1410
1101
  const deserializeAws_restJson1AlarmSummaries = (output, context) => {
1411
- return (output || [])
1102
+ const retVal = (output || [])
1412
1103
  .filter((e) => e != null)
1413
1104
  .map((entry) => {
1414
1105
  if (entry === null) {
@@ -1416,6 +1107,7 @@ const deserializeAws_restJson1AlarmSummaries = (output, context) => {
1416
1107
  }
1417
1108
  return deserializeAws_restJson1AlarmSummary(entry, context);
1418
1109
  });
1110
+ return retVal;
1419
1111
  };
1420
1112
  const deserializeAws_restJson1AlarmSummary = (output, context) => {
1421
1113
  return {
@@ -1432,7 +1124,7 @@ const deserializeAws_restJson1AlarmSummary = (output, context) => {
1432
1124
  };
1433
1125
  };
1434
1126
  const deserializeAws_restJson1BatchAlarmActionErrorEntries = (output, context) => {
1435
- return (output || [])
1127
+ const retVal = (output || [])
1436
1128
  .filter((e) => e != null)
1437
1129
  .map((entry) => {
1438
1130
  if (entry === null) {
@@ -1440,6 +1132,7 @@ const deserializeAws_restJson1BatchAlarmActionErrorEntries = (output, context) =
1440
1132
  }
1441
1133
  return deserializeAws_restJson1BatchAlarmActionErrorEntry(entry, context);
1442
1134
  });
1135
+ return retVal;
1443
1136
  };
1444
1137
  const deserializeAws_restJson1BatchAlarmActionErrorEntry = (output, context) => {
1445
1138
  return {
@@ -1449,7 +1142,7 @@ const deserializeAws_restJson1BatchAlarmActionErrorEntry = (output, context) =>
1449
1142
  };
1450
1143
  };
1451
1144
  const deserializeAws_restJson1BatchPutMessageErrorEntries = (output, context) => {
1452
- return (output || [])
1145
+ const retVal = (output || [])
1453
1146
  .filter((e) => e != null)
1454
1147
  .map((entry) => {
1455
1148
  if (entry === null) {
@@ -1457,6 +1150,7 @@ const deserializeAws_restJson1BatchPutMessageErrorEntries = (output, context) =>
1457
1150
  }
1458
1151
  return deserializeAws_restJson1BatchPutMessageErrorEntry(entry, context);
1459
1152
  });
1153
+ return retVal;
1460
1154
  };
1461
1155
  const deserializeAws_restJson1BatchPutMessageErrorEntry = (output, context) => {
1462
1156
  return {
@@ -1466,7 +1160,7 @@ const deserializeAws_restJson1BatchPutMessageErrorEntry = (output, context) => {
1466
1160
  };
1467
1161
  };
1468
1162
  const deserializeAws_restJson1BatchUpdateDetectorErrorEntries = (output, context) => {
1469
- return (output || [])
1163
+ const retVal = (output || [])
1470
1164
  .filter((e) => e != null)
1471
1165
  .map((entry) => {
1472
1166
  if (entry === null) {
@@ -1474,6 +1168,7 @@ const deserializeAws_restJson1BatchUpdateDetectorErrorEntries = (output, context
1474
1168
  }
1475
1169
  return deserializeAws_restJson1BatchUpdateDetectorErrorEntry(entry, context);
1476
1170
  });
1171
+ return retVal;
1477
1172
  };
1478
1173
  const deserializeAws_restJson1BatchUpdateDetectorErrorEntry = (output, context) => {
1479
1174
  return {
@@ -1535,7 +1230,7 @@ const deserializeAws_restJson1DetectorStateSummary = (output, context) => {
1535
1230
  };
1536
1231
  };
1537
1232
  const deserializeAws_restJson1DetectorSummaries = (output, context) => {
1538
- return (output || [])
1233
+ const retVal = (output || [])
1539
1234
  .filter((e) => e != null)
1540
1235
  .map((entry) => {
1541
1236
  if (entry === null) {
@@ -1543,6 +1238,7 @@ const deserializeAws_restJson1DetectorSummaries = (output, context) => {
1543
1238
  }
1544
1239
  return deserializeAws_restJson1DetectorSummary(entry, context);
1545
1240
  });
1241
+ return retVal;
1546
1242
  };
1547
1243
  const deserializeAws_restJson1DetectorSummary = (output, context) => {
1548
1244
  return {
@@ -1617,7 +1313,7 @@ const deserializeAws_restJson1Timer = (output, context) => {
1617
1313
  };
1618
1314
  };
1619
1315
  const deserializeAws_restJson1Timers = (output, context) => {
1620
- return (output || [])
1316
+ const retVal = (output || [])
1621
1317
  .filter((e) => e != null)
1622
1318
  .map((entry) => {
1623
1319
  if (entry === null) {
@@ -1625,6 +1321,7 @@ const deserializeAws_restJson1Timers = (output, context) => {
1625
1321
  }
1626
1322
  return deserializeAws_restJson1Timer(entry, context);
1627
1323
  });
1324
+ return retVal;
1628
1325
  };
1629
1326
  const deserializeAws_restJson1Variable = (output, context) => {
1630
1327
  return {
@@ -1633,7 +1330,7 @@ const deserializeAws_restJson1Variable = (output, context) => {
1633
1330
  };
1634
1331
  };
1635
1332
  const deserializeAws_restJson1Variables = (output, context) => {
1636
- return (output || [])
1333
+ const retVal = (output || [])
1637
1334
  .filter((e) => e != null)
1638
1335
  .map((entry) => {
1639
1336
  if (entry === null) {
@@ -1641,6 +1338,7 @@ const deserializeAws_restJson1Variables = (output, context) => {
1641
1338
  }
1642
1339
  return deserializeAws_restJson1Variable(entry, context);
1643
1340
  });
1341
+ return retVal;
1644
1342
  };
1645
1343
  const deserializeMetadata = (output) => {
1646
1344
  var _a;