@aws-sdk/client-billingconductor 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.
@@ -110,10 +110,10 @@ const serializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand
110
110
  exports.serializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand = serializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand;
111
111
  const serializeAws_restJson1CreateBillingGroupCommand = async (input, context) => {
112
112
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
113
- const headers = {
113
+ const headers = map({}, isSerializableHeaderValue, {
114
114
  "content-type": "application/json",
115
- ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken }),
116
- };
115
+ "x-amzn-client-token": input.ClientToken,
116
+ });
117
117
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/create-billing-group";
118
118
  let body;
119
119
  body = JSON.stringify({
@@ -141,10 +141,10 @@ const serializeAws_restJson1CreateBillingGroupCommand = async (input, context) =
141
141
  exports.serializeAws_restJson1CreateBillingGroupCommand = serializeAws_restJson1CreateBillingGroupCommand;
142
142
  const serializeAws_restJson1CreateCustomLineItemCommand = async (input, context) => {
143
143
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
144
- const headers = {
144
+ const headers = map({}, isSerializableHeaderValue, {
145
145
  "content-type": "application/json",
146
- ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken }),
147
- };
146
+ "x-amzn-client-token": input.ClientToken,
147
+ });
148
148
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/create-custom-line-item";
149
149
  let body;
150
150
  body = JSON.stringify({
@@ -172,10 +172,10 @@ const serializeAws_restJson1CreateCustomLineItemCommand = async (input, context)
172
172
  exports.serializeAws_restJson1CreateCustomLineItemCommand = serializeAws_restJson1CreateCustomLineItemCommand;
173
173
  const serializeAws_restJson1CreatePricingPlanCommand = async (input, context) => {
174
174
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
175
- const headers = {
175
+ const headers = map({}, isSerializableHeaderValue, {
176
176
  "content-type": "application/json",
177
- ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken }),
178
- };
177
+ "x-amzn-client-token": input.ClientToken,
178
+ });
179
179
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/create-pricing-plan";
180
180
  let body;
181
181
  body = JSON.stringify({
@@ -199,10 +199,10 @@ const serializeAws_restJson1CreatePricingPlanCommand = async (input, context) =>
199
199
  exports.serializeAws_restJson1CreatePricingPlanCommand = serializeAws_restJson1CreatePricingPlanCommand;
200
200
  const serializeAws_restJson1CreatePricingRuleCommand = async (input, context) => {
201
201
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
202
- const headers = {
202
+ const headers = map({}, isSerializableHeaderValue, {
203
203
  "content-type": "application/json",
204
- ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken }),
205
- };
204
+ "x-amzn-client-token": input.ClientToken,
205
+ });
206
206
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/create-pricing-rule";
207
207
  let body;
208
208
  body = JSON.stringify({
@@ -587,16 +587,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
587
587
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
588
588
  const headers = {};
589
589
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
590
- if (input.ResourceArn !== undefined) {
591
- const labelValue = input.ResourceArn;
592
- if (labelValue.length <= 0) {
593
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
594
- }
595
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
596
- }
597
- else {
598
- throw new Error("No value provided for input HTTP label: ResourceArn.");
599
- }
590
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
600
591
  let body;
601
592
  return new protocol_http_1.HttpRequest({
602
593
  protocol,
@@ -615,16 +606,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
615
606
  "content-type": "application/json",
616
607
  };
617
608
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
618
- if (input.ResourceArn !== undefined) {
619
- const labelValue = input.ResourceArn;
620
- if (labelValue.length <= 0) {
621
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
622
- }
623
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
624
- }
625
- else {
626
- throw new Error("No value provided for input HTTP label: ResourceArn.");
627
- }
609
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
628
610
  let body;
629
611
  body = JSON.stringify({
630
612
  ...(input.Tags != null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
@@ -644,19 +626,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
644
626
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
645
627
  const headers = {};
646
628
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
647
- if (input.ResourceArn !== undefined) {
648
- const labelValue = input.ResourceArn;
649
- if (labelValue.length <= 0) {
650
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
651
- }
652
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
653
- }
654
- else {
655
- throw new Error("No value provided for input HTTP label: ResourceArn.");
656
- }
657
- const query = {
658
- ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
659
- };
629
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
630
+ const query = map({
631
+ tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys || []).map((_entry) => _entry)],
632
+ });
660
633
  let body;
661
634
  return new protocol_http_1.HttpRequest({
662
635
  protocol,
@@ -778,15 +751,14 @@ const deserializeAws_restJson1AssociateAccountsCommand = async (output, context)
778
751
  if (output.statusCode !== 200 && output.statusCode >= 300) {
779
752
  return deserializeAws_restJson1AssociateAccountsCommandError(output, context);
780
753
  }
781
- const contents = {
754
+ const contents = map({
782
755
  $metadata: deserializeMetadata(output),
783
- Arn: undefined,
784
- };
756
+ });
785
757
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
786
- if (data.Arn !== undefined && data.Arn !== null) {
758
+ if (data.Arn != null) {
787
759
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
788
760
  }
789
- return Promise.resolve(contents);
761
+ return contents;
790
762
  };
791
763
  exports.deserializeAws_restJson1AssociateAccountsCommand = deserializeAws_restJson1AssociateAccountsCommand;
792
764
  const deserializeAws_restJson1AssociateAccountsCommandError = async (output, context) => {
@@ -794,7 +766,6 @@ const deserializeAws_restJson1AssociateAccountsCommandError = async (output, con
794
766
  ...output,
795
767
  body: await parseBody(output.body, context),
796
768
  };
797
- let response;
798
769
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
799
770
  switch (errorCode) {
800
771
  case "AccessDeniedException":
@@ -820,29 +791,26 @@ const deserializeAws_restJson1AssociateAccountsCommandError = async (output, con
820
791
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
821
792
  default:
822
793
  const parsedBody = parsedOutput.body;
823
- const $metadata = deserializeMetadata(output);
824
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
825
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
826
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
827
- $fault: "client",
828
- $metadata,
794
+ (0, smithy_client_1.throwDefaultError)({
795
+ output,
796
+ parsedBody,
797
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
798
+ errorCode,
829
799
  });
830
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
831
800
  }
832
801
  };
833
802
  const deserializeAws_restJson1AssociatePricingRulesCommand = async (output, context) => {
834
803
  if (output.statusCode !== 200 && output.statusCode >= 300) {
835
804
  return deserializeAws_restJson1AssociatePricingRulesCommandError(output, context);
836
805
  }
837
- const contents = {
806
+ const contents = map({
838
807
  $metadata: deserializeMetadata(output),
839
- Arn: undefined,
840
- };
808
+ });
841
809
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
842
- if (data.Arn !== undefined && data.Arn !== null) {
810
+ if (data.Arn != null) {
843
811
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
844
812
  }
845
- return Promise.resolve(contents);
813
+ return contents;
846
814
  };
847
815
  exports.deserializeAws_restJson1AssociatePricingRulesCommand = deserializeAws_restJson1AssociatePricingRulesCommand;
848
816
  const deserializeAws_restJson1AssociatePricingRulesCommandError = async (output, context) => {
@@ -850,7 +818,6 @@ const deserializeAws_restJson1AssociatePricingRulesCommandError = async (output,
850
818
  ...output,
851
819
  body: await parseBody(output.body, context),
852
820
  };
853
- let response;
854
821
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
855
822
  switch (errorCode) {
856
823
  case "AccessDeniedException":
@@ -876,33 +843,29 @@ const deserializeAws_restJson1AssociatePricingRulesCommandError = async (output,
876
843
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
877
844
  default:
878
845
  const parsedBody = parsedOutput.body;
879
- const $metadata = deserializeMetadata(output);
880
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
881
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
882
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
883
- $fault: "client",
884
- $metadata,
846
+ (0, smithy_client_1.throwDefaultError)({
847
+ output,
848
+ parsedBody,
849
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
850
+ errorCode,
885
851
  });
886
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
887
852
  }
888
853
  };
889
854
  const deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand = async (output, context) => {
890
855
  if (output.statusCode !== 200 && output.statusCode >= 300) {
891
856
  return deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommandError(output, context);
892
857
  }
893
- const contents = {
858
+ const contents = map({
894
859
  $metadata: deserializeMetadata(output),
895
- FailedAssociatedResources: undefined,
896
- SuccessfullyAssociatedResources: undefined,
897
- };
860
+ });
898
861
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
899
- if (data.FailedAssociatedResources !== undefined && data.FailedAssociatedResources !== null) {
862
+ if (data.FailedAssociatedResources != null) {
900
863
  contents.FailedAssociatedResources = deserializeAws_restJson1AssociateResourcesResponseList(data.FailedAssociatedResources, context);
901
864
  }
902
- if (data.SuccessfullyAssociatedResources !== undefined && data.SuccessfullyAssociatedResources !== null) {
865
+ if (data.SuccessfullyAssociatedResources != null) {
903
866
  contents.SuccessfullyAssociatedResources = deserializeAws_restJson1AssociateResourcesResponseList(data.SuccessfullyAssociatedResources, context);
904
867
  }
905
- return Promise.resolve(contents);
868
+ return contents;
906
869
  };
907
870
  exports.deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand = deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand;
908
871
  const deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommandError = async (output, context) => {
@@ -910,7 +873,6 @@ const deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommandErro
910
873
  ...output,
911
874
  body: await parseBody(output.body, context),
912
875
  };
913
- let response;
914
876
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
915
877
  switch (errorCode) {
916
878
  case "AccessDeniedException":
@@ -936,33 +898,29 @@ const deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommandErro
936
898
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
937
899
  default:
938
900
  const parsedBody = parsedOutput.body;
939
- const $metadata = deserializeMetadata(output);
940
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
941
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
942
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
943
- $fault: "client",
944
- $metadata,
901
+ (0, smithy_client_1.throwDefaultError)({
902
+ output,
903
+ parsedBody,
904
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
905
+ errorCode,
945
906
  });
946
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
947
907
  }
948
908
  };
949
909
  const deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand = async (output, context) => {
950
910
  if (output.statusCode !== 200 && output.statusCode >= 300) {
951
911
  return deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommandError(output, context);
952
912
  }
953
- const contents = {
913
+ const contents = map({
954
914
  $metadata: deserializeMetadata(output),
955
- FailedDisassociatedResources: undefined,
956
- SuccessfullyDisassociatedResources: undefined,
957
- };
915
+ });
958
916
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
959
- if (data.FailedDisassociatedResources !== undefined && data.FailedDisassociatedResources !== null) {
917
+ if (data.FailedDisassociatedResources != null) {
960
918
  contents.FailedDisassociatedResources = deserializeAws_restJson1DisassociateResourcesResponseList(data.FailedDisassociatedResources, context);
961
919
  }
962
- if (data.SuccessfullyDisassociatedResources !== undefined && data.SuccessfullyDisassociatedResources !== null) {
920
+ if (data.SuccessfullyDisassociatedResources != null) {
963
921
  contents.SuccessfullyDisassociatedResources = deserializeAws_restJson1DisassociateResourcesResponseList(data.SuccessfullyDisassociatedResources, context);
964
922
  }
965
- return Promise.resolve(contents);
923
+ return contents;
966
924
  };
967
925
  exports.deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand = deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand;
968
926
  const deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommandError = async (output, context) => {
@@ -970,7 +928,6 @@ const deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemComman
970
928
  ...output,
971
929
  body: await parseBody(output.body, context),
972
930
  };
973
- let response;
974
931
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
975
932
  switch (errorCode) {
976
933
  case "AccessDeniedException":
@@ -993,29 +950,26 @@ const deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemComman
993
950
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
994
951
  default:
995
952
  const parsedBody = parsedOutput.body;
996
- const $metadata = deserializeMetadata(output);
997
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
998
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
999
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1000
- $fault: "client",
1001
- $metadata,
953
+ (0, smithy_client_1.throwDefaultError)({
954
+ output,
955
+ parsedBody,
956
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
957
+ errorCode,
1002
958
  });
1003
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1004
959
  }
1005
960
  };
1006
961
  const deserializeAws_restJson1CreateBillingGroupCommand = async (output, context) => {
1007
962
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1008
963
  return deserializeAws_restJson1CreateBillingGroupCommandError(output, context);
1009
964
  }
1010
- const contents = {
965
+ const contents = map({
1011
966
  $metadata: deserializeMetadata(output),
1012
- Arn: undefined,
1013
- };
967
+ });
1014
968
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1015
- if (data.Arn !== undefined && data.Arn !== null) {
969
+ if (data.Arn != null) {
1016
970
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1017
971
  }
1018
- return Promise.resolve(contents);
972
+ return contents;
1019
973
  };
1020
974
  exports.deserializeAws_restJson1CreateBillingGroupCommand = deserializeAws_restJson1CreateBillingGroupCommand;
1021
975
  const deserializeAws_restJson1CreateBillingGroupCommandError = async (output, context) => {
@@ -1023,7 +977,6 @@ const deserializeAws_restJson1CreateBillingGroupCommandError = async (output, co
1023
977
  ...output,
1024
978
  body: await parseBody(output.body, context),
1025
979
  };
1026
- let response;
1027
980
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1028
981
  switch (errorCode) {
1029
982
  case "AccessDeniedException":
@@ -1046,29 +999,26 @@ const deserializeAws_restJson1CreateBillingGroupCommandError = async (output, co
1046
999
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1047
1000
  default:
1048
1001
  const parsedBody = parsedOutput.body;
1049
- const $metadata = deserializeMetadata(output);
1050
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1051
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1052
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1053
- $fault: "client",
1054
- $metadata,
1002
+ (0, smithy_client_1.throwDefaultError)({
1003
+ output,
1004
+ parsedBody,
1005
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1006
+ errorCode,
1055
1007
  });
1056
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1057
1008
  }
1058
1009
  };
1059
1010
  const deserializeAws_restJson1CreateCustomLineItemCommand = async (output, context) => {
1060
1011
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1061
1012
  return deserializeAws_restJson1CreateCustomLineItemCommandError(output, context);
1062
1013
  }
1063
- const contents = {
1014
+ const contents = map({
1064
1015
  $metadata: deserializeMetadata(output),
1065
- Arn: undefined,
1066
- };
1016
+ });
1067
1017
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1068
- if (data.Arn !== undefined && data.Arn !== null) {
1018
+ if (data.Arn != null) {
1069
1019
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1070
1020
  }
1071
- return Promise.resolve(contents);
1021
+ return contents;
1072
1022
  };
1073
1023
  exports.deserializeAws_restJson1CreateCustomLineItemCommand = deserializeAws_restJson1CreateCustomLineItemCommand;
1074
1024
  const deserializeAws_restJson1CreateCustomLineItemCommandError = async (output, context) => {
@@ -1076,7 +1026,6 @@ const deserializeAws_restJson1CreateCustomLineItemCommandError = async (output,
1076
1026
  ...output,
1077
1027
  body: await parseBody(output.body, context),
1078
1028
  };
1079
- let response;
1080
1029
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1081
1030
  switch (errorCode) {
1082
1031
  case "AccessDeniedException":
@@ -1099,29 +1048,26 @@ const deserializeAws_restJson1CreateCustomLineItemCommandError = async (output,
1099
1048
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1100
1049
  default:
1101
1050
  const parsedBody = parsedOutput.body;
1102
- const $metadata = deserializeMetadata(output);
1103
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1104
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1105
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1106
- $fault: "client",
1107
- $metadata,
1051
+ (0, smithy_client_1.throwDefaultError)({
1052
+ output,
1053
+ parsedBody,
1054
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1055
+ errorCode,
1108
1056
  });
1109
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1110
1057
  }
1111
1058
  };
1112
1059
  const deserializeAws_restJson1CreatePricingPlanCommand = async (output, context) => {
1113
1060
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1114
1061
  return deserializeAws_restJson1CreatePricingPlanCommandError(output, context);
1115
1062
  }
1116
- const contents = {
1063
+ const contents = map({
1117
1064
  $metadata: deserializeMetadata(output),
1118
- Arn: undefined,
1119
- };
1065
+ });
1120
1066
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1121
- if (data.Arn !== undefined && data.Arn !== null) {
1067
+ if (data.Arn != null) {
1122
1068
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1123
1069
  }
1124
- return Promise.resolve(contents);
1070
+ return contents;
1125
1071
  };
1126
1072
  exports.deserializeAws_restJson1CreatePricingPlanCommand = deserializeAws_restJson1CreatePricingPlanCommand;
1127
1073
  const deserializeAws_restJson1CreatePricingPlanCommandError = async (output, context) => {
@@ -1129,7 +1075,6 @@ const deserializeAws_restJson1CreatePricingPlanCommandError = async (output, con
1129
1075
  ...output,
1130
1076
  body: await parseBody(output.body, context),
1131
1077
  };
1132
- let response;
1133
1078
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1134
1079
  switch (errorCode) {
1135
1080
  case "AccessDeniedException":
@@ -1155,29 +1100,26 @@ const deserializeAws_restJson1CreatePricingPlanCommandError = async (output, con
1155
1100
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1156
1101
  default:
1157
1102
  const parsedBody = parsedOutput.body;
1158
- const $metadata = deserializeMetadata(output);
1159
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1160
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1161
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1162
- $fault: "client",
1163
- $metadata,
1103
+ (0, smithy_client_1.throwDefaultError)({
1104
+ output,
1105
+ parsedBody,
1106
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1107
+ errorCode,
1164
1108
  });
1165
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1166
1109
  }
1167
1110
  };
1168
1111
  const deserializeAws_restJson1CreatePricingRuleCommand = async (output, context) => {
1169
1112
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1170
1113
  return deserializeAws_restJson1CreatePricingRuleCommandError(output, context);
1171
1114
  }
1172
- const contents = {
1115
+ const contents = map({
1173
1116
  $metadata: deserializeMetadata(output),
1174
- Arn: undefined,
1175
- };
1117
+ });
1176
1118
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1177
- if (data.Arn !== undefined && data.Arn !== null) {
1119
+ if (data.Arn != null) {
1178
1120
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1179
1121
  }
1180
- return Promise.resolve(contents);
1122
+ return contents;
1181
1123
  };
1182
1124
  exports.deserializeAws_restJson1CreatePricingRuleCommand = deserializeAws_restJson1CreatePricingRuleCommand;
1183
1125
  const deserializeAws_restJson1CreatePricingRuleCommandError = async (output, context) => {
@@ -1185,7 +1127,6 @@ const deserializeAws_restJson1CreatePricingRuleCommandError = async (output, con
1185
1127
  ...output,
1186
1128
  body: await parseBody(output.body, context),
1187
1129
  };
1188
- let response;
1189
1130
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1190
1131
  switch (errorCode) {
1191
1132
  case "AccessDeniedException":
@@ -1208,29 +1149,26 @@ const deserializeAws_restJson1CreatePricingRuleCommandError = async (output, con
1208
1149
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1209
1150
  default:
1210
1151
  const parsedBody = parsedOutput.body;
1211
- const $metadata = deserializeMetadata(output);
1212
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1213
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1214
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1215
- $fault: "client",
1216
- $metadata,
1152
+ (0, smithy_client_1.throwDefaultError)({
1153
+ output,
1154
+ parsedBody,
1155
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1156
+ errorCode,
1217
1157
  });
1218
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1219
1158
  }
1220
1159
  };
1221
1160
  const deserializeAws_restJson1DeleteBillingGroupCommand = async (output, context) => {
1222
1161
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1223
1162
  return deserializeAws_restJson1DeleteBillingGroupCommandError(output, context);
1224
1163
  }
1225
- const contents = {
1164
+ const contents = map({
1226
1165
  $metadata: deserializeMetadata(output),
1227
- Arn: undefined,
1228
- };
1166
+ });
1229
1167
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1230
- if (data.Arn !== undefined && data.Arn !== null) {
1168
+ if (data.Arn != null) {
1231
1169
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1232
1170
  }
1233
- return Promise.resolve(contents);
1171
+ return contents;
1234
1172
  };
1235
1173
  exports.deserializeAws_restJson1DeleteBillingGroupCommand = deserializeAws_restJson1DeleteBillingGroupCommand;
1236
1174
  const deserializeAws_restJson1DeleteBillingGroupCommandError = async (output, context) => {
@@ -1238,7 +1176,6 @@ const deserializeAws_restJson1DeleteBillingGroupCommandError = async (output, co
1238
1176
  ...output,
1239
1177
  body: await parseBody(output.body, context),
1240
1178
  };
1241
- let response;
1242
1179
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1243
1180
  switch (errorCode) {
1244
1181
  case "AccessDeniedException":
@@ -1255,29 +1192,26 @@ const deserializeAws_restJson1DeleteBillingGroupCommandError = async (output, co
1255
1192
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1256
1193
  default:
1257
1194
  const parsedBody = parsedOutput.body;
1258
- const $metadata = deserializeMetadata(output);
1259
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1260
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1261
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1262
- $fault: "client",
1263
- $metadata,
1195
+ (0, smithy_client_1.throwDefaultError)({
1196
+ output,
1197
+ parsedBody,
1198
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1199
+ errorCode,
1264
1200
  });
1265
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1266
1201
  }
1267
1202
  };
1268
1203
  const deserializeAws_restJson1DeleteCustomLineItemCommand = async (output, context) => {
1269
1204
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1270
1205
  return deserializeAws_restJson1DeleteCustomLineItemCommandError(output, context);
1271
1206
  }
1272
- const contents = {
1207
+ const contents = map({
1273
1208
  $metadata: deserializeMetadata(output),
1274
- Arn: undefined,
1275
- };
1209
+ });
1276
1210
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1277
- if (data.Arn !== undefined && data.Arn !== null) {
1211
+ if (data.Arn != null) {
1278
1212
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1279
1213
  }
1280
- return Promise.resolve(contents);
1214
+ return contents;
1281
1215
  };
1282
1216
  exports.deserializeAws_restJson1DeleteCustomLineItemCommand = deserializeAws_restJson1DeleteCustomLineItemCommand;
1283
1217
  const deserializeAws_restJson1DeleteCustomLineItemCommandError = async (output, context) => {
@@ -1285,7 +1219,6 @@ const deserializeAws_restJson1DeleteCustomLineItemCommandError = async (output,
1285
1219
  ...output,
1286
1220
  body: await parseBody(output.body, context),
1287
1221
  };
1288
- let response;
1289
1222
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1290
1223
  switch (errorCode) {
1291
1224
  case "AccessDeniedException":
@@ -1305,29 +1238,26 @@ const deserializeAws_restJson1DeleteCustomLineItemCommandError = async (output,
1305
1238
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1306
1239
  default:
1307
1240
  const parsedBody = parsedOutput.body;
1308
- const $metadata = deserializeMetadata(output);
1309
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1310
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1311
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1312
- $fault: "client",
1313
- $metadata,
1241
+ (0, smithy_client_1.throwDefaultError)({
1242
+ output,
1243
+ parsedBody,
1244
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1245
+ errorCode,
1314
1246
  });
1315
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1316
1247
  }
1317
1248
  };
1318
1249
  const deserializeAws_restJson1DeletePricingPlanCommand = async (output, context) => {
1319
1250
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1320
1251
  return deserializeAws_restJson1DeletePricingPlanCommandError(output, context);
1321
1252
  }
1322
- const contents = {
1253
+ const contents = map({
1323
1254
  $metadata: deserializeMetadata(output),
1324
- Arn: undefined,
1325
- };
1255
+ });
1326
1256
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1327
- if (data.Arn !== undefined && data.Arn !== null) {
1257
+ if (data.Arn != null) {
1328
1258
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1329
1259
  }
1330
- return Promise.resolve(contents);
1260
+ return contents;
1331
1261
  };
1332
1262
  exports.deserializeAws_restJson1DeletePricingPlanCommand = deserializeAws_restJson1DeletePricingPlanCommand;
1333
1263
  const deserializeAws_restJson1DeletePricingPlanCommandError = async (output, context) => {
@@ -1335,7 +1265,6 @@ const deserializeAws_restJson1DeletePricingPlanCommandError = async (output, con
1335
1265
  ...output,
1336
1266
  body: await parseBody(output.body, context),
1337
1267
  };
1338
- let response;
1339
1268
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1340
1269
  switch (errorCode) {
1341
1270
  case "AccessDeniedException":
@@ -1355,29 +1284,26 @@ const deserializeAws_restJson1DeletePricingPlanCommandError = async (output, con
1355
1284
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1356
1285
  default:
1357
1286
  const parsedBody = parsedOutput.body;
1358
- const $metadata = deserializeMetadata(output);
1359
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1360
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1361
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1362
- $fault: "client",
1363
- $metadata,
1287
+ (0, smithy_client_1.throwDefaultError)({
1288
+ output,
1289
+ parsedBody,
1290
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1291
+ errorCode,
1364
1292
  });
1365
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1366
1293
  }
1367
1294
  };
1368
1295
  const deserializeAws_restJson1DeletePricingRuleCommand = async (output, context) => {
1369
1296
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1370
1297
  return deserializeAws_restJson1DeletePricingRuleCommandError(output, context);
1371
1298
  }
1372
- const contents = {
1299
+ const contents = map({
1373
1300
  $metadata: deserializeMetadata(output),
1374
- Arn: undefined,
1375
- };
1301
+ });
1376
1302
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1377
- if (data.Arn !== undefined && data.Arn !== null) {
1303
+ if (data.Arn != null) {
1378
1304
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1379
1305
  }
1380
- return Promise.resolve(contents);
1306
+ return contents;
1381
1307
  };
1382
1308
  exports.deserializeAws_restJson1DeletePricingRuleCommand = deserializeAws_restJson1DeletePricingRuleCommand;
1383
1309
  const deserializeAws_restJson1DeletePricingRuleCommandError = async (output, context) => {
@@ -1385,7 +1311,6 @@ const deserializeAws_restJson1DeletePricingRuleCommandError = async (output, con
1385
1311
  ...output,
1386
1312
  body: await parseBody(output.body, context),
1387
1313
  };
1388
- let response;
1389
1314
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1390
1315
  switch (errorCode) {
1391
1316
  case "AccessDeniedException":
@@ -1405,29 +1330,26 @@ const deserializeAws_restJson1DeletePricingRuleCommandError = async (output, con
1405
1330
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1406
1331
  default:
1407
1332
  const parsedBody = parsedOutput.body;
1408
- const $metadata = deserializeMetadata(output);
1409
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1410
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1411
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1412
- $fault: "client",
1413
- $metadata,
1333
+ (0, smithy_client_1.throwDefaultError)({
1334
+ output,
1335
+ parsedBody,
1336
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1337
+ errorCode,
1414
1338
  });
1415
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1416
1339
  }
1417
1340
  };
1418
1341
  const deserializeAws_restJson1DisassociateAccountsCommand = async (output, context) => {
1419
1342
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1420
1343
  return deserializeAws_restJson1DisassociateAccountsCommandError(output, context);
1421
1344
  }
1422
- const contents = {
1345
+ const contents = map({
1423
1346
  $metadata: deserializeMetadata(output),
1424
- Arn: undefined,
1425
- };
1347
+ });
1426
1348
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1427
- if (data.Arn !== undefined && data.Arn !== null) {
1349
+ if (data.Arn != null) {
1428
1350
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1429
1351
  }
1430
- return Promise.resolve(contents);
1352
+ return contents;
1431
1353
  };
1432
1354
  exports.deserializeAws_restJson1DisassociateAccountsCommand = deserializeAws_restJson1DisassociateAccountsCommand;
1433
1355
  const deserializeAws_restJson1DisassociateAccountsCommandError = async (output, context) => {
@@ -1435,7 +1357,6 @@ const deserializeAws_restJson1DisassociateAccountsCommandError = async (output,
1435
1357
  ...output,
1436
1358
  body: await parseBody(output.body, context),
1437
1359
  };
1438
- let response;
1439
1360
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1440
1361
  switch (errorCode) {
1441
1362
  case "AccessDeniedException":
@@ -1458,29 +1379,26 @@ const deserializeAws_restJson1DisassociateAccountsCommandError = async (output,
1458
1379
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1459
1380
  default:
1460
1381
  const parsedBody = parsedOutput.body;
1461
- const $metadata = deserializeMetadata(output);
1462
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1463
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1464
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1465
- $fault: "client",
1466
- $metadata,
1382
+ (0, smithy_client_1.throwDefaultError)({
1383
+ output,
1384
+ parsedBody,
1385
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1386
+ errorCode,
1467
1387
  });
1468
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1469
1388
  }
1470
1389
  };
1471
1390
  const deserializeAws_restJson1DisassociatePricingRulesCommand = async (output, context) => {
1472
1391
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1473
1392
  return deserializeAws_restJson1DisassociatePricingRulesCommandError(output, context);
1474
1393
  }
1475
- const contents = {
1394
+ const contents = map({
1476
1395
  $metadata: deserializeMetadata(output),
1477
- Arn: undefined,
1478
- };
1396
+ });
1479
1397
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1480
- if (data.Arn !== undefined && data.Arn !== null) {
1398
+ if (data.Arn != null) {
1481
1399
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1482
1400
  }
1483
- return Promise.resolve(contents);
1401
+ return contents;
1484
1402
  };
1485
1403
  exports.deserializeAws_restJson1DisassociatePricingRulesCommand = deserializeAws_restJson1DisassociatePricingRulesCommand;
1486
1404
  const deserializeAws_restJson1DisassociatePricingRulesCommandError = async (output, context) => {
@@ -1488,7 +1406,6 @@ const deserializeAws_restJson1DisassociatePricingRulesCommandError = async (outp
1488
1406
  ...output,
1489
1407
  body: await parseBody(output.body, context),
1490
1408
  };
1491
- let response;
1492
1409
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1493
1410
  switch (errorCode) {
1494
1411
  case "AccessDeniedException":
@@ -1511,33 +1428,29 @@ const deserializeAws_restJson1DisassociatePricingRulesCommandError = async (outp
1511
1428
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1512
1429
  default:
1513
1430
  const parsedBody = parsedOutput.body;
1514
- const $metadata = deserializeMetadata(output);
1515
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1516
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1517
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1518
- $fault: "client",
1519
- $metadata,
1431
+ (0, smithy_client_1.throwDefaultError)({
1432
+ output,
1433
+ parsedBody,
1434
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1435
+ errorCode,
1520
1436
  });
1521
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1522
1437
  }
1523
1438
  };
1524
1439
  const deserializeAws_restJson1ListAccountAssociationsCommand = async (output, context) => {
1525
1440
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1526
1441
  return deserializeAws_restJson1ListAccountAssociationsCommandError(output, context);
1527
1442
  }
1528
- const contents = {
1443
+ const contents = map({
1529
1444
  $metadata: deserializeMetadata(output),
1530
- LinkedAccounts: undefined,
1531
- NextToken: undefined,
1532
- };
1445
+ });
1533
1446
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1534
- if (data.LinkedAccounts !== undefined && data.LinkedAccounts !== null) {
1447
+ if (data.LinkedAccounts != null) {
1535
1448
  contents.LinkedAccounts = deserializeAws_restJson1AccountAssociationsList(data.LinkedAccounts, context);
1536
1449
  }
1537
- if (data.NextToken !== undefined && data.NextToken !== null) {
1450
+ if (data.NextToken != null) {
1538
1451
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1539
1452
  }
1540
- return Promise.resolve(contents);
1453
+ return contents;
1541
1454
  };
1542
1455
  exports.deserializeAws_restJson1ListAccountAssociationsCommand = deserializeAws_restJson1ListAccountAssociationsCommand;
1543
1456
  const deserializeAws_restJson1ListAccountAssociationsCommandError = async (output, context) => {
@@ -1545,7 +1458,6 @@ const deserializeAws_restJson1ListAccountAssociationsCommandError = async (outpu
1545
1458
  ...output,
1546
1459
  body: await parseBody(output.body, context),
1547
1460
  };
1548
- let response;
1549
1461
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1550
1462
  switch (errorCode) {
1551
1463
  case "AccessDeniedException":
@@ -1565,33 +1477,29 @@ const deserializeAws_restJson1ListAccountAssociationsCommandError = async (outpu
1565
1477
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1566
1478
  default:
1567
1479
  const parsedBody = parsedOutput.body;
1568
- const $metadata = deserializeMetadata(output);
1569
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1570
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1571
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1572
- $fault: "client",
1573
- $metadata,
1480
+ (0, smithy_client_1.throwDefaultError)({
1481
+ output,
1482
+ parsedBody,
1483
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1484
+ errorCode,
1574
1485
  });
1575
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1576
1486
  }
1577
1487
  };
1578
1488
  const deserializeAws_restJson1ListBillingGroupCostReportsCommand = async (output, context) => {
1579
1489
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1580
1490
  return deserializeAws_restJson1ListBillingGroupCostReportsCommandError(output, context);
1581
1491
  }
1582
- const contents = {
1492
+ const contents = map({
1583
1493
  $metadata: deserializeMetadata(output),
1584
- BillingGroupCostReports: undefined,
1585
- NextToken: undefined,
1586
- };
1494
+ });
1587
1495
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1588
- if (data.BillingGroupCostReports !== undefined && data.BillingGroupCostReports !== null) {
1496
+ if (data.BillingGroupCostReports != null) {
1589
1497
  contents.BillingGroupCostReports = deserializeAws_restJson1BillingGroupCostReportList(data.BillingGroupCostReports, context);
1590
1498
  }
1591
- if (data.NextToken !== undefined && data.NextToken !== null) {
1499
+ if (data.NextToken != null) {
1592
1500
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1593
1501
  }
1594
- return Promise.resolve(contents);
1502
+ return contents;
1595
1503
  };
1596
1504
  exports.deserializeAws_restJson1ListBillingGroupCostReportsCommand = deserializeAws_restJson1ListBillingGroupCostReportsCommand;
1597
1505
  const deserializeAws_restJson1ListBillingGroupCostReportsCommandError = async (output, context) => {
@@ -1599,7 +1507,6 @@ const deserializeAws_restJson1ListBillingGroupCostReportsCommandError = async (o
1599
1507
  ...output,
1600
1508
  body: await parseBody(output.body, context),
1601
1509
  };
1602
- let response;
1603
1510
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1604
1511
  switch (errorCode) {
1605
1512
  case "AccessDeniedException":
@@ -1619,33 +1526,29 @@ const deserializeAws_restJson1ListBillingGroupCostReportsCommandError = async (o
1619
1526
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1620
1527
  default:
1621
1528
  const parsedBody = parsedOutput.body;
1622
- const $metadata = deserializeMetadata(output);
1623
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1624
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1625
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1626
- $fault: "client",
1627
- $metadata,
1529
+ (0, smithy_client_1.throwDefaultError)({
1530
+ output,
1531
+ parsedBody,
1532
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1533
+ errorCode,
1628
1534
  });
1629
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1630
1535
  }
1631
1536
  };
1632
1537
  const deserializeAws_restJson1ListBillingGroupsCommand = async (output, context) => {
1633
1538
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1634
1539
  return deserializeAws_restJson1ListBillingGroupsCommandError(output, context);
1635
1540
  }
1636
- const contents = {
1541
+ const contents = map({
1637
1542
  $metadata: deserializeMetadata(output),
1638
- BillingGroups: undefined,
1639
- NextToken: undefined,
1640
- };
1543
+ });
1641
1544
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1642
- if (data.BillingGroups !== undefined && data.BillingGroups !== null) {
1545
+ if (data.BillingGroups != null) {
1643
1546
  contents.BillingGroups = deserializeAws_restJson1BillingGroupList(data.BillingGroups, context);
1644
1547
  }
1645
- if (data.NextToken !== undefined && data.NextToken !== null) {
1548
+ if (data.NextToken != null) {
1646
1549
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1647
1550
  }
1648
- return Promise.resolve(contents);
1551
+ return contents;
1649
1552
  };
1650
1553
  exports.deserializeAws_restJson1ListBillingGroupsCommand = deserializeAws_restJson1ListBillingGroupsCommand;
1651
1554
  const deserializeAws_restJson1ListBillingGroupsCommandError = async (output, context) => {
@@ -1653,7 +1556,6 @@ const deserializeAws_restJson1ListBillingGroupsCommandError = async (output, con
1653
1556
  ...output,
1654
1557
  body: await parseBody(output.body, context),
1655
1558
  };
1656
- let response;
1657
1559
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1658
1560
  switch (errorCode) {
1659
1561
  case "AccessDeniedException":
@@ -1673,33 +1575,29 @@ const deserializeAws_restJson1ListBillingGroupsCommandError = async (output, con
1673
1575
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1674
1576
  default:
1675
1577
  const parsedBody = parsedOutput.body;
1676
- const $metadata = deserializeMetadata(output);
1677
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1678
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1679
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1680
- $fault: "client",
1681
- $metadata,
1578
+ (0, smithy_client_1.throwDefaultError)({
1579
+ output,
1580
+ parsedBody,
1581
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1582
+ errorCode,
1682
1583
  });
1683
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1684
1584
  }
1685
1585
  };
1686
1586
  const deserializeAws_restJson1ListCustomLineItemsCommand = async (output, context) => {
1687
1587
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1688
1588
  return deserializeAws_restJson1ListCustomLineItemsCommandError(output, context);
1689
1589
  }
1690
- const contents = {
1590
+ const contents = map({
1691
1591
  $metadata: deserializeMetadata(output),
1692
- CustomLineItems: undefined,
1693
- NextToken: undefined,
1694
- };
1592
+ });
1695
1593
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1696
- if (data.CustomLineItems !== undefined && data.CustomLineItems !== null) {
1594
+ if (data.CustomLineItems != null) {
1697
1595
  contents.CustomLineItems = deserializeAws_restJson1CustomLineItemList(data.CustomLineItems, context);
1698
1596
  }
1699
- if (data.NextToken !== undefined && data.NextToken !== null) {
1597
+ if (data.NextToken != null) {
1700
1598
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1701
1599
  }
1702
- return Promise.resolve(contents);
1600
+ return contents;
1703
1601
  };
1704
1602
  exports.deserializeAws_restJson1ListCustomLineItemsCommand = deserializeAws_restJson1ListCustomLineItemsCommand;
1705
1603
  const deserializeAws_restJson1ListCustomLineItemsCommandError = async (output, context) => {
@@ -1707,7 +1605,6 @@ const deserializeAws_restJson1ListCustomLineItemsCommandError = async (output, c
1707
1605
  ...output,
1708
1606
  body: await parseBody(output.body, context),
1709
1607
  };
1710
- let response;
1711
1608
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1712
1609
  switch (errorCode) {
1713
1610
  case "AccessDeniedException":
@@ -1727,37 +1624,32 @@ const deserializeAws_restJson1ListCustomLineItemsCommandError = async (output, c
1727
1624
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1728
1625
  default:
1729
1626
  const parsedBody = parsedOutput.body;
1730
- const $metadata = deserializeMetadata(output);
1731
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1732
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1733
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1734
- $fault: "client",
1735
- $metadata,
1627
+ (0, smithy_client_1.throwDefaultError)({
1628
+ output,
1629
+ parsedBody,
1630
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1631
+ errorCode,
1736
1632
  });
1737
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1738
1633
  }
1739
1634
  };
1740
1635
  const deserializeAws_restJson1ListPricingPlansCommand = async (output, context) => {
1741
1636
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1742
1637
  return deserializeAws_restJson1ListPricingPlansCommandError(output, context);
1743
1638
  }
1744
- const contents = {
1639
+ const contents = map({
1745
1640
  $metadata: deserializeMetadata(output),
1746
- BillingPeriod: undefined,
1747
- NextToken: undefined,
1748
- PricingPlans: undefined,
1749
- };
1641
+ });
1750
1642
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1751
- if (data.BillingPeriod !== undefined && data.BillingPeriod !== null) {
1643
+ if (data.BillingPeriod != null) {
1752
1644
  contents.BillingPeriod = (0, smithy_client_1.expectString)(data.BillingPeriod);
1753
1645
  }
1754
- if (data.NextToken !== undefined && data.NextToken !== null) {
1646
+ if (data.NextToken != null) {
1755
1647
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1756
1648
  }
1757
- if (data.PricingPlans !== undefined && data.PricingPlans !== null) {
1649
+ if (data.PricingPlans != null) {
1758
1650
  contents.PricingPlans = deserializeAws_restJson1PricingPlanList(data.PricingPlans, context);
1759
1651
  }
1760
- return Promise.resolve(contents);
1652
+ return contents;
1761
1653
  };
1762
1654
  exports.deserializeAws_restJson1ListPricingPlansCommand = deserializeAws_restJson1ListPricingPlansCommand;
1763
1655
  const deserializeAws_restJson1ListPricingPlansCommandError = async (output, context) => {
@@ -1765,7 +1657,6 @@ const deserializeAws_restJson1ListPricingPlansCommandError = async (output, cont
1765
1657
  ...output,
1766
1658
  body: await parseBody(output.body, context),
1767
1659
  };
1768
- let response;
1769
1660
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1770
1661
  switch (errorCode) {
1771
1662
  case "AccessDeniedException":
@@ -1782,41 +1673,35 @@ const deserializeAws_restJson1ListPricingPlansCommandError = async (output, cont
1782
1673
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1783
1674
  default:
1784
1675
  const parsedBody = parsedOutput.body;
1785
- const $metadata = deserializeMetadata(output);
1786
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1787
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1788
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1789
- $fault: "client",
1790
- $metadata,
1676
+ (0, smithy_client_1.throwDefaultError)({
1677
+ output,
1678
+ parsedBody,
1679
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1680
+ errorCode,
1791
1681
  });
1792
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1793
1682
  }
1794
1683
  };
1795
1684
  const deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand = async (output, context) => {
1796
1685
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1797
1686
  return deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommandError(output, context);
1798
1687
  }
1799
- const contents = {
1688
+ const contents = map({
1800
1689
  $metadata: deserializeMetadata(output),
1801
- BillingPeriod: undefined,
1802
- NextToken: undefined,
1803
- PricingPlanArns: undefined,
1804
- PricingRuleArn: undefined,
1805
- };
1690
+ });
1806
1691
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1807
- if (data.BillingPeriod !== undefined && data.BillingPeriod !== null) {
1692
+ if (data.BillingPeriod != null) {
1808
1693
  contents.BillingPeriod = (0, smithy_client_1.expectString)(data.BillingPeriod);
1809
1694
  }
1810
- if (data.NextToken !== undefined && data.NextToken !== null) {
1695
+ if (data.NextToken != null) {
1811
1696
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1812
1697
  }
1813
- if (data.PricingPlanArns !== undefined && data.PricingPlanArns !== null) {
1698
+ if (data.PricingPlanArns != null) {
1814
1699
  contents.PricingPlanArns = deserializeAws_restJson1PricingPlanArns(data.PricingPlanArns, context);
1815
1700
  }
1816
- if (data.PricingRuleArn !== undefined && data.PricingRuleArn !== null) {
1701
+ if (data.PricingRuleArn != null) {
1817
1702
  contents.PricingRuleArn = (0, smithy_client_1.expectString)(data.PricingRuleArn);
1818
1703
  }
1819
- return Promise.resolve(contents);
1704
+ return contents;
1820
1705
  };
1821
1706
  exports.deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand = deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand;
1822
1707
  const deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommandError = async (output, context) => {
@@ -1824,7 +1709,6 @@ const deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommandEr
1824
1709
  ...output,
1825
1710
  body: await parseBody(output.body, context),
1826
1711
  };
1827
- let response;
1828
1712
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1829
1713
  switch (errorCode) {
1830
1714
  case "AccessDeniedException":
@@ -1844,37 +1728,32 @@ const deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommandEr
1844
1728
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1845
1729
  default:
1846
1730
  const parsedBody = parsedOutput.body;
1847
- const $metadata = deserializeMetadata(output);
1848
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1849
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1850
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1851
- $fault: "client",
1852
- $metadata,
1731
+ (0, smithy_client_1.throwDefaultError)({
1732
+ output,
1733
+ parsedBody,
1734
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1735
+ errorCode,
1853
1736
  });
1854
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1855
1737
  }
1856
1738
  };
1857
1739
  const deserializeAws_restJson1ListPricingRulesCommand = async (output, context) => {
1858
1740
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1859
1741
  return deserializeAws_restJson1ListPricingRulesCommandError(output, context);
1860
1742
  }
1861
- const contents = {
1743
+ const contents = map({
1862
1744
  $metadata: deserializeMetadata(output),
1863
- BillingPeriod: undefined,
1864
- NextToken: undefined,
1865
- PricingRules: undefined,
1866
- };
1745
+ });
1867
1746
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1868
- if (data.BillingPeriod !== undefined && data.BillingPeriod !== null) {
1747
+ if (data.BillingPeriod != null) {
1869
1748
  contents.BillingPeriod = (0, smithy_client_1.expectString)(data.BillingPeriod);
1870
1749
  }
1871
- if (data.NextToken !== undefined && data.NextToken !== null) {
1750
+ if (data.NextToken != null) {
1872
1751
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1873
1752
  }
1874
- if (data.PricingRules !== undefined && data.PricingRules !== null) {
1753
+ if (data.PricingRules != null) {
1875
1754
  contents.PricingRules = deserializeAws_restJson1PricingRuleList(data.PricingRules, context);
1876
1755
  }
1877
- return Promise.resolve(contents);
1756
+ return contents;
1878
1757
  };
1879
1758
  exports.deserializeAws_restJson1ListPricingRulesCommand = deserializeAws_restJson1ListPricingRulesCommand;
1880
1759
  const deserializeAws_restJson1ListPricingRulesCommandError = async (output, context) => {
@@ -1882,7 +1761,6 @@ const deserializeAws_restJson1ListPricingRulesCommandError = async (output, cont
1882
1761
  ...output,
1883
1762
  body: await parseBody(output.body, context),
1884
1763
  };
1885
- let response;
1886
1764
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1887
1765
  switch (errorCode) {
1888
1766
  case "AccessDeniedException":
@@ -1899,41 +1777,35 @@ const deserializeAws_restJson1ListPricingRulesCommandError = async (output, cont
1899
1777
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1900
1778
  default:
1901
1779
  const parsedBody = parsedOutput.body;
1902
- const $metadata = deserializeMetadata(output);
1903
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1904
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1905
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1906
- $fault: "client",
1907
- $metadata,
1780
+ (0, smithy_client_1.throwDefaultError)({
1781
+ output,
1782
+ parsedBody,
1783
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1784
+ errorCode,
1908
1785
  });
1909
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1910
1786
  }
1911
1787
  };
1912
1788
  const deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand = async (output, context) => {
1913
1789
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1914
1790
  return deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommandError(output, context);
1915
1791
  }
1916
- const contents = {
1792
+ const contents = map({
1917
1793
  $metadata: deserializeMetadata(output),
1918
- BillingPeriod: undefined,
1919
- NextToken: undefined,
1920
- PricingPlanArn: undefined,
1921
- PricingRuleArns: undefined,
1922
- };
1794
+ });
1923
1795
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1924
- if (data.BillingPeriod !== undefined && data.BillingPeriod !== null) {
1796
+ if (data.BillingPeriod != null) {
1925
1797
  contents.BillingPeriod = (0, smithy_client_1.expectString)(data.BillingPeriod);
1926
1798
  }
1927
- if (data.NextToken !== undefined && data.NextToken !== null) {
1799
+ if (data.NextToken != null) {
1928
1800
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1929
1801
  }
1930
- if (data.PricingPlanArn !== undefined && data.PricingPlanArn !== null) {
1802
+ if (data.PricingPlanArn != null) {
1931
1803
  contents.PricingPlanArn = (0, smithy_client_1.expectString)(data.PricingPlanArn);
1932
1804
  }
1933
- if (data.PricingRuleArns !== undefined && data.PricingRuleArns !== null) {
1805
+ if (data.PricingRuleArns != null) {
1934
1806
  contents.PricingRuleArns = deserializeAws_restJson1PricingRuleArns(data.PricingRuleArns, context);
1935
1807
  }
1936
- return Promise.resolve(contents);
1808
+ return contents;
1937
1809
  };
1938
1810
  exports.deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand = deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand;
1939
1811
  const deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommandError = async (output, context) => {
@@ -1941,7 +1813,6 @@ const deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommandErro
1941
1813
  ...output,
1942
1814
  body: await parseBody(output.body, context),
1943
1815
  };
1944
- let response;
1945
1816
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1946
1817
  switch (errorCode) {
1947
1818
  case "AccessDeniedException":
@@ -1961,37 +1832,32 @@ const deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommandErro
1961
1832
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1962
1833
  default:
1963
1834
  const parsedBody = parsedOutput.body;
1964
- const $metadata = deserializeMetadata(output);
1965
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1966
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
1967
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1968
- $fault: "client",
1969
- $metadata,
1835
+ (0, smithy_client_1.throwDefaultError)({
1836
+ output,
1837
+ parsedBody,
1838
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1839
+ errorCode,
1970
1840
  });
1971
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1972
1841
  }
1973
1842
  };
1974
1843
  const deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand = async (output, context) => {
1975
1844
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1976
1845
  return deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommandError(output, context);
1977
1846
  }
1978
- const contents = {
1847
+ const contents = map({
1979
1848
  $metadata: deserializeMetadata(output),
1980
- Arn: undefined,
1981
- AssociatedResources: undefined,
1982
- NextToken: undefined,
1983
- };
1849
+ });
1984
1850
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1985
- if (data.Arn !== undefined && data.Arn !== null) {
1851
+ if (data.Arn != null) {
1986
1852
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1987
1853
  }
1988
- if (data.AssociatedResources !== undefined && data.AssociatedResources !== null) {
1854
+ if (data.AssociatedResources != null) {
1989
1855
  contents.AssociatedResources = deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemResponseList(data.AssociatedResources, context);
1990
1856
  }
1991
- if (data.NextToken !== undefined && data.NextToken !== null) {
1857
+ if (data.NextToken != null) {
1992
1858
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1993
1859
  }
1994
- return Promise.resolve(contents);
1860
+ return contents;
1995
1861
  };
1996
1862
  exports.deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand = deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand;
1997
1863
  const deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommandError = async (output, context) => {
@@ -1999,7 +1865,6 @@ const deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommandErro
1999
1865
  ...output,
2000
1866
  body: await parseBody(output.body, context),
2001
1867
  };
2002
- let response;
2003
1868
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2004
1869
  switch (errorCode) {
2005
1870
  case "AccessDeniedException":
@@ -2019,29 +1884,26 @@ const deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommandErro
2019
1884
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2020
1885
  default:
2021
1886
  const parsedBody = parsedOutput.body;
2022
- const $metadata = deserializeMetadata(output);
2023
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2024
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
2025
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2026
- $fault: "client",
2027
- $metadata,
1887
+ (0, smithy_client_1.throwDefaultError)({
1888
+ output,
1889
+ parsedBody,
1890
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1891
+ errorCode,
2028
1892
  });
2029
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2030
1893
  }
2031
1894
  };
2032
1895
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2033
1896
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2034
1897
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2035
1898
  }
2036
- const contents = {
1899
+ const contents = map({
2037
1900
  $metadata: deserializeMetadata(output),
2038
- Tags: undefined,
2039
- };
1901
+ });
2040
1902
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2041
- if (data.Tags !== undefined && data.Tags !== null) {
1903
+ if (data.Tags != null) {
2042
1904
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
2043
1905
  }
2044
- return Promise.resolve(contents);
1906
+ return contents;
2045
1907
  };
2046
1908
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2047
1909
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -2049,7 +1911,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2049
1911
  ...output,
2050
1912
  body: await parseBody(output.body, context),
2051
1913
  };
2052
- let response;
2053
1914
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2054
1915
  switch (errorCode) {
2055
1916
  case "AccessDeniedException":
@@ -2069,25 +1930,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2069
1930
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2070
1931
  default:
2071
1932
  const parsedBody = parsedOutput.body;
2072
- const $metadata = deserializeMetadata(output);
2073
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2074
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
2075
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2076
- $fault: "client",
2077
- $metadata,
1933
+ (0, smithy_client_1.throwDefaultError)({
1934
+ output,
1935
+ parsedBody,
1936
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1937
+ errorCode,
2078
1938
  });
2079
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2080
1939
  }
2081
1940
  };
2082
1941
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2083
1942
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2084
1943
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2085
1944
  }
2086
- const contents = {
1945
+ const contents = map({
2087
1946
  $metadata: deserializeMetadata(output),
2088
- };
1947
+ });
2089
1948
  await collectBody(output.body, context);
2090
- return Promise.resolve(contents);
1949
+ return contents;
2091
1950
  };
2092
1951
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2093
1952
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2095,7 +1954,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2095
1954
  ...output,
2096
1955
  body: await parseBody(output.body, context),
2097
1956
  };
2098
- let response;
2099
1957
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2100
1958
  switch (errorCode) {
2101
1959
  case "AccessDeniedException":
@@ -2115,25 +1973,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2115
1973
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2116
1974
  default:
2117
1975
  const parsedBody = parsedOutput.body;
2118
- const $metadata = deserializeMetadata(output);
2119
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2120
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
2121
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2122
- $fault: "client",
2123
- $metadata,
1976
+ (0, smithy_client_1.throwDefaultError)({
1977
+ output,
1978
+ parsedBody,
1979
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
1980
+ errorCode,
2124
1981
  });
2125
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2126
1982
  }
2127
1983
  };
2128
1984
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2129
1985
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2130
1986
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2131
1987
  }
2132
- const contents = {
1988
+ const contents = map({
2133
1989
  $metadata: deserializeMetadata(output),
2134
- };
1990
+ });
2135
1991
  await collectBody(output.body, context);
2136
- return Promise.resolve(contents);
1992
+ return contents;
2137
1993
  };
2138
1994
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2139
1995
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2141,7 +1997,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2141
1997
  ...output,
2142
1998
  body: await parseBody(output.body, context),
2143
1999
  };
2144
- let response;
2145
2000
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2146
2001
  switch (errorCode) {
2147
2002
  case "AccessDeniedException":
@@ -2161,61 +2016,50 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2161
2016
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2162
2017
  default:
2163
2018
  const parsedBody = parsedOutput.body;
2164
- const $metadata = deserializeMetadata(output);
2165
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2166
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
2167
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2168
- $fault: "client",
2169
- $metadata,
2019
+ (0, smithy_client_1.throwDefaultError)({
2020
+ output,
2021
+ parsedBody,
2022
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
2023
+ errorCode,
2170
2024
  });
2171
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2172
2025
  }
2173
2026
  };
2174
2027
  const deserializeAws_restJson1UpdateBillingGroupCommand = async (output, context) => {
2175
2028
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2176
2029
  return deserializeAws_restJson1UpdateBillingGroupCommandError(output, context);
2177
2030
  }
2178
- const contents = {
2031
+ const contents = map({
2179
2032
  $metadata: deserializeMetadata(output),
2180
- Arn: undefined,
2181
- Description: undefined,
2182
- LastModifiedTime: undefined,
2183
- Name: undefined,
2184
- PricingPlanArn: undefined,
2185
- PrimaryAccountId: undefined,
2186
- Size: undefined,
2187
- Status: undefined,
2188
- StatusReason: undefined,
2189
- };
2033
+ });
2190
2034
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2191
- if (data.Arn !== undefined && data.Arn !== null) {
2035
+ if (data.Arn != null) {
2192
2036
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2193
2037
  }
2194
- if (data.Description !== undefined && data.Description !== null) {
2038
+ if (data.Description != null) {
2195
2039
  contents.Description = (0, smithy_client_1.expectString)(data.Description);
2196
2040
  }
2197
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2041
+ if (data.LastModifiedTime != null) {
2198
2042
  contents.LastModifiedTime = (0, smithy_client_1.expectLong)(data.LastModifiedTime);
2199
2043
  }
2200
- if (data.Name !== undefined && data.Name !== null) {
2044
+ if (data.Name != null) {
2201
2045
  contents.Name = (0, smithy_client_1.expectString)(data.Name);
2202
2046
  }
2203
- if (data.PricingPlanArn !== undefined && data.PricingPlanArn !== null) {
2047
+ if (data.PricingPlanArn != null) {
2204
2048
  contents.PricingPlanArn = (0, smithy_client_1.expectString)(data.PricingPlanArn);
2205
2049
  }
2206
- if (data.PrimaryAccountId !== undefined && data.PrimaryAccountId !== null) {
2050
+ if (data.PrimaryAccountId != null) {
2207
2051
  contents.PrimaryAccountId = (0, smithy_client_1.expectString)(data.PrimaryAccountId);
2208
2052
  }
2209
- if (data.Size !== undefined && data.Size !== null) {
2053
+ if (data.Size != null) {
2210
2054
  contents.Size = (0, smithy_client_1.expectLong)(data.Size);
2211
2055
  }
2212
- if (data.Status !== undefined && data.Status !== null) {
2056
+ if (data.Status != null) {
2213
2057
  contents.Status = (0, smithy_client_1.expectString)(data.Status);
2214
2058
  }
2215
- if (data.StatusReason !== undefined && data.StatusReason !== null) {
2059
+ if (data.StatusReason != null) {
2216
2060
  contents.StatusReason = (0, smithy_client_1.expectString)(data.StatusReason);
2217
2061
  }
2218
- return Promise.resolve(contents);
2062
+ return contents;
2219
2063
  };
2220
2064
  exports.deserializeAws_restJson1UpdateBillingGroupCommand = deserializeAws_restJson1UpdateBillingGroupCommand;
2221
2065
  const deserializeAws_restJson1UpdateBillingGroupCommandError = async (output, context) => {
@@ -2223,7 +2067,6 @@ const deserializeAws_restJson1UpdateBillingGroupCommandError = async (output, co
2223
2067
  ...output,
2224
2068
  body: await parseBody(output.body, context),
2225
2069
  };
2226
- let response;
2227
2070
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2228
2071
  switch (errorCode) {
2229
2072
  case "AccessDeniedException":
@@ -2246,53 +2089,44 @@ const deserializeAws_restJson1UpdateBillingGroupCommandError = async (output, co
2246
2089
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2247
2090
  default:
2248
2091
  const parsedBody = parsedOutput.body;
2249
- const $metadata = deserializeMetadata(output);
2250
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2251
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
2252
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2253
- $fault: "client",
2254
- $metadata,
2092
+ (0, smithy_client_1.throwDefaultError)({
2093
+ output,
2094
+ parsedBody,
2095
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
2096
+ errorCode,
2255
2097
  });
2256
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2257
2098
  }
2258
2099
  };
2259
2100
  const deserializeAws_restJson1UpdateCustomLineItemCommand = async (output, context) => {
2260
2101
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2261
2102
  return deserializeAws_restJson1UpdateCustomLineItemCommandError(output, context);
2262
2103
  }
2263
- const contents = {
2104
+ const contents = map({
2264
2105
  $metadata: deserializeMetadata(output),
2265
- Arn: undefined,
2266
- AssociationSize: undefined,
2267
- BillingGroupArn: undefined,
2268
- ChargeDetails: undefined,
2269
- Description: undefined,
2270
- LastModifiedTime: undefined,
2271
- Name: undefined,
2272
- };
2106
+ });
2273
2107
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2274
- if (data.Arn !== undefined && data.Arn !== null) {
2108
+ if (data.Arn != null) {
2275
2109
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2276
2110
  }
2277
- if (data.AssociationSize !== undefined && data.AssociationSize !== null) {
2111
+ if (data.AssociationSize != null) {
2278
2112
  contents.AssociationSize = (0, smithy_client_1.expectLong)(data.AssociationSize);
2279
2113
  }
2280
- if (data.BillingGroupArn !== undefined && data.BillingGroupArn !== null) {
2114
+ if (data.BillingGroupArn != null) {
2281
2115
  contents.BillingGroupArn = (0, smithy_client_1.expectString)(data.BillingGroupArn);
2282
2116
  }
2283
- if (data.ChargeDetails !== undefined && data.ChargeDetails !== null) {
2117
+ if (data.ChargeDetails != null) {
2284
2118
  contents.ChargeDetails = deserializeAws_restJson1ListCustomLineItemChargeDetails(data.ChargeDetails, context);
2285
2119
  }
2286
- if (data.Description !== undefined && data.Description !== null) {
2120
+ if (data.Description != null) {
2287
2121
  contents.Description = (0, smithy_client_1.expectString)(data.Description);
2288
2122
  }
2289
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2123
+ if (data.LastModifiedTime != null) {
2290
2124
  contents.LastModifiedTime = (0, smithy_client_1.expectLong)(data.LastModifiedTime);
2291
2125
  }
2292
- if (data.Name !== undefined && data.Name !== null) {
2126
+ if (data.Name != null) {
2293
2127
  contents.Name = (0, smithy_client_1.expectString)(data.Name);
2294
2128
  }
2295
- return Promise.resolve(contents);
2129
+ return contents;
2296
2130
  };
2297
2131
  exports.deserializeAws_restJson1UpdateCustomLineItemCommand = deserializeAws_restJson1UpdateCustomLineItemCommand;
2298
2132
  const deserializeAws_restJson1UpdateCustomLineItemCommandError = async (output, context) => {
@@ -2300,7 +2134,6 @@ const deserializeAws_restJson1UpdateCustomLineItemCommandError = async (output,
2300
2134
  ...output,
2301
2135
  body: await parseBody(output.body, context),
2302
2136
  };
2303
- let response;
2304
2137
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2305
2138
  switch (errorCode) {
2306
2139
  case "AccessDeniedException":
@@ -2320,45 +2153,38 @@ const deserializeAws_restJson1UpdateCustomLineItemCommandError = async (output,
2320
2153
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2321
2154
  default:
2322
2155
  const parsedBody = parsedOutput.body;
2323
- const $metadata = deserializeMetadata(output);
2324
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2325
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
2326
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2327
- $fault: "client",
2328
- $metadata,
2156
+ (0, smithy_client_1.throwDefaultError)({
2157
+ output,
2158
+ parsedBody,
2159
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
2160
+ errorCode,
2329
2161
  });
2330
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2331
2162
  }
2332
2163
  };
2333
2164
  const deserializeAws_restJson1UpdatePricingPlanCommand = async (output, context) => {
2334
2165
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2335
2166
  return deserializeAws_restJson1UpdatePricingPlanCommandError(output, context);
2336
2167
  }
2337
- const contents = {
2168
+ const contents = map({
2338
2169
  $metadata: deserializeMetadata(output),
2339
- Arn: undefined,
2340
- Description: undefined,
2341
- LastModifiedTime: undefined,
2342
- Name: undefined,
2343
- Size: undefined,
2344
- };
2170
+ });
2345
2171
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2346
- if (data.Arn !== undefined && data.Arn !== null) {
2172
+ if (data.Arn != null) {
2347
2173
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2348
2174
  }
2349
- if (data.Description !== undefined && data.Description !== null) {
2175
+ if (data.Description != null) {
2350
2176
  contents.Description = (0, smithy_client_1.expectString)(data.Description);
2351
2177
  }
2352
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2178
+ if (data.LastModifiedTime != null) {
2353
2179
  contents.LastModifiedTime = (0, smithy_client_1.expectLong)(data.LastModifiedTime);
2354
2180
  }
2355
- if (data.Name !== undefined && data.Name !== null) {
2181
+ if (data.Name != null) {
2356
2182
  contents.Name = (0, smithy_client_1.expectString)(data.Name);
2357
2183
  }
2358
- if (data.Size !== undefined && data.Size !== null) {
2184
+ if (data.Size != null) {
2359
2185
  contents.Size = (0, smithy_client_1.expectLong)(data.Size);
2360
2186
  }
2361
- return Promise.resolve(contents);
2187
+ return contents;
2362
2188
  };
2363
2189
  exports.deserializeAws_restJson1UpdatePricingPlanCommand = deserializeAws_restJson1UpdatePricingPlanCommand;
2364
2190
  const deserializeAws_restJson1UpdatePricingPlanCommandError = async (output, context) => {
@@ -2366,7 +2192,6 @@ const deserializeAws_restJson1UpdatePricingPlanCommandError = async (output, con
2366
2192
  ...output,
2367
2193
  body: await parseBody(output.body, context),
2368
2194
  };
2369
- let response;
2370
2195
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2371
2196
  switch (errorCode) {
2372
2197
  case "AccessDeniedException":
@@ -2389,61 +2214,50 @@ const deserializeAws_restJson1UpdatePricingPlanCommandError = async (output, con
2389
2214
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2390
2215
  default:
2391
2216
  const parsedBody = parsedOutput.body;
2392
- const $metadata = deserializeMetadata(output);
2393
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2394
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
2395
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2396
- $fault: "client",
2397
- $metadata,
2217
+ (0, smithy_client_1.throwDefaultError)({
2218
+ output,
2219
+ parsedBody,
2220
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
2221
+ errorCode,
2398
2222
  });
2399
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2400
2223
  }
2401
2224
  };
2402
2225
  const deserializeAws_restJson1UpdatePricingRuleCommand = async (output, context) => {
2403
2226
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2404
2227
  return deserializeAws_restJson1UpdatePricingRuleCommandError(output, context);
2405
2228
  }
2406
- const contents = {
2229
+ const contents = map({
2407
2230
  $metadata: deserializeMetadata(output),
2408
- Arn: undefined,
2409
- AssociatedPricingPlanCount: undefined,
2410
- Description: undefined,
2411
- LastModifiedTime: undefined,
2412
- ModifierPercentage: undefined,
2413
- Name: undefined,
2414
- Scope: undefined,
2415
- Service: undefined,
2416
- Type: undefined,
2417
- };
2231
+ });
2418
2232
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2419
- if (data.Arn !== undefined && data.Arn !== null) {
2233
+ if (data.Arn != null) {
2420
2234
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2421
2235
  }
2422
- if (data.AssociatedPricingPlanCount !== undefined && data.AssociatedPricingPlanCount !== null) {
2236
+ if (data.AssociatedPricingPlanCount != null) {
2423
2237
  contents.AssociatedPricingPlanCount = (0, smithy_client_1.expectLong)(data.AssociatedPricingPlanCount);
2424
2238
  }
2425
- if (data.Description !== undefined && data.Description !== null) {
2239
+ if (data.Description != null) {
2426
2240
  contents.Description = (0, smithy_client_1.expectString)(data.Description);
2427
2241
  }
2428
- if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2242
+ if (data.LastModifiedTime != null) {
2429
2243
  contents.LastModifiedTime = (0, smithy_client_1.expectLong)(data.LastModifiedTime);
2430
2244
  }
2431
- if (data.ModifierPercentage !== undefined && data.ModifierPercentage !== null) {
2245
+ if (data.ModifierPercentage != null) {
2432
2246
  contents.ModifierPercentage = (0, smithy_client_1.limitedParseDouble)(data.ModifierPercentage);
2433
2247
  }
2434
- if (data.Name !== undefined && data.Name !== null) {
2248
+ if (data.Name != null) {
2435
2249
  contents.Name = (0, smithy_client_1.expectString)(data.Name);
2436
2250
  }
2437
- if (data.Scope !== undefined && data.Scope !== null) {
2251
+ if (data.Scope != null) {
2438
2252
  contents.Scope = (0, smithy_client_1.expectString)(data.Scope);
2439
2253
  }
2440
- if (data.Service !== undefined && data.Service !== null) {
2254
+ if (data.Service != null) {
2441
2255
  contents.Service = (0, smithy_client_1.expectString)(data.Service);
2442
2256
  }
2443
- if (data.Type !== undefined && data.Type !== null) {
2257
+ if (data.Type != null) {
2444
2258
  contents.Type = (0, smithy_client_1.expectString)(data.Type);
2445
2259
  }
2446
- return Promise.resolve(contents);
2260
+ return contents;
2447
2261
  };
2448
2262
  exports.deserializeAws_restJson1UpdatePricingRuleCommand = deserializeAws_restJson1UpdatePricingRuleCommand;
2449
2263
  const deserializeAws_restJson1UpdatePricingRuleCommandError = async (output, context) => {
@@ -2451,7 +2265,6 @@ const deserializeAws_restJson1UpdatePricingRuleCommandError = async (output, con
2451
2265
  ...output,
2452
2266
  body: await parseBody(output.body, context),
2453
2267
  };
2454
- let response;
2455
2268
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2456
2269
  switch (errorCode) {
2457
2270
  case "AccessDeniedException":
@@ -2474,20 +2287,19 @@ const deserializeAws_restJson1UpdatePricingRuleCommandError = async (output, con
2474
2287
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2475
2288
  default:
2476
2289
  const parsedBody = parsedOutput.body;
2477
- const $metadata = deserializeMetadata(output);
2478
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2479
- response = new BillingconductorServiceException_1.BillingconductorServiceException({
2480
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2481
- $fault: "client",
2482
- $metadata,
2290
+ (0, smithy_client_1.throwDefaultError)({
2291
+ output,
2292
+ parsedBody,
2293
+ exceptionCtor: BillingconductorServiceException_1.BillingconductorServiceException,
2294
+ errorCode,
2483
2295
  });
2484
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2485
2296
  }
2486
2297
  };
2298
+ const map = smithy_client_1.map;
2487
2299
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2488
- const contents = {};
2300
+ const contents = map({});
2489
2301
  const data = parsedOutput.body;
2490
- if (data.Message !== undefined && data.Message !== null) {
2302
+ if (data.Message != null) {
2491
2303
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2492
2304
  }
2493
2305
  const exception = new models_0_1.AccessDeniedException({
@@ -2497,15 +2309,15 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
2497
2309
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2498
2310
  };
2499
2311
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2500
- const contents = {};
2312
+ const contents = map({});
2501
2313
  const data = parsedOutput.body;
2502
- if (data.Message !== undefined && data.Message !== null) {
2314
+ if (data.Message != null) {
2503
2315
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2504
2316
  }
2505
- if (data.ResourceId !== undefined && data.ResourceId !== null) {
2317
+ if (data.ResourceId != null) {
2506
2318
  contents.ResourceId = (0, smithy_client_1.expectString)(data.ResourceId);
2507
2319
  }
2508
- if (data.ResourceType !== undefined && data.ResourceType !== null) {
2320
+ if (data.ResourceType != null) {
2509
2321
  contents.ResourceType = (0, smithy_client_1.expectString)(data.ResourceType);
2510
2322
  }
2511
2323
  const exception = new models_0_1.ConflictException({
@@ -2515,12 +2327,14 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2515
2327
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2516
2328
  };
2517
2329
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
2518
- const contents = {};
2519
- if (parsedOutput.headers["retry-after"] !== undefined) {
2520
- contents.RetryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
2521
- }
2330
+ const contents = map({
2331
+ RetryAfterSeconds: [
2332
+ () => void 0 !== parsedOutput.headers["retry-after"],
2333
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
2334
+ ],
2335
+ });
2522
2336
  const data = parsedOutput.body;
2523
- if (data.Message !== undefined && data.Message !== null) {
2337
+ if (data.Message != null) {
2524
2338
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2525
2339
  }
2526
2340
  const exception = new models_0_1.InternalServerException({
@@ -2530,15 +2344,15 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
2530
2344
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2531
2345
  };
2532
2346
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2533
- const contents = {};
2347
+ const contents = map({});
2534
2348
  const data = parsedOutput.body;
2535
- if (data.Message !== undefined && data.Message !== null) {
2349
+ if (data.Message != null) {
2536
2350
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2537
2351
  }
2538
- if (data.ResourceId !== undefined && data.ResourceId !== null) {
2352
+ if (data.ResourceId != null) {
2539
2353
  contents.ResourceId = (0, smithy_client_1.expectString)(data.ResourceId);
2540
2354
  }
2541
- if (data.ResourceType !== undefined && data.ResourceType !== null) {
2355
+ if (data.ResourceType != null) {
2542
2356
  contents.ResourceType = (0, smithy_client_1.expectString)(data.ResourceType);
2543
2357
  }
2544
2358
  const exception = new models_0_1.ResourceNotFoundException({
@@ -2548,21 +2362,21 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
2548
2362
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2549
2363
  };
2550
2364
  const deserializeAws_restJson1ServiceLimitExceededExceptionResponse = async (parsedOutput, context) => {
2551
- const contents = {};
2365
+ const contents = map({});
2552
2366
  const data = parsedOutput.body;
2553
- if (data.LimitCode !== undefined && data.LimitCode !== null) {
2367
+ if (data.LimitCode != null) {
2554
2368
  contents.LimitCode = (0, smithy_client_1.expectString)(data.LimitCode);
2555
2369
  }
2556
- if (data.Message !== undefined && data.Message !== null) {
2370
+ if (data.Message != null) {
2557
2371
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2558
2372
  }
2559
- if (data.ResourceId !== undefined && data.ResourceId !== null) {
2373
+ if (data.ResourceId != null) {
2560
2374
  contents.ResourceId = (0, smithy_client_1.expectString)(data.ResourceId);
2561
2375
  }
2562
- if (data.ResourceType !== undefined && data.ResourceType !== null) {
2376
+ if (data.ResourceType != null) {
2563
2377
  contents.ResourceType = (0, smithy_client_1.expectString)(data.ResourceType);
2564
2378
  }
2565
- if (data.ServiceCode !== undefined && data.ServiceCode !== null) {
2379
+ if (data.ServiceCode != null) {
2566
2380
  contents.ServiceCode = (0, smithy_client_1.expectString)(data.ServiceCode);
2567
2381
  }
2568
2382
  const exception = new models_0_1.ServiceLimitExceededException({
@@ -2572,12 +2386,14 @@ const deserializeAws_restJson1ServiceLimitExceededExceptionResponse = async (par
2572
2386
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2573
2387
  };
2574
2388
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
2575
- const contents = {};
2576
- if (parsedOutput.headers["retry-after"] !== undefined) {
2577
- contents.RetryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
2578
- }
2389
+ const contents = map({
2390
+ RetryAfterSeconds: [
2391
+ () => void 0 !== parsedOutput.headers["retry-after"],
2392
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
2393
+ ],
2394
+ });
2579
2395
  const data = parsedOutput.body;
2580
- if (data.Message !== undefined && data.Message !== null) {
2396
+ if (data.Message != null) {
2581
2397
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2582
2398
  }
2583
2399
  const exception = new models_0_1.ThrottlingException({
@@ -2587,15 +2403,15 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
2587
2403
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2588
2404
  };
2589
2405
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2590
- const contents = {};
2406
+ const contents = map({});
2591
2407
  const data = parsedOutput.body;
2592
- if (data.Fields !== undefined && data.Fields !== null) {
2408
+ if (data.Fields != null) {
2593
2409
  contents.Fields = deserializeAws_restJson1ValidationExceptionFieldList(data.Fields, context);
2594
2410
  }
2595
- if (data.Message !== undefined && data.Message !== null) {
2411
+ if (data.Message != null) {
2596
2412
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
2597
2413
  }
2598
- if (data.Reason !== undefined && data.Reason !== null) {
2414
+ if (data.Reason != null) {
2599
2415
  contents.Reason = (0, smithy_client_1.expectString)(data.Reason);
2600
2416
  }
2601
2417
  const exception = new models_0_1.ValidationException({
@@ -2615,9 +2431,6 @@ const serializeAws_restJson1AccountIdList = (input, context) => {
2615
2431
  return input
2616
2432
  .filter((e) => e != null)
2617
2433
  .map((entry) => {
2618
- if (entry === null) {
2619
- return null;
2620
- }
2621
2434
  return entry;
2622
2435
  });
2623
2436
  };
@@ -2625,9 +2438,6 @@ const serializeAws_restJson1BillingGroupArnList = (input, context) => {
2625
2438
  return input
2626
2439
  .filter((e) => e != null)
2627
2440
  .map((entry) => {
2628
- if (entry === null) {
2629
- return null;
2630
- }
2631
2441
  return entry;
2632
2442
  });
2633
2443
  };
@@ -2640,9 +2450,6 @@ const serializeAws_restJson1CustomLineItemArns = (input, context) => {
2640
2450
  return input
2641
2451
  .filter((e) => e != null)
2642
2452
  .map((entry) => {
2643
- if (entry === null) {
2644
- return null;
2645
- }
2646
2453
  return entry;
2647
2454
  });
2648
2455
  };
@@ -2650,9 +2457,6 @@ const serializeAws_restJson1CustomLineItemAssociationsList = (input, context) =>
2650
2457
  return input
2651
2458
  .filter((e) => e != null)
2652
2459
  .map((entry) => {
2653
- if (entry === null) {
2654
- return null;
2655
- }
2656
2460
  return entry;
2657
2461
  });
2658
2462
  };
@@ -2660,9 +2464,6 @@ const serializeAws_restJson1CustomLineItemBatchAssociationsList = (input, contex
2660
2464
  return input
2661
2465
  .filter((e) => e != null)
2662
2466
  .map((entry) => {
2663
- if (entry === null) {
2664
- return null;
2665
- }
2666
2467
  return entry;
2667
2468
  });
2668
2469
  };
@@ -2670,9 +2471,6 @@ const serializeAws_restJson1CustomLineItemBatchDisassociationsList = (input, con
2670
2471
  return input
2671
2472
  .filter((e) => e != null)
2672
2473
  .map((entry) => {
2673
- if (entry === null) {
2674
- return null;
2675
- }
2676
2474
  return entry;
2677
2475
  });
2678
2476
  };
@@ -2702,9 +2500,6 @@ const serializeAws_restJson1CustomLineItemNameList = (input, context) => {
2702
2500
  return input
2703
2501
  .filter((e) => e != null)
2704
2502
  .map((entry) => {
2705
- if (entry === null) {
2706
- return null;
2707
- }
2708
2503
  return entry;
2709
2504
  });
2710
2505
  };
@@ -2763,9 +2558,6 @@ const serializeAws_restJson1PricingPlanArns = (input, context) => {
2763
2558
  return input
2764
2559
  .filter((e) => e != null)
2765
2560
  .map((entry) => {
2766
- if (entry === null) {
2767
- return null;
2768
- }
2769
2561
  return entry;
2770
2562
  });
2771
2563
  };
@@ -2773,9 +2565,6 @@ const serializeAws_restJson1PricingRuleArns = (input, context) => {
2773
2565
  return input
2774
2566
  .filter((e) => e != null)
2775
2567
  .map((entry) => {
2776
- if (entry === null) {
2777
- return null;
2778
- }
2779
2568
  return entry;
2780
2569
  });
2781
2570
  };
@@ -2783,9 +2572,6 @@ const serializeAws_restJson1PricingRuleArnsInput = (input, context) => {
2783
2572
  return input
2784
2573
  .filter((e) => e != null)
2785
2574
  .map((entry) => {
2786
- if (entry === null) {
2787
- return null;
2788
- }
2789
2575
  return entry;
2790
2576
  });
2791
2577
  };
@@ -2793,9 +2579,6 @@ const serializeAws_restJson1PricingRuleArnsNonEmptyInput = (input, context) => {
2793
2579
  return input
2794
2580
  .filter((e) => e != null)
2795
2581
  .map((entry) => {
2796
- if (entry === null) {
2797
- return null;
2798
- }
2799
2582
  return entry;
2800
2583
  });
2801
2584
  };