@aws-sdk/client-detective 3.141.0 → 3.142.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.
@@ -379,16 +379,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
379
379
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
380
380
  const headers = {};
381
381
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
382
- if (input.ResourceArn !== undefined) {
383
- const labelValue = input.ResourceArn;
384
- if (labelValue.length <= 0) {
385
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
386
- }
387
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
388
- }
389
- else {
390
- throw new Error("No value provided for input HTTP label: ResourceArn.");
391
- }
382
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
392
383
  let body;
393
384
  return new protocol_http_1.HttpRequest({
394
385
  protocol,
@@ -450,16 +441,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
450
441
  "content-type": "application/json",
451
442
  };
452
443
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
453
- if (input.ResourceArn !== undefined) {
454
- const labelValue = input.ResourceArn;
455
- if (labelValue.length <= 0) {
456
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
457
- }
458
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
459
- }
460
- else {
461
- throw new Error("No value provided for input HTTP label: ResourceArn.");
462
- }
444
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
463
445
  let body;
464
446
  body = JSON.stringify({
465
447
  ...(input.Tags != null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
@@ -479,19 +461,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
479
461
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
480
462
  const headers = {};
481
463
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
482
- if (input.ResourceArn !== undefined) {
483
- const labelValue = input.ResourceArn;
484
- if (labelValue.length <= 0) {
485
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
486
- }
487
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
488
- }
489
- else {
490
- throw new Error("No value provided for input HTTP label: ResourceArn.");
491
- }
492
- const query = {
493
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
494
- };
464
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
465
+ const query = map({
466
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
467
+ });
495
468
  let body;
496
469
  return new protocol_http_1.HttpRequest({
497
470
  protocol,
@@ -555,11 +528,11 @@ const deserializeAws_restJson1AcceptInvitationCommand = async (output, context)
555
528
  if (output.statusCode !== 200 && output.statusCode >= 300) {
556
529
  return deserializeAws_restJson1AcceptInvitationCommandError(output, context);
557
530
  }
558
- const contents = {
531
+ const contents = map({
559
532
  $metadata: deserializeMetadata(output),
560
- };
533
+ });
561
534
  await collectBody(output.body, context);
562
- return Promise.resolve(contents);
535
+ return contents;
563
536
  };
564
537
  exports.deserializeAws_restJson1AcceptInvitationCommand = deserializeAws_restJson1AcceptInvitationCommand;
565
538
  const deserializeAws_restJson1AcceptInvitationCommandError = async (output, context) => {
@@ -567,7 +540,6 @@ const deserializeAws_restJson1AcceptInvitationCommandError = async (output, cont
567
540
  ...output,
568
541
  body: await parseBody(output.body, context),
569
542
  };
570
- let response;
571
543
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
572
544
  switch (errorCode) {
573
545
  case "ConflictException":
@@ -584,33 +556,29 @@ const deserializeAws_restJson1AcceptInvitationCommandError = async (output, cont
584
556
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
585
557
  default:
586
558
  const parsedBody = parsedOutput.body;
587
- const $metadata = deserializeMetadata(output);
588
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
589
- response = new DetectiveServiceException_1.DetectiveServiceException({
590
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
591
- $fault: "client",
592
- $metadata,
559
+ (0, smithy_client_1.throwDefaultError)({
560
+ output,
561
+ parsedBody,
562
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
563
+ errorCode,
593
564
  });
594
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
595
565
  }
596
566
  };
597
567
  const deserializeAws_restJson1BatchGetGraphMemberDatasourcesCommand = async (output, context) => {
598
568
  if (output.statusCode !== 200 && output.statusCode >= 300) {
599
569
  return deserializeAws_restJson1BatchGetGraphMemberDatasourcesCommandError(output, context);
600
570
  }
601
- const contents = {
571
+ const contents = map({
602
572
  $metadata: deserializeMetadata(output),
603
- MemberDatasources: undefined,
604
- UnprocessedAccounts: undefined,
605
- };
573
+ });
606
574
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
607
- if (data.MemberDatasources !== undefined && data.MemberDatasources !== null) {
575
+ if (data.MemberDatasources != null) {
608
576
  contents.MemberDatasources = deserializeAws_restJson1MembershipDatasourcesList(data.MemberDatasources, context);
609
577
  }
610
- if (data.UnprocessedAccounts !== undefined && data.UnprocessedAccounts !== null) {
578
+ if (data.UnprocessedAccounts != null) {
611
579
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccountList(data.UnprocessedAccounts, context);
612
580
  }
613
- return Promise.resolve(contents);
581
+ return contents;
614
582
  };
615
583
  exports.deserializeAws_restJson1BatchGetGraphMemberDatasourcesCommand = deserializeAws_restJson1BatchGetGraphMemberDatasourcesCommand;
616
584
  const deserializeAws_restJson1BatchGetGraphMemberDatasourcesCommandError = async (output, context) => {
@@ -618,7 +586,6 @@ const deserializeAws_restJson1BatchGetGraphMemberDatasourcesCommandError = async
618
586
  ...output,
619
587
  body: await parseBody(output.body, context),
620
588
  };
621
- let response;
622
589
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
623
590
  switch (errorCode) {
624
591
  case "InternalServerException":
@@ -632,33 +599,29 @@ const deserializeAws_restJson1BatchGetGraphMemberDatasourcesCommandError = async
632
599
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
633
600
  default:
634
601
  const parsedBody = parsedOutput.body;
635
- const $metadata = deserializeMetadata(output);
636
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
637
- response = new DetectiveServiceException_1.DetectiveServiceException({
638
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
639
- $fault: "client",
640
- $metadata,
602
+ (0, smithy_client_1.throwDefaultError)({
603
+ output,
604
+ parsedBody,
605
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
606
+ errorCode,
641
607
  });
642
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
643
608
  }
644
609
  };
645
610
  const deserializeAws_restJson1BatchGetMembershipDatasourcesCommand = async (output, context) => {
646
611
  if (output.statusCode !== 200 && output.statusCode >= 300) {
647
612
  return deserializeAws_restJson1BatchGetMembershipDatasourcesCommandError(output, context);
648
613
  }
649
- const contents = {
614
+ const contents = map({
650
615
  $metadata: deserializeMetadata(output),
651
- MembershipDatasources: undefined,
652
- UnprocessedGraphs: undefined,
653
- };
616
+ });
654
617
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
655
- if (data.MembershipDatasources !== undefined && data.MembershipDatasources !== null) {
618
+ if (data.MembershipDatasources != null) {
656
619
  contents.MembershipDatasources = deserializeAws_restJson1MembershipDatasourcesList(data.MembershipDatasources, context);
657
620
  }
658
- if (data.UnprocessedGraphs !== undefined && data.UnprocessedGraphs !== null) {
621
+ if (data.UnprocessedGraphs != null) {
659
622
  contents.UnprocessedGraphs = deserializeAws_restJson1UnprocessedGraphList(data.UnprocessedGraphs, context);
660
623
  }
661
- return Promise.resolve(contents);
624
+ return contents;
662
625
  };
663
626
  exports.deserializeAws_restJson1BatchGetMembershipDatasourcesCommand = deserializeAws_restJson1BatchGetMembershipDatasourcesCommand;
664
627
  const deserializeAws_restJson1BatchGetMembershipDatasourcesCommandError = async (output, context) => {
@@ -666,7 +629,6 @@ const deserializeAws_restJson1BatchGetMembershipDatasourcesCommandError = async
666
629
  ...output,
667
630
  body: await parseBody(output.body, context),
668
631
  };
669
- let response;
670
632
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
671
633
  switch (errorCode) {
672
634
  case "InternalServerException":
@@ -680,29 +642,26 @@ const deserializeAws_restJson1BatchGetMembershipDatasourcesCommandError = async
680
642
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
681
643
  default:
682
644
  const parsedBody = parsedOutput.body;
683
- const $metadata = deserializeMetadata(output);
684
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
685
- response = new DetectiveServiceException_1.DetectiveServiceException({
686
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
687
- $fault: "client",
688
- $metadata,
645
+ (0, smithy_client_1.throwDefaultError)({
646
+ output,
647
+ parsedBody,
648
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
649
+ errorCode,
689
650
  });
690
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
691
651
  }
692
652
  };
693
653
  const deserializeAws_restJson1CreateGraphCommand = async (output, context) => {
694
654
  if (output.statusCode !== 200 && output.statusCode >= 300) {
695
655
  return deserializeAws_restJson1CreateGraphCommandError(output, context);
696
656
  }
697
- const contents = {
657
+ const contents = map({
698
658
  $metadata: deserializeMetadata(output),
699
- GraphArn: undefined,
700
- };
659
+ });
701
660
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
702
- if (data.GraphArn !== undefined && data.GraphArn !== null) {
661
+ if (data.GraphArn != null) {
703
662
  contents.GraphArn = (0, smithy_client_1.expectString)(data.GraphArn);
704
663
  }
705
- return Promise.resolve(contents);
664
+ return contents;
706
665
  };
707
666
  exports.deserializeAws_restJson1CreateGraphCommand = deserializeAws_restJson1CreateGraphCommand;
708
667
  const deserializeAws_restJson1CreateGraphCommandError = async (output, context) => {
@@ -710,7 +669,6 @@ const deserializeAws_restJson1CreateGraphCommandError = async (output, context)
710
669
  ...output,
711
670
  body: await parseBody(output.body, context),
712
671
  };
713
- let response;
714
672
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
715
673
  switch (errorCode) {
716
674
  case "ConflictException":
@@ -724,33 +682,29 @@ const deserializeAws_restJson1CreateGraphCommandError = async (output, context)
724
682
  throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
725
683
  default:
726
684
  const parsedBody = parsedOutput.body;
727
- const $metadata = deserializeMetadata(output);
728
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
729
- response = new DetectiveServiceException_1.DetectiveServiceException({
730
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
731
- $fault: "client",
732
- $metadata,
685
+ (0, smithy_client_1.throwDefaultError)({
686
+ output,
687
+ parsedBody,
688
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
689
+ errorCode,
733
690
  });
734
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
735
691
  }
736
692
  };
737
693
  const deserializeAws_restJson1CreateMembersCommand = async (output, context) => {
738
694
  if (output.statusCode !== 200 && output.statusCode >= 300) {
739
695
  return deserializeAws_restJson1CreateMembersCommandError(output, context);
740
696
  }
741
- const contents = {
697
+ const contents = map({
742
698
  $metadata: deserializeMetadata(output),
743
- Members: undefined,
744
- UnprocessedAccounts: undefined,
745
- };
699
+ });
746
700
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
747
- if (data.Members !== undefined && data.Members !== null) {
701
+ if (data.Members != null) {
748
702
  contents.Members = deserializeAws_restJson1MemberDetailList(data.Members, context);
749
703
  }
750
- if (data.UnprocessedAccounts !== undefined && data.UnprocessedAccounts !== null) {
704
+ if (data.UnprocessedAccounts != null) {
751
705
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccountList(data.UnprocessedAccounts, context);
752
706
  }
753
- return Promise.resolve(contents);
707
+ return contents;
754
708
  };
755
709
  exports.deserializeAws_restJson1CreateMembersCommand = deserializeAws_restJson1CreateMembersCommand;
756
710
  const deserializeAws_restJson1CreateMembersCommandError = async (output, context) => {
@@ -758,7 +712,6 @@ const deserializeAws_restJson1CreateMembersCommandError = async (output, context
758
712
  ...output,
759
713
  body: await parseBody(output.body, context),
760
714
  };
761
- let response;
762
715
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
763
716
  switch (errorCode) {
764
717
  case "InternalServerException":
@@ -775,25 +728,23 @@ const deserializeAws_restJson1CreateMembersCommandError = async (output, context
775
728
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
776
729
  default:
777
730
  const parsedBody = parsedOutput.body;
778
- const $metadata = deserializeMetadata(output);
779
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
780
- response = new DetectiveServiceException_1.DetectiveServiceException({
781
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
782
- $fault: "client",
783
- $metadata,
731
+ (0, smithy_client_1.throwDefaultError)({
732
+ output,
733
+ parsedBody,
734
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
735
+ errorCode,
784
736
  });
785
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
786
737
  }
787
738
  };
788
739
  const deserializeAws_restJson1DeleteGraphCommand = async (output, context) => {
789
740
  if (output.statusCode !== 200 && output.statusCode >= 300) {
790
741
  return deserializeAws_restJson1DeleteGraphCommandError(output, context);
791
742
  }
792
- const contents = {
743
+ const contents = map({
793
744
  $metadata: deserializeMetadata(output),
794
- };
745
+ });
795
746
  await collectBody(output.body, context);
796
- return Promise.resolve(contents);
747
+ return contents;
797
748
  };
798
749
  exports.deserializeAws_restJson1DeleteGraphCommand = deserializeAws_restJson1DeleteGraphCommand;
799
750
  const deserializeAws_restJson1DeleteGraphCommandError = async (output, context) => {
@@ -801,7 +752,6 @@ const deserializeAws_restJson1DeleteGraphCommandError = async (output, context)
801
752
  ...output,
802
753
  body: await parseBody(output.body, context),
803
754
  };
804
- let response;
805
755
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
806
756
  switch (errorCode) {
807
757
  case "InternalServerException":
@@ -815,33 +765,29 @@ const deserializeAws_restJson1DeleteGraphCommandError = async (output, context)
815
765
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
816
766
  default:
817
767
  const parsedBody = parsedOutput.body;
818
- const $metadata = deserializeMetadata(output);
819
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
820
- response = new DetectiveServiceException_1.DetectiveServiceException({
821
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
822
- $fault: "client",
823
- $metadata,
768
+ (0, smithy_client_1.throwDefaultError)({
769
+ output,
770
+ parsedBody,
771
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
772
+ errorCode,
824
773
  });
825
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
826
774
  }
827
775
  };
828
776
  const deserializeAws_restJson1DeleteMembersCommand = async (output, context) => {
829
777
  if (output.statusCode !== 200 && output.statusCode >= 300) {
830
778
  return deserializeAws_restJson1DeleteMembersCommandError(output, context);
831
779
  }
832
- const contents = {
780
+ const contents = map({
833
781
  $metadata: deserializeMetadata(output),
834
- AccountIds: undefined,
835
- UnprocessedAccounts: undefined,
836
- };
782
+ });
837
783
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
838
- if (data.AccountIds !== undefined && data.AccountIds !== null) {
784
+ if (data.AccountIds != null) {
839
785
  contents.AccountIds = deserializeAws_restJson1AccountIdList(data.AccountIds, context);
840
786
  }
841
- if (data.UnprocessedAccounts !== undefined && data.UnprocessedAccounts !== null) {
787
+ if (data.UnprocessedAccounts != null) {
842
788
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccountList(data.UnprocessedAccounts, context);
843
789
  }
844
- return Promise.resolve(contents);
790
+ return contents;
845
791
  };
846
792
  exports.deserializeAws_restJson1DeleteMembersCommand = deserializeAws_restJson1DeleteMembersCommand;
847
793
  const deserializeAws_restJson1DeleteMembersCommandError = async (output, context) => {
@@ -849,7 +795,6 @@ const deserializeAws_restJson1DeleteMembersCommandError = async (output, context
849
795
  ...output,
850
796
  body: await parseBody(output.body, context),
851
797
  };
852
- let response;
853
798
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
854
799
  switch (errorCode) {
855
800
  case "ConflictException":
@@ -866,29 +811,26 @@ const deserializeAws_restJson1DeleteMembersCommandError = async (output, context
866
811
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
867
812
  default:
868
813
  const parsedBody = parsedOutput.body;
869
- const $metadata = deserializeMetadata(output);
870
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
871
- response = new DetectiveServiceException_1.DetectiveServiceException({
872
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
873
- $fault: "client",
874
- $metadata,
814
+ (0, smithy_client_1.throwDefaultError)({
815
+ output,
816
+ parsedBody,
817
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
818
+ errorCode,
875
819
  });
876
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
877
820
  }
878
821
  };
879
822
  const deserializeAws_restJson1DescribeOrganizationConfigurationCommand = async (output, context) => {
880
823
  if (output.statusCode !== 200 && output.statusCode >= 300) {
881
824
  return deserializeAws_restJson1DescribeOrganizationConfigurationCommandError(output, context);
882
825
  }
883
- const contents = {
826
+ const contents = map({
884
827
  $metadata: deserializeMetadata(output),
885
- AutoEnable: undefined,
886
- };
828
+ });
887
829
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
888
- if (data.AutoEnable !== undefined && data.AutoEnable !== null) {
830
+ if (data.AutoEnable != null) {
889
831
  contents.AutoEnable = (0, smithy_client_1.expectBoolean)(data.AutoEnable);
890
832
  }
891
- return Promise.resolve(contents);
833
+ return contents;
892
834
  };
893
835
  exports.deserializeAws_restJson1DescribeOrganizationConfigurationCommand = deserializeAws_restJson1DescribeOrganizationConfigurationCommand;
894
836
  const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = async (output, context) => {
@@ -896,7 +838,6 @@ const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = as
896
838
  ...output,
897
839
  body: await parseBody(output.body, context),
898
840
  };
899
- let response;
900
841
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
901
842
  switch (errorCode) {
902
843
  case "InternalServerException":
@@ -910,25 +851,23 @@ const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = as
910
851
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
911
852
  default:
912
853
  const parsedBody = parsedOutput.body;
913
- const $metadata = deserializeMetadata(output);
914
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
915
- response = new DetectiveServiceException_1.DetectiveServiceException({
916
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
917
- $fault: "client",
918
- $metadata,
854
+ (0, smithy_client_1.throwDefaultError)({
855
+ output,
856
+ parsedBody,
857
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
858
+ errorCode,
919
859
  });
920
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
921
860
  }
922
861
  };
923
862
  const deserializeAws_restJson1DisableOrganizationAdminAccountCommand = async (output, context) => {
924
863
  if (output.statusCode !== 200 && output.statusCode >= 300) {
925
864
  return deserializeAws_restJson1DisableOrganizationAdminAccountCommandError(output, context);
926
865
  }
927
- const contents = {
866
+ const contents = map({
928
867
  $metadata: deserializeMetadata(output),
929
- };
868
+ });
930
869
  await collectBody(output.body, context);
931
- return Promise.resolve(contents);
870
+ return contents;
932
871
  };
933
872
  exports.deserializeAws_restJson1DisableOrganizationAdminAccountCommand = deserializeAws_restJson1DisableOrganizationAdminAccountCommand;
934
873
  const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = async (output, context) => {
@@ -936,7 +875,6 @@ const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = asyn
936
875
  ...output,
937
876
  body: await parseBody(output.body, context),
938
877
  };
939
- let response;
940
878
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
941
879
  switch (errorCode) {
942
880
  case "InternalServerException":
@@ -950,25 +888,23 @@ const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = asyn
950
888
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
951
889
  default:
952
890
  const parsedBody = parsedOutput.body;
953
- const $metadata = deserializeMetadata(output);
954
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
955
- response = new DetectiveServiceException_1.DetectiveServiceException({
956
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
957
- $fault: "client",
958
- $metadata,
891
+ (0, smithy_client_1.throwDefaultError)({
892
+ output,
893
+ parsedBody,
894
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
895
+ errorCode,
959
896
  });
960
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
961
897
  }
962
898
  };
963
899
  const deserializeAws_restJson1DisassociateMembershipCommand = async (output, context) => {
964
900
  if (output.statusCode !== 200 && output.statusCode >= 300) {
965
901
  return deserializeAws_restJson1DisassociateMembershipCommandError(output, context);
966
902
  }
967
- const contents = {
903
+ const contents = map({
968
904
  $metadata: deserializeMetadata(output),
969
- };
905
+ });
970
906
  await collectBody(output.body, context);
971
- return Promise.resolve(contents);
907
+ return contents;
972
908
  };
973
909
  exports.deserializeAws_restJson1DisassociateMembershipCommand = deserializeAws_restJson1DisassociateMembershipCommand;
974
910
  const deserializeAws_restJson1DisassociateMembershipCommandError = async (output, context) => {
@@ -976,7 +912,6 @@ const deserializeAws_restJson1DisassociateMembershipCommandError = async (output
976
912
  ...output,
977
913
  body: await parseBody(output.body, context),
978
914
  };
979
- let response;
980
915
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
981
916
  switch (errorCode) {
982
917
  case "ConflictException":
@@ -993,25 +928,23 @@ const deserializeAws_restJson1DisassociateMembershipCommandError = async (output
993
928
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
994
929
  default:
995
930
  const parsedBody = parsedOutput.body;
996
- const $metadata = deserializeMetadata(output);
997
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
998
- response = new DetectiveServiceException_1.DetectiveServiceException({
999
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1000
- $fault: "client",
1001
- $metadata,
931
+ (0, smithy_client_1.throwDefaultError)({
932
+ output,
933
+ parsedBody,
934
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
935
+ errorCode,
1002
936
  });
1003
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1004
937
  }
1005
938
  };
1006
939
  const deserializeAws_restJson1EnableOrganizationAdminAccountCommand = async (output, context) => {
1007
940
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1008
941
  return deserializeAws_restJson1EnableOrganizationAdminAccountCommandError(output, context);
1009
942
  }
1010
- const contents = {
943
+ const contents = map({
1011
944
  $metadata: deserializeMetadata(output),
1012
- };
945
+ });
1013
946
  await collectBody(output.body, context);
1014
- return Promise.resolve(contents);
947
+ return contents;
1015
948
  };
1016
949
  exports.deserializeAws_restJson1EnableOrganizationAdminAccountCommand = deserializeAws_restJson1EnableOrganizationAdminAccountCommand;
1017
950
  const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async (output, context) => {
@@ -1019,7 +952,6 @@ const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async
1019
952
  ...output,
1020
953
  body: await parseBody(output.body, context),
1021
954
  };
1022
- let response;
1023
955
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1024
956
  switch (errorCode) {
1025
957
  case "InternalServerException":
@@ -1033,33 +965,29 @@ const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async
1033
965
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1034
966
  default:
1035
967
  const parsedBody = parsedOutput.body;
1036
- const $metadata = deserializeMetadata(output);
1037
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1038
- response = new DetectiveServiceException_1.DetectiveServiceException({
1039
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1040
- $fault: "client",
1041
- $metadata,
968
+ (0, smithy_client_1.throwDefaultError)({
969
+ output,
970
+ parsedBody,
971
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
972
+ errorCode,
1042
973
  });
1043
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1044
974
  }
1045
975
  };
1046
976
  const deserializeAws_restJson1GetMembersCommand = async (output, context) => {
1047
977
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1048
978
  return deserializeAws_restJson1GetMembersCommandError(output, context);
1049
979
  }
1050
- const contents = {
980
+ const contents = map({
1051
981
  $metadata: deserializeMetadata(output),
1052
- MemberDetails: undefined,
1053
- UnprocessedAccounts: undefined,
1054
- };
982
+ });
1055
983
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1056
- if (data.MemberDetails !== undefined && data.MemberDetails !== null) {
984
+ if (data.MemberDetails != null) {
1057
985
  contents.MemberDetails = deserializeAws_restJson1MemberDetailList(data.MemberDetails, context);
1058
986
  }
1059
- if (data.UnprocessedAccounts !== undefined && data.UnprocessedAccounts !== null) {
987
+ if (data.UnprocessedAccounts != null) {
1060
988
  contents.UnprocessedAccounts = deserializeAws_restJson1UnprocessedAccountList(data.UnprocessedAccounts, context);
1061
989
  }
1062
- return Promise.resolve(contents);
990
+ return contents;
1063
991
  };
1064
992
  exports.deserializeAws_restJson1GetMembersCommand = deserializeAws_restJson1GetMembersCommand;
1065
993
  const deserializeAws_restJson1GetMembersCommandError = async (output, context) => {
@@ -1067,7 +995,6 @@ const deserializeAws_restJson1GetMembersCommandError = async (output, context) =
1067
995
  ...output,
1068
996
  body: await parseBody(output.body, context),
1069
997
  };
1070
- let response;
1071
998
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1072
999
  switch (errorCode) {
1073
1000
  case "InternalServerException":
@@ -1081,33 +1008,29 @@ const deserializeAws_restJson1GetMembersCommandError = async (output, context) =
1081
1008
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1082
1009
  default:
1083
1010
  const parsedBody = parsedOutput.body;
1084
- const $metadata = deserializeMetadata(output);
1085
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1086
- response = new DetectiveServiceException_1.DetectiveServiceException({
1087
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1088
- $fault: "client",
1089
- $metadata,
1011
+ (0, smithy_client_1.throwDefaultError)({
1012
+ output,
1013
+ parsedBody,
1014
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1015
+ errorCode,
1090
1016
  });
1091
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1092
1017
  }
1093
1018
  };
1094
1019
  const deserializeAws_restJson1ListDatasourcePackagesCommand = async (output, context) => {
1095
1020
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1096
1021
  return deserializeAws_restJson1ListDatasourcePackagesCommandError(output, context);
1097
1022
  }
1098
- const contents = {
1023
+ const contents = map({
1099
1024
  $metadata: deserializeMetadata(output),
1100
- DatasourcePackages: undefined,
1101
- NextToken: undefined,
1102
- };
1025
+ });
1103
1026
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1104
- if (data.DatasourcePackages !== undefined && data.DatasourcePackages !== null) {
1027
+ if (data.DatasourcePackages != null) {
1105
1028
  contents.DatasourcePackages = deserializeAws_restJson1DatasourcePackageIngestDetails(data.DatasourcePackages, context);
1106
1029
  }
1107
- if (data.NextToken !== undefined && data.NextToken !== null) {
1030
+ if (data.NextToken != null) {
1108
1031
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1109
1032
  }
1110
- return Promise.resolve(contents);
1033
+ return contents;
1111
1034
  };
1112
1035
  exports.deserializeAws_restJson1ListDatasourcePackagesCommand = deserializeAws_restJson1ListDatasourcePackagesCommand;
1113
1036
  const deserializeAws_restJson1ListDatasourcePackagesCommandError = async (output, context) => {
@@ -1115,7 +1038,6 @@ const deserializeAws_restJson1ListDatasourcePackagesCommandError = async (output
1115
1038
  ...output,
1116
1039
  body: await parseBody(output.body, context),
1117
1040
  };
1118
- let response;
1119
1041
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1120
1042
  switch (errorCode) {
1121
1043
  case "InternalServerException":
@@ -1129,33 +1051,29 @@ const deserializeAws_restJson1ListDatasourcePackagesCommandError = async (output
1129
1051
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1130
1052
  default:
1131
1053
  const parsedBody = parsedOutput.body;
1132
- const $metadata = deserializeMetadata(output);
1133
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1134
- response = new DetectiveServiceException_1.DetectiveServiceException({
1135
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1136
- $fault: "client",
1137
- $metadata,
1054
+ (0, smithy_client_1.throwDefaultError)({
1055
+ output,
1056
+ parsedBody,
1057
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1058
+ errorCode,
1138
1059
  });
1139
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1140
1060
  }
1141
1061
  };
1142
1062
  const deserializeAws_restJson1ListGraphsCommand = async (output, context) => {
1143
1063
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1144
1064
  return deserializeAws_restJson1ListGraphsCommandError(output, context);
1145
1065
  }
1146
- const contents = {
1066
+ const contents = map({
1147
1067
  $metadata: deserializeMetadata(output),
1148
- GraphList: undefined,
1149
- NextToken: undefined,
1150
- };
1068
+ });
1151
1069
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1152
- if (data.GraphList !== undefined && data.GraphList !== null) {
1070
+ if (data.GraphList != null) {
1153
1071
  contents.GraphList = deserializeAws_restJson1GraphList(data.GraphList, context);
1154
1072
  }
1155
- if (data.NextToken !== undefined && data.NextToken !== null) {
1073
+ if (data.NextToken != null) {
1156
1074
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1157
1075
  }
1158
- return Promise.resolve(contents);
1076
+ return contents;
1159
1077
  };
1160
1078
  exports.deserializeAws_restJson1ListGraphsCommand = deserializeAws_restJson1ListGraphsCommand;
1161
1079
  const deserializeAws_restJson1ListGraphsCommandError = async (output, context) => {
@@ -1163,7 +1081,6 @@ const deserializeAws_restJson1ListGraphsCommandError = async (output, context) =
1163
1081
  ...output,
1164
1082
  body: await parseBody(output.body, context),
1165
1083
  };
1166
- let response;
1167
1084
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1168
1085
  switch (errorCode) {
1169
1086
  case "InternalServerException":
@@ -1174,33 +1091,29 @@ const deserializeAws_restJson1ListGraphsCommandError = async (output, context) =
1174
1091
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1175
1092
  default:
1176
1093
  const parsedBody = parsedOutput.body;
1177
- const $metadata = deserializeMetadata(output);
1178
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1179
- response = new DetectiveServiceException_1.DetectiveServiceException({
1180
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1181
- $fault: "client",
1182
- $metadata,
1094
+ (0, smithy_client_1.throwDefaultError)({
1095
+ output,
1096
+ parsedBody,
1097
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1098
+ errorCode,
1183
1099
  });
1184
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1185
1100
  }
1186
1101
  };
1187
1102
  const deserializeAws_restJson1ListInvitationsCommand = async (output, context) => {
1188
1103
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1189
1104
  return deserializeAws_restJson1ListInvitationsCommandError(output, context);
1190
1105
  }
1191
- const contents = {
1106
+ const contents = map({
1192
1107
  $metadata: deserializeMetadata(output),
1193
- Invitations: undefined,
1194
- NextToken: undefined,
1195
- };
1108
+ });
1196
1109
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1197
- if (data.Invitations !== undefined && data.Invitations !== null) {
1110
+ if (data.Invitations != null) {
1198
1111
  contents.Invitations = deserializeAws_restJson1MemberDetailList(data.Invitations, context);
1199
1112
  }
1200
- if (data.NextToken !== undefined && data.NextToken !== null) {
1113
+ if (data.NextToken != null) {
1201
1114
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1202
1115
  }
1203
- return Promise.resolve(contents);
1116
+ return contents;
1204
1117
  };
1205
1118
  exports.deserializeAws_restJson1ListInvitationsCommand = deserializeAws_restJson1ListInvitationsCommand;
1206
1119
  const deserializeAws_restJson1ListInvitationsCommandError = async (output, context) => {
@@ -1208,7 +1121,6 @@ const deserializeAws_restJson1ListInvitationsCommandError = async (output, conte
1208
1121
  ...output,
1209
1122
  body: await parseBody(output.body, context),
1210
1123
  };
1211
- let response;
1212
1124
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1213
1125
  switch (errorCode) {
1214
1126
  case "InternalServerException":
@@ -1219,33 +1131,29 @@ const deserializeAws_restJson1ListInvitationsCommandError = async (output, conte
1219
1131
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1220
1132
  default:
1221
1133
  const parsedBody = parsedOutput.body;
1222
- const $metadata = deserializeMetadata(output);
1223
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1224
- response = new DetectiveServiceException_1.DetectiveServiceException({
1225
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1226
- $fault: "client",
1227
- $metadata,
1134
+ (0, smithy_client_1.throwDefaultError)({
1135
+ output,
1136
+ parsedBody,
1137
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1138
+ errorCode,
1228
1139
  });
1229
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1230
1140
  }
1231
1141
  };
1232
1142
  const deserializeAws_restJson1ListMembersCommand = async (output, context) => {
1233
1143
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1234
1144
  return deserializeAws_restJson1ListMembersCommandError(output, context);
1235
1145
  }
1236
- const contents = {
1146
+ const contents = map({
1237
1147
  $metadata: deserializeMetadata(output),
1238
- MemberDetails: undefined,
1239
- NextToken: undefined,
1240
- };
1148
+ });
1241
1149
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1242
- if (data.MemberDetails !== undefined && data.MemberDetails !== null) {
1150
+ if (data.MemberDetails != null) {
1243
1151
  contents.MemberDetails = deserializeAws_restJson1MemberDetailList(data.MemberDetails, context);
1244
1152
  }
1245
- if (data.NextToken !== undefined && data.NextToken !== null) {
1153
+ if (data.NextToken != null) {
1246
1154
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1247
1155
  }
1248
- return Promise.resolve(contents);
1156
+ return contents;
1249
1157
  };
1250
1158
  exports.deserializeAws_restJson1ListMembersCommand = deserializeAws_restJson1ListMembersCommand;
1251
1159
  const deserializeAws_restJson1ListMembersCommandError = async (output, context) => {
@@ -1253,7 +1161,6 @@ const deserializeAws_restJson1ListMembersCommandError = async (output, context)
1253
1161
  ...output,
1254
1162
  body: await parseBody(output.body, context),
1255
1163
  };
1256
- let response;
1257
1164
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1258
1165
  switch (errorCode) {
1259
1166
  case "InternalServerException":
@@ -1267,33 +1174,29 @@ const deserializeAws_restJson1ListMembersCommandError = async (output, context)
1267
1174
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1268
1175
  default:
1269
1176
  const parsedBody = parsedOutput.body;
1270
- const $metadata = deserializeMetadata(output);
1271
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1272
- response = new DetectiveServiceException_1.DetectiveServiceException({
1273
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1274
- $fault: "client",
1275
- $metadata,
1177
+ (0, smithy_client_1.throwDefaultError)({
1178
+ output,
1179
+ parsedBody,
1180
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1181
+ errorCode,
1276
1182
  });
1277
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1278
1183
  }
1279
1184
  };
1280
1185
  const deserializeAws_restJson1ListOrganizationAdminAccountsCommand = async (output, context) => {
1281
1186
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1282
1187
  return deserializeAws_restJson1ListOrganizationAdminAccountsCommandError(output, context);
1283
1188
  }
1284
- const contents = {
1189
+ const contents = map({
1285
1190
  $metadata: deserializeMetadata(output),
1286
- Administrators: undefined,
1287
- NextToken: undefined,
1288
- };
1191
+ });
1289
1192
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1290
- if (data.Administrators !== undefined && data.Administrators !== null) {
1193
+ if (data.Administrators != null) {
1291
1194
  contents.Administrators = deserializeAws_restJson1AdministratorList(data.Administrators, context);
1292
1195
  }
1293
- if (data.NextToken !== undefined && data.NextToken !== null) {
1196
+ if (data.NextToken != null) {
1294
1197
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1295
1198
  }
1296
- return Promise.resolve(contents);
1199
+ return contents;
1297
1200
  };
1298
1201
  exports.deserializeAws_restJson1ListOrganizationAdminAccountsCommand = deserializeAws_restJson1ListOrganizationAdminAccountsCommand;
1299
1202
  const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async (output, context) => {
@@ -1301,7 +1204,6 @@ const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async
1301
1204
  ...output,
1302
1205
  body: await parseBody(output.body, context),
1303
1206
  };
1304
- let response;
1305
1207
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1306
1208
  switch (errorCode) {
1307
1209
  case "InternalServerException":
@@ -1315,29 +1217,26 @@ const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async
1315
1217
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1316
1218
  default:
1317
1219
  const parsedBody = parsedOutput.body;
1318
- const $metadata = deserializeMetadata(output);
1319
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1320
- response = new DetectiveServiceException_1.DetectiveServiceException({
1321
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1322
- $fault: "client",
1323
- $metadata,
1220
+ (0, smithy_client_1.throwDefaultError)({
1221
+ output,
1222
+ parsedBody,
1223
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1224
+ errorCode,
1324
1225
  });
1325
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1326
1226
  }
1327
1227
  };
1328
1228
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1329
1229
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1330
1230
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1331
1231
  }
1332
- const contents = {
1232
+ const contents = map({
1333
1233
  $metadata: deserializeMetadata(output),
1334
- Tags: undefined,
1335
- };
1234
+ });
1336
1235
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1337
- if (data.Tags !== undefined && data.Tags !== null) {
1236
+ if (data.Tags != null) {
1338
1237
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
1339
1238
  }
1340
- return Promise.resolve(contents);
1239
+ return contents;
1341
1240
  };
1342
1241
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1343
1242
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1345,7 +1244,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1345
1244
  ...output,
1346
1245
  body: await parseBody(output.body, context),
1347
1246
  };
1348
- let response;
1349
1247
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1350
1248
  switch (errorCode) {
1351
1249
  case "InternalServerException":
@@ -1359,25 +1257,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1359
1257
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1360
1258
  default:
1361
1259
  const parsedBody = parsedOutput.body;
1362
- const $metadata = deserializeMetadata(output);
1363
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1364
- response = new DetectiveServiceException_1.DetectiveServiceException({
1365
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1366
- $fault: "client",
1367
- $metadata,
1260
+ (0, smithy_client_1.throwDefaultError)({
1261
+ output,
1262
+ parsedBody,
1263
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1264
+ errorCode,
1368
1265
  });
1369
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1370
1266
  }
1371
1267
  };
1372
1268
  const deserializeAws_restJson1RejectInvitationCommand = async (output, context) => {
1373
1269
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1374
1270
  return deserializeAws_restJson1RejectInvitationCommandError(output, context);
1375
1271
  }
1376
- const contents = {
1272
+ const contents = map({
1377
1273
  $metadata: deserializeMetadata(output),
1378
- };
1274
+ });
1379
1275
  await collectBody(output.body, context);
1380
- return Promise.resolve(contents);
1276
+ return contents;
1381
1277
  };
1382
1278
  exports.deserializeAws_restJson1RejectInvitationCommand = deserializeAws_restJson1RejectInvitationCommand;
1383
1279
  const deserializeAws_restJson1RejectInvitationCommandError = async (output, context) => {
@@ -1385,7 +1281,6 @@ const deserializeAws_restJson1RejectInvitationCommandError = async (output, cont
1385
1281
  ...output,
1386
1282
  body: await parseBody(output.body, context),
1387
1283
  };
1388
- let response;
1389
1284
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1390
1285
  switch (errorCode) {
1391
1286
  case "ConflictException":
@@ -1402,25 +1297,23 @@ const deserializeAws_restJson1RejectInvitationCommandError = async (output, cont
1402
1297
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1403
1298
  default:
1404
1299
  const parsedBody = parsedOutput.body;
1405
- const $metadata = deserializeMetadata(output);
1406
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1407
- response = new DetectiveServiceException_1.DetectiveServiceException({
1408
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1409
- $fault: "client",
1410
- $metadata,
1300
+ (0, smithy_client_1.throwDefaultError)({
1301
+ output,
1302
+ parsedBody,
1303
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1304
+ errorCode,
1411
1305
  });
1412
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1413
1306
  }
1414
1307
  };
1415
1308
  const deserializeAws_restJson1StartMonitoringMemberCommand = async (output, context) => {
1416
1309
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1417
1310
  return deserializeAws_restJson1StartMonitoringMemberCommandError(output, context);
1418
1311
  }
1419
- const contents = {
1312
+ const contents = map({
1420
1313
  $metadata: deserializeMetadata(output),
1421
- };
1314
+ });
1422
1315
  await collectBody(output.body, context);
1423
- return Promise.resolve(contents);
1316
+ return contents;
1424
1317
  };
1425
1318
  exports.deserializeAws_restJson1StartMonitoringMemberCommand = deserializeAws_restJson1StartMonitoringMemberCommand;
1426
1319
  const deserializeAws_restJson1StartMonitoringMemberCommandError = async (output, context) => {
@@ -1428,7 +1321,6 @@ const deserializeAws_restJson1StartMonitoringMemberCommandError = async (output,
1428
1321
  ...output,
1429
1322
  body: await parseBody(output.body, context),
1430
1323
  };
1431
- let response;
1432
1324
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1433
1325
  switch (errorCode) {
1434
1326
  case "ConflictException":
@@ -1448,25 +1340,23 @@ const deserializeAws_restJson1StartMonitoringMemberCommandError = async (output,
1448
1340
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1449
1341
  default:
1450
1342
  const parsedBody = parsedOutput.body;
1451
- const $metadata = deserializeMetadata(output);
1452
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1453
- response = new DetectiveServiceException_1.DetectiveServiceException({
1454
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1455
- $fault: "client",
1456
- $metadata,
1343
+ (0, smithy_client_1.throwDefaultError)({
1344
+ output,
1345
+ parsedBody,
1346
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1347
+ errorCode,
1457
1348
  });
1458
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1459
1349
  }
1460
1350
  };
1461
1351
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1462
1352
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1463
1353
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1464
1354
  }
1465
- const contents = {
1355
+ const contents = map({
1466
1356
  $metadata: deserializeMetadata(output),
1467
- };
1357
+ });
1468
1358
  await collectBody(output.body, context);
1469
- return Promise.resolve(contents);
1359
+ return contents;
1470
1360
  };
1471
1361
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1472
1362
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1474,7 +1364,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1474
1364
  ...output,
1475
1365
  body: await parseBody(output.body, context),
1476
1366
  };
1477
- let response;
1478
1367
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1479
1368
  switch (errorCode) {
1480
1369
  case "InternalServerException":
@@ -1488,25 +1377,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1488
1377
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1489
1378
  default:
1490
1379
  const parsedBody = parsedOutput.body;
1491
- const $metadata = deserializeMetadata(output);
1492
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1493
- response = new DetectiveServiceException_1.DetectiveServiceException({
1494
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1495
- $fault: "client",
1496
- $metadata,
1380
+ (0, smithy_client_1.throwDefaultError)({
1381
+ output,
1382
+ parsedBody,
1383
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1384
+ errorCode,
1497
1385
  });
1498
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1499
1386
  }
1500
1387
  };
1501
1388
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1502
1389
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1503
1390
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1504
1391
  }
1505
- const contents = {
1392
+ const contents = map({
1506
1393
  $metadata: deserializeMetadata(output),
1507
- };
1394
+ });
1508
1395
  await collectBody(output.body, context);
1509
- return Promise.resolve(contents);
1396
+ return contents;
1510
1397
  };
1511
1398
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1512
1399
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1514,7 +1401,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1514
1401
  ...output,
1515
1402
  body: await parseBody(output.body, context),
1516
1403
  };
1517
- let response;
1518
1404
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1519
1405
  switch (errorCode) {
1520
1406
  case "InternalServerException":
@@ -1528,25 +1414,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1528
1414
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1529
1415
  default:
1530
1416
  const parsedBody = parsedOutput.body;
1531
- const $metadata = deserializeMetadata(output);
1532
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1533
- response = new DetectiveServiceException_1.DetectiveServiceException({
1534
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1535
- $fault: "client",
1536
- $metadata,
1417
+ (0, smithy_client_1.throwDefaultError)({
1418
+ output,
1419
+ parsedBody,
1420
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1421
+ errorCode,
1537
1422
  });
1538
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1539
1423
  }
1540
1424
  };
1541
1425
  const deserializeAws_restJson1UpdateDatasourcePackagesCommand = async (output, context) => {
1542
1426
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1543
1427
  return deserializeAws_restJson1UpdateDatasourcePackagesCommandError(output, context);
1544
1428
  }
1545
- const contents = {
1429
+ const contents = map({
1546
1430
  $metadata: deserializeMetadata(output),
1547
- };
1431
+ });
1548
1432
  await collectBody(output.body, context);
1549
- return Promise.resolve(contents);
1433
+ return contents;
1550
1434
  };
1551
1435
  exports.deserializeAws_restJson1UpdateDatasourcePackagesCommand = deserializeAws_restJson1UpdateDatasourcePackagesCommand;
1552
1436
  const deserializeAws_restJson1UpdateDatasourcePackagesCommandError = async (output, context) => {
@@ -1554,7 +1438,6 @@ const deserializeAws_restJson1UpdateDatasourcePackagesCommandError = async (outp
1554
1438
  ...output,
1555
1439
  body: await parseBody(output.body, context),
1556
1440
  };
1557
- let response;
1558
1441
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1559
1442
  switch (errorCode) {
1560
1443
  case "InternalServerException":
@@ -1571,25 +1454,23 @@ const deserializeAws_restJson1UpdateDatasourcePackagesCommandError = async (outp
1571
1454
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1572
1455
  default:
1573
1456
  const parsedBody = parsedOutput.body;
1574
- const $metadata = deserializeMetadata(output);
1575
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1576
- response = new DetectiveServiceException_1.DetectiveServiceException({
1577
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1578
- $fault: "client",
1579
- $metadata,
1457
+ (0, smithy_client_1.throwDefaultError)({
1458
+ output,
1459
+ parsedBody,
1460
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1461
+ errorCode,
1580
1462
  });
1581
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1582
1463
  }
1583
1464
  };
1584
1465
  const deserializeAws_restJson1UpdateOrganizationConfigurationCommand = async (output, context) => {
1585
1466
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1586
1467
  return deserializeAws_restJson1UpdateOrganizationConfigurationCommandError(output, context);
1587
1468
  }
1588
- const contents = {
1469
+ const contents = map({
1589
1470
  $metadata: deserializeMetadata(output),
1590
- };
1471
+ });
1591
1472
  await collectBody(output.body, context);
1592
- return Promise.resolve(contents);
1473
+ return contents;
1593
1474
  };
1594
1475
  exports.deserializeAws_restJson1UpdateOrganizationConfigurationCommand = deserializeAws_restJson1UpdateOrganizationConfigurationCommand;
1595
1476
  const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = async (output, context) => {
@@ -1597,7 +1478,6 @@ const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = asyn
1597
1478
  ...output,
1598
1479
  body: await parseBody(output.body, context),
1599
1480
  };
1600
- let response;
1601
1481
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1602
1482
  switch (errorCode) {
1603
1483
  case "InternalServerException":
@@ -1611,20 +1491,19 @@ const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = asyn
1611
1491
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1612
1492
  default:
1613
1493
  const parsedBody = parsedOutput.body;
1614
- const $metadata = deserializeMetadata(output);
1615
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1616
- response = new DetectiveServiceException_1.DetectiveServiceException({
1617
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1618
- $fault: "client",
1619
- $metadata,
1494
+ (0, smithy_client_1.throwDefaultError)({
1495
+ output,
1496
+ parsedBody,
1497
+ exceptionCtor: DetectiveServiceException_1.DetectiveServiceException,
1498
+ errorCode,
1620
1499
  });
1621
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1622
1500
  }
1623
1501
  };
1502
+ const map = smithy_client_1.map;
1624
1503
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1625
- const contents = {};
1504
+ const contents = map({});
1626
1505
  const data = parsedOutput.body;
1627
- if (data.Message !== undefined && data.Message !== null) {
1506
+ if (data.Message != null) {
1628
1507
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1629
1508
  }
1630
1509
  const exception = new models_0_1.ConflictException({
@@ -1634,9 +1513,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
1634
1513
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1635
1514
  };
1636
1515
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1637
- const contents = {};
1516
+ const contents = map({});
1638
1517
  const data = parsedOutput.body;
1639
- if (data.Message !== undefined && data.Message !== null) {
1518
+ if (data.Message != null) {
1640
1519
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1641
1520
  }
1642
1521
  const exception = new models_0_1.InternalServerException({
@@ -1646,9 +1525,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
1646
1525
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1647
1526
  };
1648
1527
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1649
- const contents = {};
1528
+ const contents = map({});
1650
1529
  const data = parsedOutput.body;
1651
- if (data.Message !== undefined && data.Message !== null) {
1530
+ if (data.Message != null) {
1652
1531
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1653
1532
  }
1654
1533
  const exception = new models_0_1.ResourceNotFoundException({
@@ -1658,12 +1537,12 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
1658
1537
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1659
1538
  };
1660
1539
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1661
- const contents = {};
1540
+ const contents = map({});
1662
1541
  const data = parsedOutput.body;
1663
- if (data.Message !== undefined && data.Message !== null) {
1542
+ if (data.Message != null) {
1664
1543
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1665
1544
  }
1666
- if (data.Resources !== undefined && data.Resources !== null) {
1545
+ if (data.Resources != null) {
1667
1546
  contents.Resources = deserializeAws_restJson1ResourceList(data.Resources, context);
1668
1547
  }
1669
1548
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -1673,9 +1552,9 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
1673
1552
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1674
1553
  };
1675
1554
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
1676
- const contents = {};
1555
+ const contents = map({});
1677
1556
  const data = parsedOutput.body;
1678
- if (data.Message !== undefined && data.Message !== null) {
1557
+ if (data.Message != null) {
1679
1558
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1680
1559
  }
1681
1560
  const exception = new models_0_1.TooManyRequestsException({
@@ -1685,15 +1564,15 @@ const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOu
1685
1564
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
1686
1565
  };
1687
1566
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1688
- const contents = {};
1567
+ const contents = map({});
1689
1568
  const data = parsedOutput.body;
1690
- if (data.ErrorCode !== undefined && data.ErrorCode !== null) {
1569
+ if (data.ErrorCode != null) {
1691
1570
  contents.ErrorCode = (0, smithy_client_1.expectString)(data.ErrorCode);
1692
1571
  }
1693
- if (data.ErrorCodeReason !== undefined && data.ErrorCodeReason !== null) {
1572
+ if (data.ErrorCodeReason != null) {
1694
1573
  contents.ErrorCodeReason = (0, smithy_client_1.expectString)(data.ErrorCodeReason);
1695
1574
  }
1696
- if (data.Message !== undefined && data.Message !== null) {
1575
+ if (data.Message != null) {
1697
1576
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
1698
1577
  }
1699
1578
  const exception = new models_0_1.ValidationException({
@@ -1712,9 +1591,6 @@ const serializeAws_restJson1AccountIdExtendedList = (input, context) => {
1712
1591
  return input
1713
1592
  .filter((e) => e != null)
1714
1593
  .map((entry) => {
1715
- if (entry === null) {
1716
- return null;
1717
- }
1718
1594
  return entry;
1719
1595
  });
1720
1596
  };
@@ -1722,9 +1598,6 @@ const serializeAws_restJson1AccountIdList = (input, context) => {
1722
1598
  return input
1723
1599
  .filter((e) => e != null)
1724
1600
  .map((entry) => {
1725
- if (entry === null) {
1726
- return null;
1727
- }
1728
1601
  return entry;
1729
1602
  });
1730
1603
  };
@@ -1732,9 +1605,6 @@ const serializeAws_restJson1AccountList = (input, context) => {
1732
1605
  return input
1733
1606
  .filter((e) => e != null)
1734
1607
  .map((entry) => {
1735
- if (entry === null) {
1736
- return null;
1737
- }
1738
1608
  return serializeAws_restJson1Account(entry, context);
1739
1609
  });
1740
1610
  };
@@ -1742,9 +1612,6 @@ const serializeAws_restJson1DatasourcePackageList = (input, context) => {
1742
1612
  return input
1743
1613
  .filter((e) => e != null)
1744
1614
  .map((entry) => {
1745
- if (entry === null) {
1746
- return null;
1747
- }
1748
1615
  return entry;
1749
1616
  });
1750
1617
  };
@@ -1752,9 +1619,6 @@ const serializeAws_restJson1GraphArnList = (input, context) => {
1752
1619
  return input
1753
1620
  .filter((e) => e != null)
1754
1621
  .map((entry) => {
1755
- if (entry === null) {
1756
- return null;
1757
- }
1758
1622
  return entry;
1759
1623
  });
1760
1624
  };