@aws-sdk/client-codestar-notifications 3.141.0 → 3.150.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.
@@ -314,15 +314,14 @@ const deserializeAws_restJson1CreateNotificationRuleCommand = async (output, con
314
314
  if (output.statusCode !== 200 && output.statusCode >= 300) {
315
315
  return deserializeAws_restJson1CreateNotificationRuleCommandError(output, context);
316
316
  }
317
- const contents = {
317
+ const contents = map({
318
318
  $metadata: deserializeMetadata(output),
319
- Arn: undefined,
320
- };
319
+ });
321
320
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
322
- if (data.Arn !== undefined && data.Arn !== null) {
321
+ if (data.Arn != null) {
323
322
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
324
323
  }
325
- return Promise.resolve(contents);
324
+ return contents;
326
325
  };
327
326
  exports.deserializeAws_restJson1CreateNotificationRuleCommand = deserializeAws_restJson1CreateNotificationRuleCommand;
328
327
  const deserializeAws_restJson1CreateNotificationRuleCommandError = async (output, context) => {
@@ -330,7 +329,6 @@ const deserializeAws_restJson1CreateNotificationRuleCommandError = async (output
330
329
  ...output,
331
330
  body: await parseBody(output.body, context),
332
331
  };
333
- let response;
334
332
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
335
333
  switch (errorCode) {
336
334
  case "AccessDeniedException":
@@ -353,29 +351,26 @@ const deserializeAws_restJson1CreateNotificationRuleCommandError = async (output
353
351
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
354
352
  default:
355
353
  const parsedBody = parsedOutput.body;
356
- const $metadata = deserializeMetadata(output);
357
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
358
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
359
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
360
- $fault: "client",
361
- $metadata,
354
+ (0, smithy_client_1.throwDefaultError)({
355
+ output,
356
+ parsedBody,
357
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
358
+ errorCode,
362
359
  });
363
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
364
360
  }
365
361
  };
366
362
  const deserializeAws_restJson1DeleteNotificationRuleCommand = async (output, context) => {
367
363
  if (output.statusCode !== 200 && output.statusCode >= 300) {
368
364
  return deserializeAws_restJson1DeleteNotificationRuleCommandError(output, context);
369
365
  }
370
- const contents = {
366
+ const contents = map({
371
367
  $metadata: deserializeMetadata(output),
372
- Arn: undefined,
373
- };
368
+ });
374
369
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
375
- if (data.Arn !== undefined && data.Arn !== null) {
370
+ if (data.Arn != null) {
376
371
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
377
372
  }
378
- return Promise.resolve(contents);
373
+ return contents;
379
374
  };
380
375
  exports.deserializeAws_restJson1DeleteNotificationRuleCommand = deserializeAws_restJson1DeleteNotificationRuleCommand;
381
376
  const deserializeAws_restJson1DeleteNotificationRuleCommandError = async (output, context) => {
@@ -383,7 +378,6 @@ const deserializeAws_restJson1DeleteNotificationRuleCommandError = async (output
383
378
  ...output,
384
379
  body: await parseBody(output.body, context),
385
380
  };
386
- let response;
387
381
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
388
382
  switch (errorCode) {
389
383
  case "ConcurrentModificationException":
@@ -397,25 +391,23 @@ const deserializeAws_restJson1DeleteNotificationRuleCommandError = async (output
397
391
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
398
392
  default:
399
393
  const parsedBody = parsedOutput.body;
400
- const $metadata = deserializeMetadata(output);
401
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
402
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
403
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
404
- $fault: "client",
405
- $metadata,
394
+ (0, smithy_client_1.throwDefaultError)({
395
+ output,
396
+ parsedBody,
397
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
398
+ errorCode,
406
399
  });
407
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
408
400
  }
409
401
  };
410
402
  const deserializeAws_restJson1DeleteTargetCommand = async (output, context) => {
411
403
  if (output.statusCode !== 200 && output.statusCode >= 300) {
412
404
  return deserializeAws_restJson1DeleteTargetCommandError(output, context);
413
405
  }
414
- const contents = {
406
+ const contents = map({
415
407
  $metadata: deserializeMetadata(output),
416
- };
408
+ });
417
409
  await collectBody(output.body, context);
418
- return Promise.resolve(contents);
410
+ return contents;
419
411
  };
420
412
  exports.deserializeAws_restJson1DeleteTargetCommand = deserializeAws_restJson1DeleteTargetCommand;
421
413
  const deserializeAws_restJson1DeleteTargetCommandError = async (output, context) => {
@@ -423,7 +415,6 @@ const deserializeAws_restJson1DeleteTargetCommandError = async (output, context)
423
415
  ...output,
424
416
  body: await parseBody(output.body, context),
425
417
  };
426
- let response;
427
418
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
428
419
  switch (errorCode) {
429
420
  case "ValidationException":
@@ -431,69 +422,56 @@ const deserializeAws_restJson1DeleteTargetCommandError = async (output, context)
431
422
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
432
423
  default:
433
424
  const parsedBody = parsedOutput.body;
434
- const $metadata = deserializeMetadata(output);
435
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
436
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
437
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
438
- $fault: "client",
439
- $metadata,
425
+ (0, smithy_client_1.throwDefaultError)({
426
+ output,
427
+ parsedBody,
428
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
429
+ errorCode,
440
430
  });
441
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
442
431
  }
443
432
  };
444
433
  const deserializeAws_restJson1DescribeNotificationRuleCommand = async (output, context) => {
445
434
  if (output.statusCode !== 200 && output.statusCode >= 300) {
446
435
  return deserializeAws_restJson1DescribeNotificationRuleCommandError(output, context);
447
436
  }
448
- const contents = {
437
+ const contents = map({
449
438
  $metadata: deserializeMetadata(output),
450
- Arn: undefined,
451
- CreatedBy: undefined,
452
- CreatedTimestamp: undefined,
453
- DetailType: undefined,
454
- EventTypes: undefined,
455
- LastModifiedTimestamp: undefined,
456
- Name: undefined,
457
- Resource: undefined,
458
- Status: undefined,
459
- Tags: undefined,
460
- Targets: undefined,
461
- };
439
+ });
462
440
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
463
- if (data.Arn !== undefined && data.Arn !== null) {
441
+ if (data.Arn != null) {
464
442
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
465
443
  }
466
- if (data.CreatedBy !== undefined && data.CreatedBy !== null) {
444
+ if (data.CreatedBy != null) {
467
445
  contents.CreatedBy = (0, smithy_client_1.expectString)(data.CreatedBy);
468
446
  }
469
- if (data.CreatedTimestamp !== undefined && data.CreatedTimestamp !== null) {
447
+ if (data.CreatedTimestamp != null) {
470
448
  contents.CreatedTimestamp = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.CreatedTimestamp)));
471
449
  }
472
- if (data.DetailType !== undefined && data.DetailType !== null) {
450
+ if (data.DetailType != null) {
473
451
  contents.DetailType = (0, smithy_client_1.expectString)(data.DetailType);
474
452
  }
475
- if (data.EventTypes !== undefined && data.EventTypes !== null) {
453
+ if (data.EventTypes != null) {
476
454
  contents.EventTypes = deserializeAws_restJson1EventTypeBatch(data.EventTypes, context);
477
455
  }
478
- if (data.LastModifiedTimestamp !== undefined && data.LastModifiedTimestamp !== null) {
456
+ if (data.LastModifiedTimestamp != null) {
479
457
  contents.LastModifiedTimestamp = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.LastModifiedTimestamp)));
480
458
  }
481
- if (data.Name !== undefined && data.Name !== null) {
459
+ if (data.Name != null) {
482
460
  contents.Name = (0, smithy_client_1.expectString)(data.Name);
483
461
  }
484
- if (data.Resource !== undefined && data.Resource !== null) {
462
+ if (data.Resource != null) {
485
463
  contents.Resource = (0, smithy_client_1.expectString)(data.Resource);
486
464
  }
487
- if (data.Status !== undefined && data.Status !== null) {
465
+ if (data.Status != null) {
488
466
  contents.Status = (0, smithy_client_1.expectString)(data.Status);
489
467
  }
490
- if (data.Tags !== undefined && data.Tags !== null) {
468
+ if (data.Tags != null) {
491
469
  contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
492
470
  }
493
- if (data.Targets !== undefined && data.Targets !== null) {
471
+ if (data.Targets != null) {
494
472
  contents.Targets = deserializeAws_restJson1TargetsBatch(data.Targets, context);
495
473
  }
496
- return Promise.resolve(contents);
474
+ return contents;
497
475
  };
498
476
  exports.deserializeAws_restJson1DescribeNotificationRuleCommand = deserializeAws_restJson1DescribeNotificationRuleCommand;
499
477
  const deserializeAws_restJson1DescribeNotificationRuleCommandError = async (output, context) => {
@@ -501,7 +479,6 @@ const deserializeAws_restJson1DescribeNotificationRuleCommandError = async (outp
501
479
  ...output,
502
480
  body: await parseBody(output.body, context),
503
481
  };
504
- let response;
505
482
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
506
483
  switch (errorCode) {
507
484
  case "ResourceNotFoundException":
@@ -512,33 +489,29 @@ const deserializeAws_restJson1DescribeNotificationRuleCommandError = async (outp
512
489
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
513
490
  default:
514
491
  const parsedBody = parsedOutput.body;
515
- const $metadata = deserializeMetadata(output);
516
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
517
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
518
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
519
- $fault: "client",
520
- $metadata,
492
+ (0, smithy_client_1.throwDefaultError)({
493
+ output,
494
+ parsedBody,
495
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
496
+ errorCode,
521
497
  });
522
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
523
498
  }
524
499
  };
525
500
  const deserializeAws_restJson1ListEventTypesCommand = async (output, context) => {
526
501
  if (output.statusCode !== 200 && output.statusCode >= 300) {
527
502
  return deserializeAws_restJson1ListEventTypesCommandError(output, context);
528
503
  }
529
- const contents = {
504
+ const contents = map({
530
505
  $metadata: deserializeMetadata(output),
531
- EventTypes: undefined,
532
- NextToken: undefined,
533
- };
506
+ });
534
507
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
535
- if (data.EventTypes !== undefined && data.EventTypes !== null) {
508
+ if (data.EventTypes != null) {
536
509
  contents.EventTypes = deserializeAws_restJson1EventTypeBatch(data.EventTypes, context);
537
510
  }
538
- if (data.NextToken !== undefined && data.NextToken !== null) {
511
+ if (data.NextToken != null) {
539
512
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
540
513
  }
541
- return Promise.resolve(contents);
514
+ return contents;
542
515
  };
543
516
  exports.deserializeAws_restJson1ListEventTypesCommand = deserializeAws_restJson1ListEventTypesCommand;
544
517
  const deserializeAws_restJson1ListEventTypesCommandError = async (output, context) => {
@@ -546,7 +519,6 @@ const deserializeAws_restJson1ListEventTypesCommandError = async (output, contex
546
519
  ...output,
547
520
  body: await parseBody(output.body, context),
548
521
  };
549
- let response;
550
522
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
551
523
  switch (errorCode) {
552
524
  case "InvalidNextTokenException":
@@ -557,33 +529,29 @@ const deserializeAws_restJson1ListEventTypesCommandError = async (output, contex
557
529
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
558
530
  default:
559
531
  const parsedBody = parsedOutput.body;
560
- const $metadata = deserializeMetadata(output);
561
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
562
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
563
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
564
- $fault: "client",
565
- $metadata,
532
+ (0, smithy_client_1.throwDefaultError)({
533
+ output,
534
+ parsedBody,
535
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
536
+ errorCode,
566
537
  });
567
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
568
538
  }
569
539
  };
570
540
  const deserializeAws_restJson1ListNotificationRulesCommand = async (output, context) => {
571
541
  if (output.statusCode !== 200 && output.statusCode >= 300) {
572
542
  return deserializeAws_restJson1ListNotificationRulesCommandError(output, context);
573
543
  }
574
- const contents = {
544
+ const contents = map({
575
545
  $metadata: deserializeMetadata(output),
576
- NextToken: undefined,
577
- NotificationRules: undefined,
578
- };
546
+ });
579
547
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
580
- if (data.NextToken !== undefined && data.NextToken !== null) {
548
+ if (data.NextToken != null) {
581
549
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
582
550
  }
583
- if (data.NotificationRules !== undefined && data.NotificationRules !== null) {
551
+ if (data.NotificationRules != null) {
584
552
  contents.NotificationRules = deserializeAws_restJson1NotificationRuleBatch(data.NotificationRules, context);
585
553
  }
586
- return Promise.resolve(contents);
554
+ return contents;
587
555
  };
588
556
  exports.deserializeAws_restJson1ListNotificationRulesCommand = deserializeAws_restJson1ListNotificationRulesCommand;
589
557
  const deserializeAws_restJson1ListNotificationRulesCommandError = async (output, context) => {
@@ -591,7 +559,6 @@ const deserializeAws_restJson1ListNotificationRulesCommandError = async (output,
591
559
  ...output,
592
560
  body: await parseBody(output.body, context),
593
561
  };
594
- let response;
595
562
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
596
563
  switch (errorCode) {
597
564
  case "InvalidNextTokenException":
@@ -602,29 +569,26 @@ const deserializeAws_restJson1ListNotificationRulesCommandError = async (output,
602
569
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
603
570
  default:
604
571
  const parsedBody = parsedOutput.body;
605
- const $metadata = deserializeMetadata(output);
606
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
607
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
608
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
609
- $fault: "client",
610
- $metadata,
572
+ (0, smithy_client_1.throwDefaultError)({
573
+ output,
574
+ parsedBody,
575
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
576
+ errorCode,
611
577
  });
612
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
613
578
  }
614
579
  };
615
580
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
616
581
  if (output.statusCode !== 200 && output.statusCode >= 300) {
617
582
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
618
583
  }
619
- const contents = {
584
+ const contents = map({
620
585
  $metadata: deserializeMetadata(output),
621
- Tags: undefined,
622
- };
586
+ });
623
587
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
624
- if (data.Tags !== undefined && data.Tags !== null) {
588
+ if (data.Tags != null) {
625
589
  contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
626
590
  }
627
- return Promise.resolve(contents);
591
+ return contents;
628
592
  };
629
593
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
630
594
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -632,7 +596,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
632
596
  ...output,
633
597
  body: await parseBody(output.body, context),
634
598
  };
635
- let response;
636
599
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
637
600
  switch (errorCode) {
638
601
  case "ResourceNotFoundException":
@@ -643,33 +606,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
643
606
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
644
607
  default:
645
608
  const parsedBody = parsedOutput.body;
646
- const $metadata = deserializeMetadata(output);
647
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
648
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
649
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
650
- $fault: "client",
651
- $metadata,
609
+ (0, smithy_client_1.throwDefaultError)({
610
+ output,
611
+ parsedBody,
612
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
613
+ errorCode,
652
614
  });
653
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
654
615
  }
655
616
  };
656
617
  const deserializeAws_restJson1ListTargetsCommand = async (output, context) => {
657
618
  if (output.statusCode !== 200 && output.statusCode >= 300) {
658
619
  return deserializeAws_restJson1ListTargetsCommandError(output, context);
659
620
  }
660
- const contents = {
621
+ const contents = map({
661
622
  $metadata: deserializeMetadata(output),
662
- NextToken: undefined,
663
- Targets: undefined,
664
- };
623
+ });
665
624
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
666
- if (data.NextToken !== undefined && data.NextToken !== null) {
625
+ if (data.NextToken != null) {
667
626
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
668
627
  }
669
- if (data.Targets !== undefined && data.Targets !== null) {
628
+ if (data.Targets != null) {
670
629
  contents.Targets = deserializeAws_restJson1TargetsBatch(data.Targets, context);
671
630
  }
672
- return Promise.resolve(contents);
631
+ return contents;
673
632
  };
674
633
  exports.deserializeAws_restJson1ListTargetsCommand = deserializeAws_restJson1ListTargetsCommand;
675
634
  const deserializeAws_restJson1ListTargetsCommandError = async (output, context) => {
@@ -677,7 +636,6 @@ const deserializeAws_restJson1ListTargetsCommandError = async (output, context)
677
636
  ...output,
678
637
  body: await parseBody(output.body, context),
679
638
  };
680
- let response;
681
639
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
682
640
  switch (errorCode) {
683
641
  case "InvalidNextTokenException":
@@ -688,29 +646,26 @@ const deserializeAws_restJson1ListTargetsCommandError = async (output, context)
688
646
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
689
647
  default:
690
648
  const parsedBody = parsedOutput.body;
691
- const $metadata = deserializeMetadata(output);
692
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
693
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
694
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
695
- $fault: "client",
696
- $metadata,
649
+ (0, smithy_client_1.throwDefaultError)({
650
+ output,
651
+ parsedBody,
652
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
653
+ errorCode,
697
654
  });
698
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
699
655
  }
700
656
  };
701
657
  const deserializeAws_restJson1SubscribeCommand = async (output, context) => {
702
658
  if (output.statusCode !== 200 && output.statusCode >= 300) {
703
659
  return deserializeAws_restJson1SubscribeCommandError(output, context);
704
660
  }
705
- const contents = {
661
+ const contents = map({
706
662
  $metadata: deserializeMetadata(output),
707
- Arn: undefined,
708
- };
663
+ });
709
664
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
710
- if (data.Arn !== undefined && data.Arn !== null) {
665
+ if (data.Arn != null) {
711
666
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
712
667
  }
713
- return Promise.resolve(contents);
668
+ return contents;
714
669
  };
715
670
  exports.deserializeAws_restJson1SubscribeCommand = deserializeAws_restJson1SubscribeCommand;
716
671
  const deserializeAws_restJson1SubscribeCommandError = async (output, context) => {
@@ -718,7 +673,6 @@ const deserializeAws_restJson1SubscribeCommandError = async (output, context) =>
718
673
  ...output,
719
674
  body: await parseBody(output.body, context),
720
675
  };
721
- let response;
722
676
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
723
677
  switch (errorCode) {
724
678
  case "ResourceNotFoundException":
@@ -729,29 +683,26 @@ const deserializeAws_restJson1SubscribeCommandError = async (output, context) =>
729
683
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
730
684
  default:
731
685
  const parsedBody = parsedOutput.body;
732
- const $metadata = deserializeMetadata(output);
733
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
734
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
735
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
736
- $fault: "client",
737
- $metadata,
686
+ (0, smithy_client_1.throwDefaultError)({
687
+ output,
688
+ parsedBody,
689
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
690
+ errorCode,
738
691
  });
739
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
740
692
  }
741
693
  };
742
694
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
743
695
  if (output.statusCode !== 200 && output.statusCode >= 300) {
744
696
  return deserializeAws_restJson1TagResourceCommandError(output, context);
745
697
  }
746
- const contents = {
698
+ const contents = map({
747
699
  $metadata: deserializeMetadata(output),
748
- Tags: undefined,
749
- };
700
+ });
750
701
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
751
- if (data.Tags !== undefined && data.Tags !== null) {
702
+ if (data.Tags != null) {
752
703
  contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
753
704
  }
754
- return Promise.resolve(contents);
705
+ return contents;
755
706
  };
756
707
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
757
708
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -759,7 +710,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
759
710
  ...output,
760
711
  body: await parseBody(output.body, context),
761
712
  };
762
- let response;
763
713
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
764
714
  switch (errorCode) {
765
715
  case "ConcurrentModificationException":
@@ -773,29 +723,26 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
773
723
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
774
724
  default:
775
725
  const parsedBody = parsedOutput.body;
776
- const $metadata = deserializeMetadata(output);
777
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
778
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
779
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
780
- $fault: "client",
781
- $metadata,
726
+ (0, smithy_client_1.throwDefaultError)({
727
+ output,
728
+ parsedBody,
729
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
730
+ errorCode,
782
731
  });
783
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
784
732
  }
785
733
  };
786
734
  const deserializeAws_restJson1UnsubscribeCommand = async (output, context) => {
787
735
  if (output.statusCode !== 200 && output.statusCode >= 300) {
788
736
  return deserializeAws_restJson1UnsubscribeCommandError(output, context);
789
737
  }
790
- const contents = {
738
+ const contents = map({
791
739
  $metadata: deserializeMetadata(output),
792
- Arn: undefined,
793
- };
740
+ });
794
741
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
795
- if (data.Arn !== undefined && data.Arn !== null) {
742
+ if (data.Arn != null) {
796
743
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
797
744
  }
798
- return Promise.resolve(contents);
745
+ return contents;
799
746
  };
800
747
  exports.deserializeAws_restJson1UnsubscribeCommand = deserializeAws_restJson1UnsubscribeCommand;
801
748
  const deserializeAws_restJson1UnsubscribeCommandError = async (output, context) => {
@@ -803,7 +750,6 @@ const deserializeAws_restJson1UnsubscribeCommandError = async (output, context)
803
750
  ...output,
804
751
  body: await parseBody(output.body, context),
805
752
  };
806
- let response;
807
753
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
808
754
  switch (errorCode) {
809
755
  case "ValidationException":
@@ -811,25 +757,23 @@ const deserializeAws_restJson1UnsubscribeCommandError = async (output, context)
811
757
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
812
758
  default:
813
759
  const parsedBody = parsedOutput.body;
814
- const $metadata = deserializeMetadata(output);
815
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
816
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
817
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
818
- $fault: "client",
819
- $metadata,
760
+ (0, smithy_client_1.throwDefaultError)({
761
+ output,
762
+ parsedBody,
763
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
764
+ errorCode,
820
765
  });
821
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
822
766
  }
823
767
  };
824
768
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
825
769
  if (output.statusCode !== 200 && output.statusCode >= 300) {
826
770
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
827
771
  }
828
- const contents = {
772
+ const contents = map({
829
773
  $metadata: deserializeMetadata(output),
830
- };
774
+ });
831
775
  await collectBody(output.body, context);
832
- return Promise.resolve(contents);
776
+ return contents;
833
777
  };
834
778
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
835
779
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -837,7 +781,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
837
781
  ...output,
838
782
  body: await parseBody(output.body, context),
839
783
  };
840
- let response;
841
784
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
842
785
  switch (errorCode) {
843
786
  case "ConcurrentModificationException":
@@ -851,25 +794,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
851
794
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
852
795
  default:
853
796
  const parsedBody = parsedOutput.body;
854
- const $metadata = deserializeMetadata(output);
855
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
856
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
857
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
858
- $fault: "client",
859
- $metadata,
797
+ (0, smithy_client_1.throwDefaultError)({
798
+ output,
799
+ parsedBody,
800
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
801
+ errorCode,
860
802
  });
861
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
862
803
  }
863
804
  };
864
805
  const deserializeAws_restJson1UpdateNotificationRuleCommand = async (output, context) => {
865
806
  if (output.statusCode !== 200 && output.statusCode >= 300) {
866
807
  return deserializeAws_restJson1UpdateNotificationRuleCommandError(output, context);
867
808
  }
868
- const contents = {
809
+ const contents = map({
869
810
  $metadata: deserializeMetadata(output),
870
- };
811
+ });
871
812
  await collectBody(output.body, context);
872
- return Promise.resolve(contents);
813
+ return contents;
873
814
  };
874
815
  exports.deserializeAws_restJson1UpdateNotificationRuleCommand = deserializeAws_restJson1UpdateNotificationRuleCommand;
875
816
  const deserializeAws_restJson1UpdateNotificationRuleCommandError = async (output, context) => {
@@ -877,7 +818,6 @@ const deserializeAws_restJson1UpdateNotificationRuleCommandError = async (output
877
818
  ...output,
878
819
  body: await parseBody(output.body, context),
879
820
  };
880
- let response;
881
821
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
882
822
  switch (errorCode) {
883
823
  case "ResourceNotFoundException":
@@ -888,20 +828,19 @@ const deserializeAws_restJson1UpdateNotificationRuleCommandError = async (output
888
828
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
889
829
  default:
890
830
  const parsedBody = parsedOutput.body;
891
- const $metadata = deserializeMetadata(output);
892
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
893
- response = new CodestarNotificationsServiceException_1.CodestarNotificationsServiceException({
894
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
895
- $fault: "client",
896
- $metadata,
831
+ (0, smithy_client_1.throwDefaultError)({
832
+ output,
833
+ parsedBody,
834
+ exceptionCtor: CodestarNotificationsServiceException_1.CodestarNotificationsServiceException,
835
+ errorCode,
897
836
  });
898
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
899
837
  }
900
838
  };
839
+ const map = smithy_client_1.map;
901
840
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
902
- const contents = {};
841
+ const contents = map({});
903
842
  const data = parsedOutput.body;
904
- if (data.Message !== undefined && data.Message !== null) {
843
+ if (data.Message != null) {
905
844
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
906
845
  }
907
846
  const exception = new models_0_1.AccessDeniedException({
@@ -911,9 +850,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
911
850
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
912
851
  };
913
852
  const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
914
- const contents = {};
853
+ const contents = map({});
915
854
  const data = parsedOutput.body;
916
- if (data.Message !== undefined && data.Message !== null) {
855
+ if (data.Message != null) {
917
856
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
918
857
  }
919
858
  const exception = new models_0_1.ConcurrentModificationException({
@@ -923,9 +862,9 @@ const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (p
923
862
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
924
863
  };
925
864
  const deserializeAws_restJson1ConfigurationExceptionResponse = async (parsedOutput, context) => {
926
- const contents = {};
865
+ const contents = map({});
927
866
  const data = parsedOutput.body;
928
- if (data.Message !== undefined && data.Message !== null) {
867
+ if (data.Message != null) {
929
868
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
930
869
  }
931
870
  const exception = new models_0_1.ConfigurationException({
@@ -935,9 +874,9 @@ const deserializeAws_restJson1ConfigurationExceptionResponse = async (parsedOutp
935
874
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
936
875
  };
937
876
  const deserializeAws_restJson1InvalidNextTokenExceptionResponse = async (parsedOutput, context) => {
938
- const contents = {};
877
+ const contents = map({});
939
878
  const data = parsedOutput.body;
940
- if (data.Message !== undefined && data.Message !== null) {
879
+ if (data.Message != null) {
941
880
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
942
881
  }
943
882
  const exception = new models_0_1.InvalidNextTokenException({
@@ -947,9 +886,9 @@ const deserializeAws_restJson1InvalidNextTokenExceptionResponse = async (parsedO
947
886
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
948
887
  };
949
888
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
950
- const contents = {};
889
+ const contents = map({});
951
890
  const data = parsedOutput.body;
952
- if (data.Message !== undefined && data.Message !== null) {
891
+ if (data.Message != null) {
953
892
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
954
893
  }
955
894
  const exception = new models_0_1.LimitExceededException({
@@ -959,9 +898,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
959
898
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
960
899
  };
961
900
  const deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse = async (parsedOutput, context) => {
962
- const contents = {};
901
+ const contents = map({});
963
902
  const data = parsedOutput.body;
964
- if (data.Message !== undefined && data.Message !== null) {
903
+ if (data.Message != null) {
965
904
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
966
905
  }
967
906
  const exception = new models_0_1.ResourceAlreadyExistsException({
@@ -971,9 +910,9 @@ const deserializeAws_restJson1ResourceAlreadyExistsExceptionResponse = async (pa
971
910
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
972
911
  };
973
912
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
974
- const contents = {};
913
+ const contents = map({});
975
914
  const data = parsedOutput.body;
976
- if (data.Message !== undefined && data.Message !== null) {
915
+ if (data.Message != null) {
977
916
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
978
917
  }
979
918
  const exception = new models_0_1.ResourceNotFoundException({
@@ -983,9 +922,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
983
922
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
984
923
  };
985
924
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
986
- const contents = {};
925
+ const contents = map({});
987
926
  const data = parsedOutput.body;
988
- if (data.Message !== undefined && data.Message !== null) {
927
+ if (data.Message != null) {
989
928
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
990
929
  }
991
930
  const exception = new models_0_1.ValidationException({
@@ -998,9 +937,6 @@ const serializeAws_restJson1EventTypeIds = (input, context) => {
998
937
  return input
999
938
  .filter((e) => e != null)
1000
939
  .map((entry) => {
1001
- if (entry === null) {
1002
- return null;
1003
- }
1004
940
  return entry;
1005
941
  });
1006
942
  };
@@ -1014,9 +950,6 @@ const serializeAws_restJson1ListEventTypesFilters = (input, context) => {
1014
950
  return input
1015
951
  .filter((e) => e != null)
1016
952
  .map((entry) => {
1017
- if (entry === null) {
1018
- return null;
1019
- }
1020
953
  return serializeAws_restJson1ListEventTypesFilter(entry, context);
1021
954
  });
1022
955
  };
@@ -1030,9 +963,6 @@ const serializeAws_restJson1ListNotificationRulesFilters = (input, context) => {
1030
963
  return input
1031
964
  .filter((e) => e != null)
1032
965
  .map((entry) => {
1033
- if (entry === null) {
1034
- return null;
1035
- }
1036
966
  return serializeAws_restJson1ListNotificationRulesFilter(entry, context);
1037
967
  });
1038
968
  };
@@ -1046,9 +976,6 @@ const serializeAws_restJson1ListTargetsFilters = (input, context) => {
1046
976
  return input
1047
977
  .filter((e) => e != null)
1048
978
  .map((entry) => {
1049
- if (entry === null) {
1050
- return null;
1051
- }
1052
979
  return serializeAws_restJson1ListTargetsFilter(entry, context);
1053
980
  });
1054
981
  };
@@ -1056,9 +983,6 @@ const serializeAws_restJson1TagKeys = (input, context) => {
1056
983
  return input
1057
984
  .filter((e) => e != null)
1058
985
  .map((entry) => {
1059
- if (entry === null) {
1060
- return null;
1061
- }
1062
986
  return entry;
1063
987
  });
1064
988
  };
@@ -1083,9 +1007,6 @@ const serializeAws_restJson1Targets = (input, context) => {
1083
1007
  return input
1084
1008
  .filter((e) => e != null)
1085
1009
  .map((entry) => {
1086
- if (entry === null) {
1087
- return null;
1088
- }
1089
1010
  return serializeAws_restJson1Target(entry, context);
1090
1011
  });
1091
1012
  };