@aws-sdk/client-billingconductor 3.55.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.
Files changed (220) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +201 -0
  3. package/README.md +215 -0
  4. package/dist-cjs/Billingconductor.js +457 -0
  5. package/dist-cjs/BillingconductorClient.js +35 -0
  6. package/dist-cjs/commands/AssociateAccountsCommand.js +36 -0
  7. package/dist-cjs/commands/AssociatePricingRulesCommand.js +36 -0
  8. package/dist-cjs/commands/BatchAssociateResourcesToCustomLineItemCommand.js +36 -0
  9. package/dist-cjs/commands/BatchDisassociateResourcesFromCustomLineItemCommand.js +36 -0
  10. package/dist-cjs/commands/CreateBillingGroupCommand.js +36 -0
  11. package/dist-cjs/commands/CreateCustomLineItemCommand.js +36 -0
  12. package/dist-cjs/commands/CreatePricingPlanCommand.js +36 -0
  13. package/dist-cjs/commands/CreatePricingRuleCommand.js +36 -0
  14. package/dist-cjs/commands/DeleteBillingGroupCommand.js +36 -0
  15. package/dist-cjs/commands/DeleteCustomLineItemCommand.js +36 -0
  16. package/dist-cjs/commands/DeletePricingPlanCommand.js +36 -0
  17. package/dist-cjs/commands/DeletePricingRuleCommand.js +36 -0
  18. package/dist-cjs/commands/DisassociateAccountsCommand.js +36 -0
  19. package/dist-cjs/commands/DisassociatePricingRulesCommand.js +36 -0
  20. package/dist-cjs/commands/ListAccountAssociationsCommand.js +36 -0
  21. package/dist-cjs/commands/ListBillingGroupCostReportsCommand.js +36 -0
  22. package/dist-cjs/commands/ListBillingGroupsCommand.js +36 -0
  23. package/dist-cjs/commands/ListCustomLineItemsCommand.js +36 -0
  24. package/dist-cjs/commands/ListPricingPlansAssociatedWithPricingRuleCommand.js +36 -0
  25. package/dist-cjs/commands/ListPricingPlansCommand.js +36 -0
  26. package/dist-cjs/commands/ListPricingRulesAssociatedToPricingPlanCommand.js +36 -0
  27. package/dist-cjs/commands/ListPricingRulesCommand.js +36 -0
  28. package/dist-cjs/commands/ListResourcesAssociatedToCustomLineItemCommand.js +36 -0
  29. package/dist-cjs/commands/ListTagsForResourceCommand.js +36 -0
  30. package/dist-cjs/commands/TagResourceCommand.js +36 -0
  31. package/dist-cjs/commands/UntagResourceCommand.js +36 -0
  32. package/dist-cjs/commands/UpdateBillingGroupCommand.js +36 -0
  33. package/dist-cjs/commands/UpdateCustomLineItemCommand.js +36 -0
  34. package/dist-cjs/commands/UpdatePricingPlanCommand.js +36 -0
  35. package/dist-cjs/commands/UpdatePricingRuleCommand.js +36 -0
  36. package/dist-cjs/commands/index.js +33 -0
  37. package/dist-cjs/endpoints.js +131 -0
  38. package/dist-cjs/index.js +11 -0
  39. package/dist-cjs/models/BillingconductorServiceException.js +11 -0
  40. package/dist-cjs/models/index.js +4 -0
  41. package/dist-cjs/models/models_0.js +792 -0
  42. package/dist-cjs/pagination/Interfaces.js +2 -0
  43. package/dist-cjs/pagination/ListAccountAssociationsPaginator.js +34 -0
  44. package/dist-cjs/pagination/ListBillingGroupCostReportsPaginator.js +35 -0
  45. package/dist-cjs/pagination/ListBillingGroupsPaginator.js +35 -0
  46. package/dist-cjs/pagination/ListCustomLineItemsPaginator.js +35 -0
  47. package/dist-cjs/pagination/ListPricingPlansAssociatedWithPricingRulePaginator.js +35 -0
  48. package/dist-cjs/pagination/ListPricingPlansPaginator.js +35 -0
  49. package/dist-cjs/pagination/ListPricingRulesAssociatedToPricingPlanPaginator.js +35 -0
  50. package/dist-cjs/pagination/ListPricingRulesPaginator.js +35 -0
  51. package/dist-cjs/pagination/ListResourcesAssociatedToCustomLineItemPaginator.js +35 -0
  52. package/dist-cjs/pagination/index.js +13 -0
  53. package/dist-cjs/protocols/Aws_restJson1.js +3178 -0
  54. package/dist-cjs/runtimeConfig.browser.js +45 -0
  55. package/dist-cjs/runtimeConfig.js +50 -0
  56. package/dist-cjs/runtimeConfig.native.js +16 -0
  57. package/dist-cjs/runtimeConfig.shared.js +17 -0
  58. package/dist-es/Billingconductor.js +460 -0
  59. package/dist-es/BillingconductorClient.js +37 -0
  60. package/dist-es/commands/AssociateAccountsCommand.js +39 -0
  61. package/dist-es/commands/AssociatePricingRulesCommand.js +39 -0
  62. package/dist-es/commands/BatchAssociateResourcesToCustomLineItemCommand.js +39 -0
  63. package/dist-es/commands/BatchDisassociateResourcesFromCustomLineItemCommand.js +39 -0
  64. package/dist-es/commands/CreateBillingGroupCommand.js +39 -0
  65. package/dist-es/commands/CreateCustomLineItemCommand.js +39 -0
  66. package/dist-es/commands/CreatePricingPlanCommand.js +39 -0
  67. package/dist-es/commands/CreatePricingRuleCommand.js +39 -0
  68. package/dist-es/commands/DeleteBillingGroupCommand.js +39 -0
  69. package/dist-es/commands/DeleteCustomLineItemCommand.js +39 -0
  70. package/dist-es/commands/DeletePricingPlanCommand.js +39 -0
  71. package/dist-es/commands/DeletePricingRuleCommand.js +39 -0
  72. package/dist-es/commands/DisassociateAccountsCommand.js +39 -0
  73. package/dist-es/commands/DisassociatePricingRulesCommand.js +39 -0
  74. package/dist-es/commands/ListAccountAssociationsCommand.js +39 -0
  75. package/dist-es/commands/ListBillingGroupCostReportsCommand.js +39 -0
  76. package/dist-es/commands/ListBillingGroupsCommand.js +39 -0
  77. package/dist-es/commands/ListCustomLineItemsCommand.js +39 -0
  78. package/dist-es/commands/ListPricingPlansAssociatedWithPricingRuleCommand.js +39 -0
  79. package/dist-es/commands/ListPricingPlansCommand.js +39 -0
  80. package/dist-es/commands/ListPricingRulesAssociatedToPricingPlanCommand.js +39 -0
  81. package/dist-es/commands/ListPricingRulesCommand.js +39 -0
  82. package/dist-es/commands/ListResourcesAssociatedToCustomLineItemCommand.js +39 -0
  83. package/dist-es/commands/ListTagsForResourceCommand.js +39 -0
  84. package/dist-es/commands/TagResourceCommand.js +39 -0
  85. package/dist-es/commands/UntagResourceCommand.js +39 -0
  86. package/dist-es/commands/UpdateBillingGroupCommand.js +39 -0
  87. package/dist-es/commands/UpdateCustomLineItemCommand.js +39 -0
  88. package/dist-es/commands/UpdatePricingPlanCommand.js +39 -0
  89. package/dist-es/commands/UpdatePricingRuleCommand.js +39 -0
  90. package/dist-es/commands/index.js +30 -0
  91. package/dist-es/endpoints.js +127 -0
  92. package/dist-es/index.js +6 -0
  93. package/dist-es/models/BillingconductorServiceException.js +12 -0
  94. package/dist-es/models/index.js +1 -0
  95. package/dist-es/models/models_0.js +560 -0
  96. package/dist-es/pagination/Interfaces.js +1 -0
  97. package/dist-es/pagination/ListAccountAssociationsPaginator.js +73 -0
  98. package/dist-es/pagination/ListBillingGroupCostReportsPaginator.js +74 -0
  99. package/dist-es/pagination/ListBillingGroupsPaginator.js +74 -0
  100. package/dist-es/pagination/ListCustomLineItemsPaginator.js +74 -0
  101. package/dist-es/pagination/ListPricingPlansAssociatedWithPricingRulePaginator.js +74 -0
  102. package/dist-es/pagination/ListPricingPlansPaginator.js +74 -0
  103. package/dist-es/pagination/ListPricingRulesAssociatedToPricingPlanPaginator.js +74 -0
  104. package/dist-es/pagination/ListPricingRulesPaginator.js +74 -0
  105. package/dist-es/pagination/ListResourcesAssociatedToCustomLineItemPaginator.js +74 -0
  106. package/dist-es/pagination/index.js +10 -0
  107. package/dist-es/protocols/Aws_restJson1.js +3850 -0
  108. package/dist-es/runtimeConfig.browser.js +26 -0
  109. package/dist-es/runtimeConfig.js +28 -0
  110. package/dist-es/runtimeConfig.native.js +8 -0
  111. package/dist-es/runtimeConfig.shared.js +13 -0
  112. package/dist-types/Billingconductor.d.ts +283 -0
  113. package/dist-types/BillingconductorClient.d.ts +186 -0
  114. package/dist-types/commands/AssociateAccountsCommand.d.ts +38 -0
  115. package/dist-types/commands/AssociatePricingRulesCommand.d.ts +36 -0
  116. package/dist-types/commands/BatchAssociateResourcesToCustomLineItemCommand.d.ts +37 -0
  117. package/dist-types/commands/BatchDisassociateResourcesFromCustomLineItemCommand.d.ts +37 -0
  118. package/dist-types/commands/CreateBillingGroupCommand.d.ts +37 -0
  119. package/dist-types/commands/CreateCustomLineItemCommand.d.ts +37 -0
  120. package/dist-types/commands/CreatePricingPlanCommand.d.ts +36 -0
  121. package/dist-types/commands/CreatePricingRuleCommand.d.ts +37 -0
  122. package/dist-types/commands/DeleteBillingGroupCommand.d.ts +37 -0
  123. package/dist-types/commands/DeleteCustomLineItemCommand.d.ts +37 -0
  124. package/dist-types/commands/DeletePricingPlanCommand.d.ts +36 -0
  125. package/dist-types/commands/DeletePricingRuleCommand.d.ts +35 -0
  126. package/dist-types/commands/DisassociateAccountsCommand.d.ts +35 -0
  127. package/dist-types/commands/DisassociatePricingRulesCommand.d.ts +37 -0
  128. package/dist-types/commands/ListAccountAssociationsCommand.d.ts +43 -0
  129. package/dist-types/commands/ListBillingGroupCostReportsCommand.d.ts +36 -0
  130. package/dist-types/commands/ListBillingGroupsCommand.d.ts +35 -0
  131. package/dist-types/commands/ListCustomLineItemsCommand.d.ts +37 -0
  132. package/dist-types/commands/ListPricingPlansAssociatedWithPricingRuleCommand.d.ts +37 -0
  133. package/dist-types/commands/ListPricingPlansCommand.d.ts +36 -0
  134. package/dist-types/commands/ListPricingRulesAssociatedToPricingPlanCommand.d.ts +37 -0
  135. package/dist-types/commands/ListPricingRulesCommand.d.ts +37 -0
  136. package/dist-types/commands/ListResourcesAssociatedToCustomLineItemCommand.d.ts +37 -0
  137. package/dist-types/commands/ListTagsForResourceCommand.d.ts +37 -0
  138. package/dist-types/commands/TagResourceCommand.d.ts +37 -0
  139. package/dist-types/commands/UntagResourceCommand.d.ts +37 -0
  140. package/dist-types/commands/UpdateBillingGroupCommand.d.ts +36 -0
  141. package/dist-types/commands/UpdateCustomLineItemCommand.d.ts +37 -0
  142. package/dist-types/commands/UpdatePricingPlanCommand.d.ts +36 -0
  143. package/dist-types/commands/UpdatePricingRuleCommand.d.ts +37 -0
  144. package/dist-types/commands/index.d.ts +30 -0
  145. package/dist-types/endpoints.d.ts +2 -0
  146. package/dist-types/index.d.ts +6 -0
  147. package/dist-types/models/BillingconductorServiceException.d.ts +10 -0
  148. package/dist-types/models/index.d.ts +1 -0
  149. package/dist-types/models/models_0.d.ts +2576 -0
  150. package/dist-types/pagination/Interfaces.d.ts +6 -0
  151. package/dist-types/pagination/ListAccountAssociationsPaginator.d.ts +4 -0
  152. package/dist-types/pagination/ListBillingGroupCostReportsPaginator.d.ts +4 -0
  153. package/dist-types/pagination/ListBillingGroupsPaginator.d.ts +4 -0
  154. package/dist-types/pagination/ListCustomLineItemsPaginator.d.ts +4 -0
  155. package/dist-types/pagination/ListPricingPlansAssociatedWithPricingRulePaginator.d.ts +4 -0
  156. package/dist-types/pagination/ListPricingPlansPaginator.d.ts +4 -0
  157. package/dist-types/pagination/ListPricingRulesAssociatedToPricingPlanPaginator.d.ts +4 -0
  158. package/dist-types/pagination/ListPricingRulesPaginator.d.ts +4 -0
  159. package/dist-types/pagination/ListResourcesAssociatedToCustomLineItemPaginator.d.ts +4 -0
  160. package/dist-types/pagination/index.d.ts +10 -0
  161. package/dist-types/protocols/Aws_restJson1.d.ts +92 -0
  162. package/dist-types/runtimeConfig.browser.d.ts +40 -0
  163. package/dist-types/runtimeConfig.d.ts +40 -0
  164. package/dist-types/runtimeConfig.native.d.ts +39 -0
  165. package/dist-types/runtimeConfig.shared.d.ts +13 -0
  166. package/dist-types/ts3.4/Billingconductor.d.ts +155 -0
  167. package/dist-types/ts3.4/BillingconductorClient.d.ts +103 -0
  168. package/dist-types/ts3.4/commands/AssociateAccountsCommand.d.ts +17 -0
  169. package/dist-types/ts3.4/commands/AssociatePricingRulesCommand.d.ts +17 -0
  170. package/dist-types/ts3.4/commands/BatchAssociateResourcesToCustomLineItemCommand.d.ts +17 -0
  171. package/dist-types/ts3.4/commands/BatchDisassociateResourcesFromCustomLineItemCommand.d.ts +17 -0
  172. package/dist-types/ts3.4/commands/CreateBillingGroupCommand.d.ts +17 -0
  173. package/dist-types/ts3.4/commands/CreateCustomLineItemCommand.d.ts +17 -0
  174. package/dist-types/ts3.4/commands/CreatePricingPlanCommand.d.ts +17 -0
  175. package/dist-types/ts3.4/commands/CreatePricingRuleCommand.d.ts +17 -0
  176. package/dist-types/ts3.4/commands/DeleteBillingGroupCommand.d.ts +17 -0
  177. package/dist-types/ts3.4/commands/DeleteCustomLineItemCommand.d.ts +17 -0
  178. package/dist-types/ts3.4/commands/DeletePricingPlanCommand.d.ts +17 -0
  179. package/dist-types/ts3.4/commands/DeletePricingRuleCommand.d.ts +17 -0
  180. package/dist-types/ts3.4/commands/DisassociateAccountsCommand.d.ts +17 -0
  181. package/dist-types/ts3.4/commands/DisassociatePricingRulesCommand.d.ts +17 -0
  182. package/dist-types/ts3.4/commands/ListAccountAssociationsCommand.d.ts +17 -0
  183. package/dist-types/ts3.4/commands/ListBillingGroupCostReportsCommand.d.ts +17 -0
  184. package/dist-types/ts3.4/commands/ListBillingGroupsCommand.d.ts +17 -0
  185. package/dist-types/ts3.4/commands/ListCustomLineItemsCommand.d.ts +17 -0
  186. package/dist-types/ts3.4/commands/ListPricingPlansAssociatedWithPricingRuleCommand.d.ts +17 -0
  187. package/dist-types/ts3.4/commands/ListPricingPlansCommand.d.ts +17 -0
  188. package/dist-types/ts3.4/commands/ListPricingRulesAssociatedToPricingPlanCommand.d.ts +17 -0
  189. package/dist-types/ts3.4/commands/ListPricingRulesCommand.d.ts +17 -0
  190. package/dist-types/ts3.4/commands/ListResourcesAssociatedToCustomLineItemCommand.d.ts +17 -0
  191. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +17 -0
  192. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +17 -0
  193. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +17 -0
  194. package/dist-types/ts3.4/commands/UpdateBillingGroupCommand.d.ts +17 -0
  195. package/dist-types/ts3.4/commands/UpdateCustomLineItemCommand.d.ts +17 -0
  196. package/dist-types/ts3.4/commands/UpdatePricingPlanCommand.d.ts +17 -0
  197. package/dist-types/ts3.4/commands/UpdatePricingRuleCommand.d.ts +17 -0
  198. package/dist-types/ts3.4/commands/index.d.ts +30 -0
  199. package/dist-types/ts3.4/endpoints.d.ts +2 -0
  200. package/dist-types/ts3.4/index.d.ts +6 -0
  201. package/dist-types/ts3.4/models/BillingconductorServiceException.d.ts +6 -0
  202. package/dist-types/ts3.4/models/index.d.ts +1 -0
  203. package/dist-types/ts3.4/models/models_0.d.ts +1266 -0
  204. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  205. package/dist-types/ts3.4/pagination/ListAccountAssociationsPaginator.d.ts +4 -0
  206. package/dist-types/ts3.4/pagination/ListBillingGroupCostReportsPaginator.d.ts +4 -0
  207. package/dist-types/ts3.4/pagination/ListBillingGroupsPaginator.d.ts +4 -0
  208. package/dist-types/ts3.4/pagination/ListCustomLineItemsPaginator.d.ts +4 -0
  209. package/dist-types/ts3.4/pagination/ListPricingPlansAssociatedWithPricingRulePaginator.d.ts +4 -0
  210. package/dist-types/ts3.4/pagination/ListPricingPlansPaginator.d.ts +4 -0
  211. package/dist-types/ts3.4/pagination/ListPricingRulesAssociatedToPricingPlanPaginator.d.ts +4 -0
  212. package/dist-types/ts3.4/pagination/ListPricingRulesPaginator.d.ts +4 -0
  213. package/dist-types/ts3.4/pagination/ListResourcesAssociatedToCustomLineItemPaginator.d.ts +4 -0
  214. package/dist-types/ts3.4/pagination/index.d.ts +10 -0
  215. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +92 -0
  216. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +38 -0
  217. package/dist-types/ts3.4/runtimeConfig.d.ts +38 -0
  218. package/dist-types/ts3.4/runtimeConfig.native.d.ts +37 -0
  219. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +11 -0
  220. package/package.json +95 -0
@@ -0,0 +1,3178 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand = exports.deserializeAws_restJson1ListPricingPlansCommand = exports.deserializeAws_restJson1ListCustomLineItemsCommand = exports.deserializeAws_restJson1ListBillingGroupsCommand = exports.deserializeAws_restJson1ListBillingGroupCostReportsCommand = exports.deserializeAws_restJson1ListAccountAssociationsCommand = exports.deserializeAws_restJson1DisassociatePricingRulesCommand = exports.deserializeAws_restJson1DisassociateAccountsCommand = exports.deserializeAws_restJson1DeletePricingRuleCommand = exports.deserializeAws_restJson1DeletePricingPlanCommand = exports.deserializeAws_restJson1DeleteCustomLineItemCommand = exports.deserializeAws_restJson1DeleteBillingGroupCommand = exports.deserializeAws_restJson1CreatePricingRuleCommand = exports.deserializeAws_restJson1CreatePricingPlanCommand = exports.deserializeAws_restJson1CreateCustomLineItemCommand = exports.deserializeAws_restJson1CreateBillingGroupCommand = exports.deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand = exports.deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand = exports.deserializeAws_restJson1AssociatePricingRulesCommand = exports.deserializeAws_restJson1AssociateAccountsCommand = exports.serializeAws_restJson1UpdatePricingRuleCommand = exports.serializeAws_restJson1UpdatePricingPlanCommand = exports.serializeAws_restJson1UpdateCustomLineItemCommand = exports.serializeAws_restJson1UpdateBillingGroupCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand = exports.serializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand = exports.serializeAws_restJson1ListPricingRulesCommand = exports.serializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand = exports.serializeAws_restJson1ListPricingPlansCommand = exports.serializeAws_restJson1ListCustomLineItemsCommand = exports.serializeAws_restJson1ListBillingGroupsCommand = exports.serializeAws_restJson1ListBillingGroupCostReportsCommand = exports.serializeAws_restJson1ListAccountAssociationsCommand = exports.serializeAws_restJson1DisassociatePricingRulesCommand = exports.serializeAws_restJson1DisassociateAccountsCommand = exports.serializeAws_restJson1DeletePricingRuleCommand = exports.serializeAws_restJson1DeletePricingPlanCommand = exports.serializeAws_restJson1DeleteCustomLineItemCommand = exports.serializeAws_restJson1DeleteBillingGroupCommand = exports.serializeAws_restJson1CreatePricingRuleCommand = exports.serializeAws_restJson1CreatePricingPlanCommand = exports.serializeAws_restJson1CreateCustomLineItemCommand = exports.serializeAws_restJson1CreateBillingGroupCommand = exports.serializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand = exports.serializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand = exports.serializeAws_restJson1AssociatePricingRulesCommand = exports.serializeAws_restJson1AssociateAccountsCommand = void 0;
4
+ exports.deserializeAws_restJson1UpdatePricingRuleCommand = exports.deserializeAws_restJson1UpdatePricingPlanCommand = exports.deserializeAws_restJson1UpdateCustomLineItemCommand = exports.deserializeAws_restJson1UpdateBillingGroupCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand = exports.deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand = exports.deserializeAws_restJson1ListPricingRulesCommand = void 0;
5
+ const protocol_http_1 = require("@aws-sdk/protocol-http");
6
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
7
+ const BillingconductorServiceException_1 = require("../models/BillingconductorServiceException");
8
+ const models_0_1 = require("../models/models_0");
9
+ const serializeAws_restJson1AssociateAccountsCommand = async (input, context) => {
10
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
11
+ const headers = {
12
+ "content-type": "application/json",
13
+ };
14
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/associate-accounts";
15
+ let body;
16
+ body = JSON.stringify({
17
+ ...(input.AccountIds !== undefined &&
18
+ input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }),
19
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
20
+ });
21
+ return new protocol_http_1.HttpRequest({
22
+ protocol,
23
+ hostname,
24
+ port,
25
+ method: "POST",
26
+ headers,
27
+ path: resolvedPath,
28
+ body,
29
+ });
30
+ };
31
+ exports.serializeAws_restJson1AssociateAccountsCommand = serializeAws_restJson1AssociateAccountsCommand;
32
+ const serializeAws_restJson1AssociatePricingRulesCommand = async (input, context) => {
33
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
34
+ const headers = {
35
+ "content-type": "application/json",
36
+ };
37
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/associate-pricing-rules";
38
+ let body;
39
+ body = JSON.stringify({
40
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
41
+ ...(input.PricingRuleArns !== undefined &&
42
+ input.PricingRuleArns !== null && {
43
+ PricingRuleArns: serializeAws_restJson1PricingRuleArnsNonEmptyInput(input.PricingRuleArns, context),
44
+ }),
45
+ });
46
+ return new protocol_http_1.HttpRequest({
47
+ protocol,
48
+ hostname,
49
+ port,
50
+ method: "PUT",
51
+ headers,
52
+ path: resolvedPath,
53
+ body,
54
+ });
55
+ };
56
+ exports.serializeAws_restJson1AssociatePricingRulesCommand = serializeAws_restJson1AssociatePricingRulesCommand;
57
+ const serializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand = async (input, context) => {
58
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
59
+ const headers = {
60
+ "content-type": "application/json",
61
+ };
62
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
63
+ "/batch-associate-resources-to-custom-line-item";
64
+ let body;
65
+ body = JSON.stringify({
66
+ ...(input.BillingPeriodRange !== undefined &&
67
+ input.BillingPeriodRange !== null && {
68
+ BillingPeriodRange: serializeAws_restJson1CustomLineItemBillingPeriodRange(input.BillingPeriodRange, context),
69
+ }),
70
+ ...(input.ResourceArns !== undefined &&
71
+ input.ResourceArns !== null && {
72
+ ResourceArns: serializeAws_restJson1CustomLineItemBatchAssociationsList(input.ResourceArns, context),
73
+ }),
74
+ ...(input.TargetArn !== undefined && input.TargetArn !== null && { TargetArn: input.TargetArn }),
75
+ });
76
+ return new protocol_http_1.HttpRequest({
77
+ protocol,
78
+ hostname,
79
+ port,
80
+ method: "PUT",
81
+ headers,
82
+ path: resolvedPath,
83
+ body,
84
+ });
85
+ };
86
+ exports.serializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand = serializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand;
87
+ const serializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand = async (input, context) => {
88
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
89
+ const headers = {
90
+ "content-type": "application/json",
91
+ };
92
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
93
+ "/batch-disassociate-resources-from-custom-line-item";
94
+ let body;
95
+ body = JSON.stringify({
96
+ ...(input.BillingPeriodRange !== undefined &&
97
+ input.BillingPeriodRange !== null && {
98
+ BillingPeriodRange: serializeAws_restJson1CustomLineItemBillingPeriodRange(input.BillingPeriodRange, context),
99
+ }),
100
+ ...(input.ResourceArns !== undefined &&
101
+ input.ResourceArns !== null && {
102
+ ResourceArns: serializeAws_restJson1CustomLineItemBatchDisassociationsList(input.ResourceArns, context),
103
+ }),
104
+ ...(input.TargetArn !== undefined && input.TargetArn !== null && { TargetArn: input.TargetArn }),
105
+ });
106
+ return new protocol_http_1.HttpRequest({
107
+ protocol,
108
+ hostname,
109
+ port,
110
+ method: "PUT",
111
+ headers,
112
+ path: resolvedPath,
113
+ body,
114
+ });
115
+ };
116
+ exports.serializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand = serializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand;
117
+ const serializeAws_restJson1CreateBillingGroupCommand = async (input, context) => {
118
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
119
+ const headers = {
120
+ "content-type": "application/json",
121
+ ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken }),
122
+ };
123
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/create-billing-group";
124
+ let body;
125
+ body = JSON.stringify({
126
+ ...(input.AccountGrouping !== undefined &&
127
+ input.AccountGrouping !== null && {
128
+ AccountGrouping: serializeAws_restJson1AccountGrouping(input.AccountGrouping, context),
129
+ }),
130
+ ...(input.ComputationPreference !== undefined &&
131
+ input.ComputationPreference !== null && {
132
+ ComputationPreference: serializeAws_restJson1ComputationPreference(input.ComputationPreference, context),
133
+ }),
134
+ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }),
135
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
136
+ ...(input.PrimaryAccountId !== undefined &&
137
+ input.PrimaryAccountId !== null && { PrimaryAccountId: input.PrimaryAccountId }),
138
+ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
139
+ });
140
+ return new protocol_http_1.HttpRequest({
141
+ protocol,
142
+ hostname,
143
+ port,
144
+ method: "POST",
145
+ headers,
146
+ path: resolvedPath,
147
+ body,
148
+ });
149
+ };
150
+ exports.serializeAws_restJson1CreateBillingGroupCommand = serializeAws_restJson1CreateBillingGroupCommand;
151
+ const serializeAws_restJson1CreateCustomLineItemCommand = async (input, context) => {
152
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
153
+ const headers = {
154
+ "content-type": "application/json",
155
+ ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken }),
156
+ };
157
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/create-custom-line-item";
158
+ let body;
159
+ body = JSON.stringify({
160
+ ...(input.BillingGroupArn !== undefined &&
161
+ input.BillingGroupArn !== null && { BillingGroupArn: input.BillingGroupArn }),
162
+ ...(input.BillingPeriodRange !== undefined &&
163
+ input.BillingPeriodRange !== null && {
164
+ BillingPeriodRange: serializeAws_restJson1CustomLineItemBillingPeriodRange(input.BillingPeriodRange, context),
165
+ }),
166
+ ...(input.ChargeDetails !== undefined &&
167
+ input.ChargeDetails !== null && {
168
+ ChargeDetails: serializeAws_restJson1CustomLineItemChargeDetails(input.ChargeDetails, context),
169
+ }),
170
+ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }),
171
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
172
+ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
173
+ });
174
+ return new protocol_http_1.HttpRequest({
175
+ protocol,
176
+ hostname,
177
+ port,
178
+ method: "POST",
179
+ headers,
180
+ path: resolvedPath,
181
+ body,
182
+ });
183
+ };
184
+ exports.serializeAws_restJson1CreateCustomLineItemCommand = serializeAws_restJson1CreateCustomLineItemCommand;
185
+ const serializeAws_restJson1CreatePricingPlanCommand = async (input, context) => {
186
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
187
+ const headers = {
188
+ "content-type": "application/json",
189
+ ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken }),
190
+ };
191
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/create-pricing-plan";
192
+ let body;
193
+ body = JSON.stringify({
194
+ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }),
195
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
196
+ ...(input.PricingRuleArns !== undefined &&
197
+ input.PricingRuleArns !== null && {
198
+ PricingRuleArns: serializeAws_restJson1PricingRuleArnsInput(input.PricingRuleArns, context),
199
+ }),
200
+ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
201
+ });
202
+ return new protocol_http_1.HttpRequest({
203
+ protocol,
204
+ hostname,
205
+ port,
206
+ method: "POST",
207
+ headers,
208
+ path: resolvedPath,
209
+ body,
210
+ });
211
+ };
212
+ exports.serializeAws_restJson1CreatePricingPlanCommand = serializeAws_restJson1CreatePricingPlanCommand;
213
+ const serializeAws_restJson1CreatePricingRuleCommand = async (input, context) => {
214
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
215
+ const headers = {
216
+ "content-type": "application/json",
217
+ ...(isSerializableHeaderValue(input.ClientToken) && { "x-amzn-client-token": input.ClientToken }),
218
+ };
219
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/create-pricing-rule";
220
+ let body;
221
+ body = JSON.stringify({
222
+ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }),
223
+ ...(input.ModifierPercentage !== undefined &&
224
+ input.ModifierPercentage !== null && { ModifierPercentage: (0, smithy_client_1.serializeFloat)(input.ModifierPercentage) }),
225
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
226
+ ...(input.Scope !== undefined && input.Scope !== null && { Scope: input.Scope }),
227
+ ...(input.Service !== undefined && input.Service !== null && { Service: input.Service }),
228
+ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
229
+ ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }),
230
+ });
231
+ return new protocol_http_1.HttpRequest({
232
+ protocol,
233
+ hostname,
234
+ port,
235
+ method: "POST",
236
+ headers,
237
+ path: resolvedPath,
238
+ body,
239
+ });
240
+ };
241
+ exports.serializeAws_restJson1CreatePricingRuleCommand = serializeAws_restJson1CreatePricingRuleCommand;
242
+ const serializeAws_restJson1DeleteBillingGroupCommand = async (input, context) => {
243
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
244
+ const headers = {
245
+ "content-type": "application/json",
246
+ };
247
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/delete-billing-group";
248
+ let body;
249
+ body = JSON.stringify({
250
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
251
+ });
252
+ return new protocol_http_1.HttpRequest({
253
+ protocol,
254
+ hostname,
255
+ port,
256
+ method: "POST",
257
+ headers,
258
+ path: resolvedPath,
259
+ body,
260
+ });
261
+ };
262
+ exports.serializeAws_restJson1DeleteBillingGroupCommand = serializeAws_restJson1DeleteBillingGroupCommand;
263
+ const serializeAws_restJson1DeleteCustomLineItemCommand = async (input, context) => {
264
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
265
+ const headers = {
266
+ "content-type": "application/json",
267
+ };
268
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/delete-custom-line-item";
269
+ let body;
270
+ body = JSON.stringify({
271
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
272
+ ...(input.BillingPeriodRange !== undefined &&
273
+ input.BillingPeriodRange !== null && {
274
+ BillingPeriodRange: serializeAws_restJson1CustomLineItemBillingPeriodRange(input.BillingPeriodRange, context),
275
+ }),
276
+ });
277
+ return new protocol_http_1.HttpRequest({
278
+ protocol,
279
+ hostname,
280
+ port,
281
+ method: "POST",
282
+ headers,
283
+ path: resolvedPath,
284
+ body,
285
+ });
286
+ };
287
+ exports.serializeAws_restJson1DeleteCustomLineItemCommand = serializeAws_restJson1DeleteCustomLineItemCommand;
288
+ const serializeAws_restJson1DeletePricingPlanCommand = async (input, context) => {
289
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
290
+ const headers = {
291
+ "content-type": "application/json",
292
+ };
293
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/delete-pricing-plan";
294
+ let body;
295
+ body = JSON.stringify({
296
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
297
+ });
298
+ return new protocol_http_1.HttpRequest({
299
+ protocol,
300
+ hostname,
301
+ port,
302
+ method: "POST",
303
+ headers,
304
+ path: resolvedPath,
305
+ body,
306
+ });
307
+ };
308
+ exports.serializeAws_restJson1DeletePricingPlanCommand = serializeAws_restJson1DeletePricingPlanCommand;
309
+ const serializeAws_restJson1DeletePricingRuleCommand = async (input, context) => {
310
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
311
+ const headers = {
312
+ "content-type": "application/json",
313
+ };
314
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/delete-pricing-rule";
315
+ let body;
316
+ body = JSON.stringify({
317
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
318
+ });
319
+ return new protocol_http_1.HttpRequest({
320
+ protocol,
321
+ hostname,
322
+ port,
323
+ method: "POST",
324
+ headers,
325
+ path: resolvedPath,
326
+ body,
327
+ });
328
+ };
329
+ exports.serializeAws_restJson1DeletePricingRuleCommand = serializeAws_restJson1DeletePricingRuleCommand;
330
+ const serializeAws_restJson1DisassociateAccountsCommand = async (input, context) => {
331
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
332
+ const headers = {
333
+ "content-type": "application/json",
334
+ };
335
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/disassociate-accounts";
336
+ let body;
337
+ body = JSON.stringify({
338
+ ...(input.AccountIds !== undefined &&
339
+ input.AccountIds !== null && { AccountIds: serializeAws_restJson1AccountIdList(input.AccountIds, context) }),
340
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
341
+ });
342
+ return new protocol_http_1.HttpRequest({
343
+ protocol,
344
+ hostname,
345
+ port,
346
+ method: "POST",
347
+ headers,
348
+ path: resolvedPath,
349
+ body,
350
+ });
351
+ };
352
+ exports.serializeAws_restJson1DisassociateAccountsCommand = serializeAws_restJson1DisassociateAccountsCommand;
353
+ const serializeAws_restJson1DisassociatePricingRulesCommand = async (input, context) => {
354
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
355
+ const headers = {
356
+ "content-type": "application/json",
357
+ };
358
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/disassociate-pricing-rules";
359
+ let body;
360
+ body = JSON.stringify({
361
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
362
+ ...(input.PricingRuleArns !== undefined &&
363
+ input.PricingRuleArns !== null && {
364
+ PricingRuleArns: serializeAws_restJson1PricingRuleArnsNonEmptyInput(input.PricingRuleArns, context),
365
+ }),
366
+ });
367
+ return new protocol_http_1.HttpRequest({
368
+ protocol,
369
+ hostname,
370
+ port,
371
+ method: "PUT",
372
+ headers,
373
+ path: resolvedPath,
374
+ body,
375
+ });
376
+ };
377
+ exports.serializeAws_restJson1DisassociatePricingRulesCommand = serializeAws_restJson1DisassociatePricingRulesCommand;
378
+ const serializeAws_restJson1ListAccountAssociationsCommand = async (input, context) => {
379
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
380
+ const headers = {
381
+ "content-type": "application/json",
382
+ };
383
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-account-associations";
384
+ let body;
385
+ body = JSON.stringify({
386
+ ...(input.BillingPeriod !== undefined && input.BillingPeriod !== null && { BillingPeriod: input.BillingPeriod }),
387
+ ...(input.Filters !== undefined &&
388
+ input.Filters !== null && {
389
+ Filters: serializeAws_restJson1ListAccountAssociationsFilter(input.Filters, context),
390
+ }),
391
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
392
+ });
393
+ return new protocol_http_1.HttpRequest({
394
+ protocol,
395
+ hostname,
396
+ port,
397
+ method: "POST",
398
+ headers,
399
+ path: resolvedPath,
400
+ body,
401
+ });
402
+ };
403
+ exports.serializeAws_restJson1ListAccountAssociationsCommand = serializeAws_restJson1ListAccountAssociationsCommand;
404
+ const serializeAws_restJson1ListBillingGroupCostReportsCommand = async (input, context) => {
405
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
406
+ const headers = {
407
+ "content-type": "application/json",
408
+ };
409
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-billing-group-cost-reports";
410
+ let body;
411
+ body = JSON.stringify({
412
+ ...(input.BillingPeriod !== undefined && input.BillingPeriod !== null && { BillingPeriod: input.BillingPeriod }),
413
+ ...(input.Filters !== undefined &&
414
+ input.Filters !== null && {
415
+ Filters: serializeAws_restJson1ListBillingGroupCostReportsFilter(input.Filters, context),
416
+ }),
417
+ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
418
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
419
+ });
420
+ return new protocol_http_1.HttpRequest({
421
+ protocol,
422
+ hostname,
423
+ port,
424
+ method: "POST",
425
+ headers,
426
+ path: resolvedPath,
427
+ body,
428
+ });
429
+ };
430
+ exports.serializeAws_restJson1ListBillingGroupCostReportsCommand = serializeAws_restJson1ListBillingGroupCostReportsCommand;
431
+ const serializeAws_restJson1ListBillingGroupsCommand = async (input, context) => {
432
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
433
+ const headers = {
434
+ "content-type": "application/json",
435
+ };
436
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-billing-groups";
437
+ let body;
438
+ body = JSON.stringify({
439
+ ...(input.BillingPeriod !== undefined && input.BillingPeriod !== null && { BillingPeriod: input.BillingPeriod }),
440
+ ...(input.Filters !== undefined &&
441
+ input.Filters !== null && { Filters: serializeAws_restJson1ListBillingGroupsFilter(input.Filters, context) }),
442
+ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
443
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
444
+ });
445
+ return new protocol_http_1.HttpRequest({
446
+ protocol,
447
+ hostname,
448
+ port,
449
+ method: "POST",
450
+ headers,
451
+ path: resolvedPath,
452
+ body,
453
+ });
454
+ };
455
+ exports.serializeAws_restJson1ListBillingGroupsCommand = serializeAws_restJson1ListBillingGroupsCommand;
456
+ const serializeAws_restJson1ListCustomLineItemsCommand = async (input, context) => {
457
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
458
+ const headers = {
459
+ "content-type": "application/json",
460
+ };
461
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-custom-line-items";
462
+ let body;
463
+ body = JSON.stringify({
464
+ ...(input.BillingPeriod !== undefined && input.BillingPeriod !== null && { BillingPeriod: input.BillingPeriod }),
465
+ ...(input.Filters !== undefined &&
466
+ input.Filters !== null && { Filters: serializeAws_restJson1ListCustomLineItemsFilter(input.Filters, context) }),
467
+ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
468
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
469
+ });
470
+ return new protocol_http_1.HttpRequest({
471
+ protocol,
472
+ hostname,
473
+ port,
474
+ method: "POST",
475
+ headers,
476
+ path: resolvedPath,
477
+ body,
478
+ });
479
+ };
480
+ exports.serializeAws_restJson1ListCustomLineItemsCommand = serializeAws_restJson1ListCustomLineItemsCommand;
481
+ const serializeAws_restJson1ListPricingPlansCommand = async (input, context) => {
482
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
483
+ const headers = {
484
+ "content-type": "application/json",
485
+ };
486
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-pricing-plans";
487
+ let body;
488
+ body = JSON.stringify({
489
+ ...(input.BillingPeriod !== undefined && input.BillingPeriod !== null && { BillingPeriod: input.BillingPeriod }),
490
+ ...(input.Filters !== undefined &&
491
+ input.Filters !== null && { Filters: serializeAws_restJson1ListPricingPlansFilter(input.Filters, context) }),
492
+ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
493
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
494
+ });
495
+ return new protocol_http_1.HttpRequest({
496
+ protocol,
497
+ hostname,
498
+ port,
499
+ method: "POST",
500
+ headers,
501
+ path: resolvedPath,
502
+ body,
503
+ });
504
+ };
505
+ exports.serializeAws_restJson1ListPricingPlansCommand = serializeAws_restJson1ListPricingPlansCommand;
506
+ const serializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand = async (input, context) => {
507
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
508
+ const headers = {
509
+ "content-type": "application/json",
510
+ };
511
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
512
+ "/list-pricing-plans-associated-with-pricing-rule";
513
+ let body;
514
+ body = JSON.stringify({
515
+ ...(input.BillingPeriod !== undefined && input.BillingPeriod !== null && { BillingPeriod: input.BillingPeriod }),
516
+ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
517
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
518
+ ...(input.PricingRuleArn !== undefined &&
519
+ input.PricingRuleArn !== null && { PricingRuleArn: input.PricingRuleArn }),
520
+ });
521
+ return new protocol_http_1.HttpRequest({
522
+ protocol,
523
+ hostname,
524
+ port,
525
+ method: "POST",
526
+ headers,
527
+ path: resolvedPath,
528
+ body,
529
+ });
530
+ };
531
+ exports.serializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand = serializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand;
532
+ const serializeAws_restJson1ListPricingRulesCommand = async (input, context) => {
533
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
534
+ const headers = {
535
+ "content-type": "application/json",
536
+ };
537
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/list-pricing-rules";
538
+ let body;
539
+ body = JSON.stringify({
540
+ ...(input.BillingPeriod !== undefined && input.BillingPeriod !== null && { BillingPeriod: input.BillingPeriod }),
541
+ ...(input.Filters !== undefined &&
542
+ input.Filters !== null && { Filters: serializeAws_restJson1ListPricingRulesFilter(input.Filters, context) }),
543
+ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
544
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
545
+ });
546
+ return new protocol_http_1.HttpRequest({
547
+ protocol,
548
+ hostname,
549
+ port,
550
+ method: "POST",
551
+ headers,
552
+ path: resolvedPath,
553
+ body,
554
+ });
555
+ };
556
+ exports.serializeAws_restJson1ListPricingRulesCommand = serializeAws_restJson1ListPricingRulesCommand;
557
+ const serializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand = async (input, context) => {
558
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
559
+ const headers = {
560
+ "content-type": "application/json",
561
+ };
562
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
563
+ "/list-pricing-rules-associated-to-pricing-plan";
564
+ let body;
565
+ body = JSON.stringify({
566
+ ...(input.BillingPeriod !== undefined && input.BillingPeriod !== null && { BillingPeriod: input.BillingPeriod }),
567
+ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
568
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
569
+ ...(input.PricingPlanArn !== undefined &&
570
+ input.PricingPlanArn !== null && { PricingPlanArn: input.PricingPlanArn }),
571
+ });
572
+ return new protocol_http_1.HttpRequest({
573
+ protocol,
574
+ hostname,
575
+ port,
576
+ method: "POST",
577
+ headers,
578
+ path: resolvedPath,
579
+ body,
580
+ });
581
+ };
582
+ exports.serializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand = serializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand;
583
+ const serializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand = async (input, context) => {
584
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
585
+ const headers = {
586
+ "content-type": "application/json",
587
+ };
588
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
589
+ "/list-resources-associated-to-custom-line-item";
590
+ let body;
591
+ body = JSON.stringify({
592
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
593
+ ...(input.BillingPeriod !== undefined && input.BillingPeriod !== null && { BillingPeriod: input.BillingPeriod }),
594
+ ...(input.Filters !== undefined &&
595
+ input.Filters !== null && {
596
+ Filters: serializeAws_restJson1ListResourcesAssociatedToCustomLineItemFilter(input.Filters, context),
597
+ }),
598
+ ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
599
+ ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
600
+ });
601
+ return new protocol_http_1.HttpRequest({
602
+ protocol,
603
+ hostname,
604
+ port,
605
+ method: "POST",
606
+ headers,
607
+ path: resolvedPath,
608
+ body,
609
+ });
610
+ };
611
+ exports.serializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand = serializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand;
612
+ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context) => {
613
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
614
+ const headers = {};
615
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
616
+ if (input.ResourceArn !== undefined) {
617
+ const labelValue = input.ResourceArn;
618
+ if (labelValue.length <= 0) {
619
+ throw new Error("Empty value provided for input HTTP label: ResourceArn.");
620
+ }
621
+ resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
622
+ }
623
+ else {
624
+ throw new Error("No value provided for input HTTP label: ResourceArn.");
625
+ }
626
+ let body;
627
+ return new protocol_http_1.HttpRequest({
628
+ protocol,
629
+ hostname,
630
+ port,
631
+ method: "GET",
632
+ headers,
633
+ path: resolvedPath,
634
+ body,
635
+ });
636
+ };
637
+ exports.serializeAws_restJson1ListTagsForResourceCommand = serializeAws_restJson1ListTagsForResourceCommand;
638
+ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
639
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
640
+ const headers = {
641
+ "content-type": "application/json",
642
+ };
643
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
644
+ if (input.ResourceArn !== undefined) {
645
+ const labelValue = input.ResourceArn;
646
+ if (labelValue.length <= 0) {
647
+ throw new Error("Empty value provided for input HTTP label: ResourceArn.");
648
+ }
649
+ resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
650
+ }
651
+ else {
652
+ throw new Error("No value provided for input HTTP label: ResourceArn.");
653
+ }
654
+ let body;
655
+ body = JSON.stringify({
656
+ ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
657
+ });
658
+ return new protocol_http_1.HttpRequest({
659
+ protocol,
660
+ hostname,
661
+ port,
662
+ method: "POST",
663
+ headers,
664
+ path: resolvedPath,
665
+ body,
666
+ });
667
+ };
668
+ exports.serializeAws_restJson1TagResourceCommand = serializeAws_restJson1TagResourceCommand;
669
+ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
670
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
671
+ const headers = {};
672
+ let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
673
+ if (input.ResourceArn !== undefined) {
674
+ const labelValue = input.ResourceArn;
675
+ if (labelValue.length <= 0) {
676
+ throw new Error("Empty value provided for input HTTP label: ResourceArn.");
677
+ }
678
+ resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
679
+ }
680
+ else {
681
+ throw new Error("No value provided for input HTTP label: ResourceArn.");
682
+ }
683
+ const query = {
684
+ ...(input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map((_entry) => _entry) }),
685
+ };
686
+ let body;
687
+ return new protocol_http_1.HttpRequest({
688
+ protocol,
689
+ hostname,
690
+ port,
691
+ method: "DELETE",
692
+ headers,
693
+ path: resolvedPath,
694
+ query,
695
+ body,
696
+ });
697
+ };
698
+ exports.serializeAws_restJson1UntagResourceCommand = serializeAws_restJson1UntagResourceCommand;
699
+ const serializeAws_restJson1UpdateBillingGroupCommand = async (input, context) => {
700
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
701
+ const headers = {
702
+ "content-type": "application/json",
703
+ };
704
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/update-billing-group";
705
+ let body;
706
+ body = JSON.stringify({
707
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
708
+ ...(input.ComputationPreference !== undefined &&
709
+ input.ComputationPreference !== null && {
710
+ ComputationPreference: serializeAws_restJson1ComputationPreference(input.ComputationPreference, context),
711
+ }),
712
+ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }),
713
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
714
+ ...(input.Status !== undefined && input.Status !== null && { Status: input.Status }),
715
+ });
716
+ return new protocol_http_1.HttpRequest({
717
+ protocol,
718
+ hostname,
719
+ port,
720
+ method: "POST",
721
+ headers,
722
+ path: resolvedPath,
723
+ body,
724
+ });
725
+ };
726
+ exports.serializeAws_restJson1UpdateBillingGroupCommand = serializeAws_restJson1UpdateBillingGroupCommand;
727
+ const serializeAws_restJson1UpdateCustomLineItemCommand = async (input, context) => {
728
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
729
+ const headers = {
730
+ "content-type": "application/json",
731
+ };
732
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/update-custom-line-item";
733
+ let body;
734
+ body = JSON.stringify({
735
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
736
+ ...(input.BillingPeriodRange !== undefined &&
737
+ input.BillingPeriodRange !== null && {
738
+ BillingPeriodRange: serializeAws_restJson1CustomLineItemBillingPeriodRange(input.BillingPeriodRange, context),
739
+ }),
740
+ ...(input.ChargeDetails !== undefined &&
741
+ input.ChargeDetails !== null && {
742
+ ChargeDetails: serializeAws_restJson1UpdateCustomLineItemChargeDetails(input.ChargeDetails, context),
743
+ }),
744
+ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }),
745
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
746
+ });
747
+ return new protocol_http_1.HttpRequest({
748
+ protocol,
749
+ hostname,
750
+ port,
751
+ method: "POST",
752
+ headers,
753
+ path: resolvedPath,
754
+ body,
755
+ });
756
+ };
757
+ exports.serializeAws_restJson1UpdateCustomLineItemCommand = serializeAws_restJson1UpdateCustomLineItemCommand;
758
+ const serializeAws_restJson1UpdatePricingPlanCommand = async (input, context) => {
759
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
760
+ const headers = {
761
+ "content-type": "application/json",
762
+ };
763
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/update-pricing-plan";
764
+ let body;
765
+ body = JSON.stringify({
766
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
767
+ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }),
768
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
769
+ });
770
+ return new protocol_http_1.HttpRequest({
771
+ protocol,
772
+ hostname,
773
+ port,
774
+ method: "PUT",
775
+ headers,
776
+ path: resolvedPath,
777
+ body,
778
+ });
779
+ };
780
+ exports.serializeAws_restJson1UpdatePricingPlanCommand = serializeAws_restJson1UpdatePricingPlanCommand;
781
+ const serializeAws_restJson1UpdatePricingRuleCommand = async (input, context) => {
782
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
783
+ const headers = {
784
+ "content-type": "application/json",
785
+ };
786
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/update-pricing-rule";
787
+ let body;
788
+ body = JSON.stringify({
789
+ ...(input.Arn !== undefined && input.Arn !== null && { Arn: input.Arn }),
790
+ ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }),
791
+ ...(input.ModifierPercentage !== undefined &&
792
+ input.ModifierPercentage !== null && { ModifierPercentage: (0, smithy_client_1.serializeFloat)(input.ModifierPercentage) }),
793
+ ...(input.Name !== undefined && input.Name !== null && { Name: input.Name }),
794
+ ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }),
795
+ });
796
+ return new protocol_http_1.HttpRequest({
797
+ protocol,
798
+ hostname,
799
+ port,
800
+ method: "PUT",
801
+ headers,
802
+ path: resolvedPath,
803
+ body,
804
+ });
805
+ };
806
+ exports.serializeAws_restJson1UpdatePricingRuleCommand = serializeAws_restJson1UpdatePricingRuleCommand;
807
+ const deserializeAws_restJson1AssociateAccountsCommand = async (output, context) => {
808
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
809
+ return deserializeAws_restJson1AssociateAccountsCommandError(output, context);
810
+ }
811
+ const contents = {
812
+ $metadata: deserializeMetadata(output),
813
+ Arn: undefined,
814
+ };
815
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
816
+ if (data.Arn !== undefined && data.Arn !== null) {
817
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
818
+ }
819
+ return Promise.resolve(contents);
820
+ };
821
+ exports.deserializeAws_restJson1AssociateAccountsCommand = deserializeAws_restJson1AssociateAccountsCommand;
822
+ const deserializeAws_restJson1AssociateAccountsCommandError = async (output, context) => {
823
+ const parsedOutput = {
824
+ ...output,
825
+ body: await parseBody(output.body, context),
826
+ };
827
+ let response;
828
+ let errorCode = "UnknownError";
829
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
830
+ switch (errorCode) {
831
+ case "AccessDeniedException":
832
+ case "com.amazonaws.billingconductor#AccessDeniedException":
833
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
834
+ case "ConflictException":
835
+ case "com.amazonaws.billingconductor#ConflictException":
836
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
837
+ case "InternalServerException":
838
+ case "com.amazonaws.billingconductor#InternalServerException":
839
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
840
+ case "ResourceNotFoundException":
841
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
842
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
843
+ case "ServiceLimitExceededException":
844
+ case "com.amazonaws.billingconductor#ServiceLimitExceededException":
845
+ throw await deserializeAws_restJson1ServiceLimitExceededExceptionResponse(parsedOutput, context);
846
+ case "ThrottlingException":
847
+ case "com.amazonaws.billingconductor#ThrottlingException":
848
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
849
+ case "ValidationException":
850
+ case "com.amazonaws.billingconductor#ValidationException":
851
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
852
+ default:
853
+ const parsedBody = parsedOutput.body;
854
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
855
+ name: parsedBody.code || parsedBody.Code || errorCode,
856
+ $fault: "client",
857
+ $metadata: deserializeMetadata(output),
858
+ });
859
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
860
+ }
861
+ };
862
+ const deserializeAws_restJson1AssociatePricingRulesCommand = async (output, context) => {
863
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
864
+ return deserializeAws_restJson1AssociatePricingRulesCommandError(output, context);
865
+ }
866
+ const contents = {
867
+ $metadata: deserializeMetadata(output),
868
+ Arn: undefined,
869
+ };
870
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
871
+ if (data.Arn !== undefined && data.Arn !== null) {
872
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
873
+ }
874
+ return Promise.resolve(contents);
875
+ };
876
+ exports.deserializeAws_restJson1AssociatePricingRulesCommand = deserializeAws_restJson1AssociatePricingRulesCommand;
877
+ const deserializeAws_restJson1AssociatePricingRulesCommandError = async (output, context) => {
878
+ const parsedOutput = {
879
+ ...output,
880
+ body: await parseBody(output.body, context),
881
+ };
882
+ let response;
883
+ let errorCode = "UnknownError";
884
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
885
+ switch (errorCode) {
886
+ case "AccessDeniedException":
887
+ case "com.amazonaws.billingconductor#AccessDeniedException":
888
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
889
+ case "ConflictException":
890
+ case "com.amazonaws.billingconductor#ConflictException":
891
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
892
+ case "InternalServerException":
893
+ case "com.amazonaws.billingconductor#InternalServerException":
894
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
895
+ case "ResourceNotFoundException":
896
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
897
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
898
+ case "ServiceLimitExceededException":
899
+ case "com.amazonaws.billingconductor#ServiceLimitExceededException":
900
+ throw await deserializeAws_restJson1ServiceLimitExceededExceptionResponse(parsedOutput, context);
901
+ case "ThrottlingException":
902
+ case "com.amazonaws.billingconductor#ThrottlingException":
903
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
904
+ case "ValidationException":
905
+ case "com.amazonaws.billingconductor#ValidationException":
906
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
907
+ default:
908
+ const parsedBody = parsedOutput.body;
909
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
910
+ name: parsedBody.code || parsedBody.Code || errorCode,
911
+ $fault: "client",
912
+ $metadata: deserializeMetadata(output),
913
+ });
914
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
915
+ }
916
+ };
917
+ const deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand = async (output, context) => {
918
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
919
+ return deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommandError(output, context);
920
+ }
921
+ const contents = {
922
+ $metadata: deserializeMetadata(output),
923
+ FailedAssociatedResources: undefined,
924
+ SuccessfullyAssociatedResources: undefined,
925
+ };
926
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
927
+ if (data.FailedAssociatedResources !== undefined && data.FailedAssociatedResources !== null) {
928
+ contents.FailedAssociatedResources = deserializeAws_restJson1AssociateResourcesResponseList(data.FailedAssociatedResources, context);
929
+ }
930
+ if (data.SuccessfullyAssociatedResources !== undefined && data.SuccessfullyAssociatedResources !== null) {
931
+ contents.SuccessfullyAssociatedResources = deserializeAws_restJson1AssociateResourcesResponseList(data.SuccessfullyAssociatedResources, context);
932
+ }
933
+ return Promise.resolve(contents);
934
+ };
935
+ exports.deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand = deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommand;
936
+ const deserializeAws_restJson1BatchAssociateResourcesToCustomLineItemCommandError = async (output, context) => {
937
+ const parsedOutput = {
938
+ ...output,
939
+ body: await parseBody(output.body, context),
940
+ };
941
+ let response;
942
+ let errorCode = "UnknownError";
943
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
944
+ switch (errorCode) {
945
+ case "AccessDeniedException":
946
+ case "com.amazonaws.billingconductor#AccessDeniedException":
947
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
948
+ case "ConflictException":
949
+ case "com.amazonaws.billingconductor#ConflictException":
950
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
951
+ case "InternalServerException":
952
+ case "com.amazonaws.billingconductor#InternalServerException":
953
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
954
+ case "ResourceNotFoundException":
955
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
956
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
957
+ case "ServiceLimitExceededException":
958
+ case "com.amazonaws.billingconductor#ServiceLimitExceededException":
959
+ throw await deserializeAws_restJson1ServiceLimitExceededExceptionResponse(parsedOutput, context);
960
+ case "ThrottlingException":
961
+ case "com.amazonaws.billingconductor#ThrottlingException":
962
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
963
+ case "ValidationException":
964
+ case "com.amazonaws.billingconductor#ValidationException":
965
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
966
+ default:
967
+ const parsedBody = parsedOutput.body;
968
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
969
+ name: parsedBody.code || parsedBody.Code || errorCode,
970
+ $fault: "client",
971
+ $metadata: deserializeMetadata(output),
972
+ });
973
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
974
+ }
975
+ };
976
+ const deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand = async (output, context) => {
977
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
978
+ return deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommandError(output, context);
979
+ }
980
+ const contents = {
981
+ $metadata: deserializeMetadata(output),
982
+ FailedDisassociatedResources: undefined,
983
+ SuccessfullyDisassociatedResources: undefined,
984
+ };
985
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
986
+ if (data.FailedDisassociatedResources !== undefined && data.FailedDisassociatedResources !== null) {
987
+ contents.FailedDisassociatedResources = deserializeAws_restJson1DisassociateResourcesResponseList(data.FailedDisassociatedResources, context);
988
+ }
989
+ if (data.SuccessfullyDisassociatedResources !== undefined && data.SuccessfullyDisassociatedResources !== null) {
990
+ contents.SuccessfullyDisassociatedResources = deserializeAws_restJson1DisassociateResourcesResponseList(data.SuccessfullyDisassociatedResources, context);
991
+ }
992
+ return Promise.resolve(contents);
993
+ };
994
+ exports.deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand = deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommand;
995
+ const deserializeAws_restJson1BatchDisassociateResourcesFromCustomLineItemCommandError = async (output, context) => {
996
+ const parsedOutput = {
997
+ ...output,
998
+ body: await parseBody(output.body, context),
999
+ };
1000
+ let response;
1001
+ let errorCode = "UnknownError";
1002
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1003
+ switch (errorCode) {
1004
+ case "AccessDeniedException":
1005
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1006
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1007
+ case "ConflictException":
1008
+ case "com.amazonaws.billingconductor#ConflictException":
1009
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1010
+ case "InternalServerException":
1011
+ case "com.amazonaws.billingconductor#InternalServerException":
1012
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1013
+ case "ResourceNotFoundException":
1014
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1015
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1016
+ case "ThrottlingException":
1017
+ case "com.amazonaws.billingconductor#ThrottlingException":
1018
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1019
+ case "ValidationException":
1020
+ case "com.amazonaws.billingconductor#ValidationException":
1021
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1022
+ default:
1023
+ const parsedBody = parsedOutput.body;
1024
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1025
+ name: parsedBody.code || parsedBody.Code || errorCode,
1026
+ $fault: "client",
1027
+ $metadata: deserializeMetadata(output),
1028
+ });
1029
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1030
+ }
1031
+ };
1032
+ const deserializeAws_restJson1CreateBillingGroupCommand = async (output, context) => {
1033
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1034
+ return deserializeAws_restJson1CreateBillingGroupCommandError(output, context);
1035
+ }
1036
+ const contents = {
1037
+ $metadata: deserializeMetadata(output),
1038
+ Arn: undefined,
1039
+ };
1040
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1041
+ if (data.Arn !== undefined && data.Arn !== null) {
1042
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1043
+ }
1044
+ return Promise.resolve(contents);
1045
+ };
1046
+ exports.deserializeAws_restJson1CreateBillingGroupCommand = deserializeAws_restJson1CreateBillingGroupCommand;
1047
+ const deserializeAws_restJson1CreateBillingGroupCommandError = async (output, context) => {
1048
+ const parsedOutput = {
1049
+ ...output,
1050
+ body: await parseBody(output.body, context),
1051
+ };
1052
+ let response;
1053
+ let errorCode = "UnknownError";
1054
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1055
+ switch (errorCode) {
1056
+ case "AccessDeniedException":
1057
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1058
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1059
+ case "ConflictException":
1060
+ case "com.amazonaws.billingconductor#ConflictException":
1061
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1062
+ case "InternalServerException":
1063
+ case "com.amazonaws.billingconductor#InternalServerException":
1064
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1065
+ case "ServiceLimitExceededException":
1066
+ case "com.amazonaws.billingconductor#ServiceLimitExceededException":
1067
+ throw await deserializeAws_restJson1ServiceLimitExceededExceptionResponse(parsedOutput, context);
1068
+ case "ThrottlingException":
1069
+ case "com.amazonaws.billingconductor#ThrottlingException":
1070
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1071
+ case "ValidationException":
1072
+ case "com.amazonaws.billingconductor#ValidationException":
1073
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1074
+ default:
1075
+ const parsedBody = parsedOutput.body;
1076
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1077
+ name: parsedBody.code || parsedBody.Code || errorCode,
1078
+ $fault: "client",
1079
+ $metadata: deserializeMetadata(output),
1080
+ });
1081
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1082
+ }
1083
+ };
1084
+ const deserializeAws_restJson1CreateCustomLineItemCommand = async (output, context) => {
1085
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1086
+ return deserializeAws_restJson1CreateCustomLineItemCommandError(output, context);
1087
+ }
1088
+ const contents = {
1089
+ $metadata: deserializeMetadata(output),
1090
+ Arn: undefined,
1091
+ };
1092
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1093
+ if (data.Arn !== undefined && data.Arn !== null) {
1094
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1095
+ }
1096
+ return Promise.resolve(contents);
1097
+ };
1098
+ exports.deserializeAws_restJson1CreateCustomLineItemCommand = deserializeAws_restJson1CreateCustomLineItemCommand;
1099
+ const deserializeAws_restJson1CreateCustomLineItemCommandError = async (output, context) => {
1100
+ const parsedOutput = {
1101
+ ...output,
1102
+ body: await parseBody(output.body, context),
1103
+ };
1104
+ let response;
1105
+ let errorCode = "UnknownError";
1106
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1107
+ switch (errorCode) {
1108
+ case "AccessDeniedException":
1109
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1110
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1111
+ case "ConflictException":
1112
+ case "com.amazonaws.billingconductor#ConflictException":
1113
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1114
+ case "InternalServerException":
1115
+ case "com.amazonaws.billingconductor#InternalServerException":
1116
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1117
+ case "ServiceLimitExceededException":
1118
+ case "com.amazonaws.billingconductor#ServiceLimitExceededException":
1119
+ throw await deserializeAws_restJson1ServiceLimitExceededExceptionResponse(parsedOutput, context);
1120
+ case "ThrottlingException":
1121
+ case "com.amazonaws.billingconductor#ThrottlingException":
1122
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1123
+ case "ValidationException":
1124
+ case "com.amazonaws.billingconductor#ValidationException":
1125
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1126
+ default:
1127
+ const parsedBody = parsedOutput.body;
1128
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1129
+ name: parsedBody.code || parsedBody.Code || errorCode,
1130
+ $fault: "client",
1131
+ $metadata: deserializeMetadata(output),
1132
+ });
1133
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1134
+ }
1135
+ };
1136
+ const deserializeAws_restJson1CreatePricingPlanCommand = async (output, context) => {
1137
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1138
+ return deserializeAws_restJson1CreatePricingPlanCommandError(output, context);
1139
+ }
1140
+ const contents = {
1141
+ $metadata: deserializeMetadata(output),
1142
+ Arn: undefined,
1143
+ };
1144
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1145
+ if (data.Arn !== undefined && data.Arn !== null) {
1146
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1147
+ }
1148
+ return Promise.resolve(contents);
1149
+ };
1150
+ exports.deserializeAws_restJson1CreatePricingPlanCommand = deserializeAws_restJson1CreatePricingPlanCommand;
1151
+ const deserializeAws_restJson1CreatePricingPlanCommandError = async (output, context) => {
1152
+ const parsedOutput = {
1153
+ ...output,
1154
+ body: await parseBody(output.body, context),
1155
+ };
1156
+ let response;
1157
+ let errorCode = "UnknownError";
1158
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1159
+ switch (errorCode) {
1160
+ case "AccessDeniedException":
1161
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1162
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1163
+ case "ConflictException":
1164
+ case "com.amazonaws.billingconductor#ConflictException":
1165
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1166
+ case "InternalServerException":
1167
+ case "com.amazonaws.billingconductor#InternalServerException":
1168
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1169
+ case "ResourceNotFoundException":
1170
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1171
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1172
+ case "ServiceLimitExceededException":
1173
+ case "com.amazonaws.billingconductor#ServiceLimitExceededException":
1174
+ throw await deserializeAws_restJson1ServiceLimitExceededExceptionResponse(parsedOutput, context);
1175
+ case "ThrottlingException":
1176
+ case "com.amazonaws.billingconductor#ThrottlingException":
1177
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1178
+ case "ValidationException":
1179
+ case "com.amazonaws.billingconductor#ValidationException":
1180
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1181
+ default:
1182
+ const parsedBody = parsedOutput.body;
1183
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1184
+ name: parsedBody.code || parsedBody.Code || errorCode,
1185
+ $fault: "client",
1186
+ $metadata: deserializeMetadata(output),
1187
+ });
1188
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1189
+ }
1190
+ };
1191
+ const deserializeAws_restJson1CreatePricingRuleCommand = async (output, context) => {
1192
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1193
+ return deserializeAws_restJson1CreatePricingRuleCommandError(output, context);
1194
+ }
1195
+ const contents = {
1196
+ $metadata: deserializeMetadata(output),
1197
+ Arn: undefined,
1198
+ };
1199
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1200
+ if (data.Arn !== undefined && data.Arn !== null) {
1201
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1202
+ }
1203
+ return Promise.resolve(contents);
1204
+ };
1205
+ exports.deserializeAws_restJson1CreatePricingRuleCommand = deserializeAws_restJson1CreatePricingRuleCommand;
1206
+ const deserializeAws_restJson1CreatePricingRuleCommandError = async (output, context) => {
1207
+ const parsedOutput = {
1208
+ ...output,
1209
+ body: await parseBody(output.body, context),
1210
+ };
1211
+ let response;
1212
+ let errorCode = "UnknownError";
1213
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1214
+ switch (errorCode) {
1215
+ case "AccessDeniedException":
1216
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1217
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1218
+ case "ConflictException":
1219
+ case "com.amazonaws.billingconductor#ConflictException":
1220
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1221
+ case "InternalServerException":
1222
+ case "com.amazonaws.billingconductor#InternalServerException":
1223
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1224
+ case "ServiceLimitExceededException":
1225
+ case "com.amazonaws.billingconductor#ServiceLimitExceededException":
1226
+ throw await deserializeAws_restJson1ServiceLimitExceededExceptionResponse(parsedOutput, context);
1227
+ case "ThrottlingException":
1228
+ case "com.amazonaws.billingconductor#ThrottlingException":
1229
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1230
+ case "ValidationException":
1231
+ case "com.amazonaws.billingconductor#ValidationException":
1232
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1233
+ default:
1234
+ const parsedBody = parsedOutput.body;
1235
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1236
+ name: parsedBody.code || parsedBody.Code || errorCode,
1237
+ $fault: "client",
1238
+ $metadata: deserializeMetadata(output),
1239
+ });
1240
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1241
+ }
1242
+ };
1243
+ const deserializeAws_restJson1DeleteBillingGroupCommand = async (output, context) => {
1244
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1245
+ return deserializeAws_restJson1DeleteBillingGroupCommandError(output, context);
1246
+ }
1247
+ const contents = {
1248
+ $metadata: deserializeMetadata(output),
1249
+ Arn: undefined,
1250
+ };
1251
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1252
+ if (data.Arn !== undefined && data.Arn !== null) {
1253
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1254
+ }
1255
+ return Promise.resolve(contents);
1256
+ };
1257
+ exports.deserializeAws_restJson1DeleteBillingGroupCommand = deserializeAws_restJson1DeleteBillingGroupCommand;
1258
+ const deserializeAws_restJson1DeleteBillingGroupCommandError = async (output, context) => {
1259
+ const parsedOutput = {
1260
+ ...output,
1261
+ body: await parseBody(output.body, context),
1262
+ };
1263
+ let response;
1264
+ let errorCode = "UnknownError";
1265
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1266
+ switch (errorCode) {
1267
+ case "AccessDeniedException":
1268
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1269
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1270
+ case "InternalServerException":
1271
+ case "com.amazonaws.billingconductor#InternalServerException":
1272
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1273
+ case "ThrottlingException":
1274
+ case "com.amazonaws.billingconductor#ThrottlingException":
1275
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1276
+ case "ValidationException":
1277
+ case "com.amazonaws.billingconductor#ValidationException":
1278
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1279
+ default:
1280
+ const parsedBody = parsedOutput.body;
1281
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1282
+ name: parsedBody.code || parsedBody.Code || errorCode,
1283
+ $fault: "client",
1284
+ $metadata: deserializeMetadata(output),
1285
+ });
1286
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1287
+ }
1288
+ };
1289
+ const deserializeAws_restJson1DeleteCustomLineItemCommand = async (output, context) => {
1290
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1291
+ return deserializeAws_restJson1DeleteCustomLineItemCommandError(output, context);
1292
+ }
1293
+ const contents = {
1294
+ $metadata: deserializeMetadata(output),
1295
+ Arn: undefined,
1296
+ };
1297
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1298
+ if (data.Arn !== undefined && data.Arn !== null) {
1299
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1300
+ }
1301
+ return Promise.resolve(contents);
1302
+ };
1303
+ exports.deserializeAws_restJson1DeleteCustomLineItemCommand = deserializeAws_restJson1DeleteCustomLineItemCommand;
1304
+ const deserializeAws_restJson1DeleteCustomLineItemCommandError = async (output, context) => {
1305
+ const parsedOutput = {
1306
+ ...output,
1307
+ body: await parseBody(output.body, context),
1308
+ };
1309
+ let response;
1310
+ let errorCode = "UnknownError";
1311
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1312
+ switch (errorCode) {
1313
+ case "AccessDeniedException":
1314
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1315
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1316
+ case "ConflictException":
1317
+ case "com.amazonaws.billingconductor#ConflictException":
1318
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1319
+ case "InternalServerException":
1320
+ case "com.amazonaws.billingconductor#InternalServerException":
1321
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1322
+ case "ThrottlingException":
1323
+ case "com.amazonaws.billingconductor#ThrottlingException":
1324
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1325
+ case "ValidationException":
1326
+ case "com.amazonaws.billingconductor#ValidationException":
1327
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1328
+ default:
1329
+ const parsedBody = parsedOutput.body;
1330
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1331
+ name: parsedBody.code || parsedBody.Code || errorCode,
1332
+ $fault: "client",
1333
+ $metadata: deserializeMetadata(output),
1334
+ });
1335
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1336
+ }
1337
+ };
1338
+ const deserializeAws_restJson1DeletePricingPlanCommand = async (output, context) => {
1339
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1340
+ return deserializeAws_restJson1DeletePricingPlanCommandError(output, context);
1341
+ }
1342
+ const contents = {
1343
+ $metadata: deserializeMetadata(output),
1344
+ Arn: undefined,
1345
+ };
1346
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1347
+ if (data.Arn !== undefined && data.Arn !== null) {
1348
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1349
+ }
1350
+ return Promise.resolve(contents);
1351
+ };
1352
+ exports.deserializeAws_restJson1DeletePricingPlanCommand = deserializeAws_restJson1DeletePricingPlanCommand;
1353
+ const deserializeAws_restJson1DeletePricingPlanCommandError = async (output, context) => {
1354
+ const parsedOutput = {
1355
+ ...output,
1356
+ body: await parseBody(output.body, context),
1357
+ };
1358
+ let response;
1359
+ let errorCode = "UnknownError";
1360
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1361
+ switch (errorCode) {
1362
+ case "AccessDeniedException":
1363
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1364
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1365
+ case "ConflictException":
1366
+ case "com.amazonaws.billingconductor#ConflictException":
1367
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1368
+ case "InternalServerException":
1369
+ case "com.amazonaws.billingconductor#InternalServerException":
1370
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1371
+ case "ThrottlingException":
1372
+ case "com.amazonaws.billingconductor#ThrottlingException":
1373
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1374
+ case "ValidationException":
1375
+ case "com.amazonaws.billingconductor#ValidationException":
1376
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1377
+ default:
1378
+ const parsedBody = parsedOutput.body;
1379
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1380
+ name: parsedBody.code || parsedBody.Code || errorCode,
1381
+ $fault: "client",
1382
+ $metadata: deserializeMetadata(output),
1383
+ });
1384
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1385
+ }
1386
+ };
1387
+ const deserializeAws_restJson1DeletePricingRuleCommand = async (output, context) => {
1388
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1389
+ return deserializeAws_restJson1DeletePricingRuleCommandError(output, context);
1390
+ }
1391
+ const contents = {
1392
+ $metadata: deserializeMetadata(output),
1393
+ Arn: undefined,
1394
+ };
1395
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1396
+ if (data.Arn !== undefined && data.Arn !== null) {
1397
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1398
+ }
1399
+ return Promise.resolve(contents);
1400
+ };
1401
+ exports.deserializeAws_restJson1DeletePricingRuleCommand = deserializeAws_restJson1DeletePricingRuleCommand;
1402
+ const deserializeAws_restJson1DeletePricingRuleCommandError = async (output, context) => {
1403
+ const parsedOutput = {
1404
+ ...output,
1405
+ body: await parseBody(output.body, context),
1406
+ };
1407
+ let response;
1408
+ let errorCode = "UnknownError";
1409
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1410
+ switch (errorCode) {
1411
+ case "AccessDeniedException":
1412
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1413
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1414
+ case "ConflictException":
1415
+ case "com.amazonaws.billingconductor#ConflictException":
1416
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1417
+ case "InternalServerException":
1418
+ case "com.amazonaws.billingconductor#InternalServerException":
1419
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1420
+ case "ThrottlingException":
1421
+ case "com.amazonaws.billingconductor#ThrottlingException":
1422
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1423
+ case "ValidationException":
1424
+ case "com.amazonaws.billingconductor#ValidationException":
1425
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1426
+ default:
1427
+ const parsedBody = parsedOutput.body;
1428
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1429
+ name: parsedBody.code || parsedBody.Code || errorCode,
1430
+ $fault: "client",
1431
+ $metadata: deserializeMetadata(output),
1432
+ });
1433
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1434
+ }
1435
+ };
1436
+ const deserializeAws_restJson1DisassociateAccountsCommand = async (output, context) => {
1437
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1438
+ return deserializeAws_restJson1DisassociateAccountsCommandError(output, context);
1439
+ }
1440
+ const contents = {
1441
+ $metadata: deserializeMetadata(output),
1442
+ Arn: undefined,
1443
+ };
1444
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1445
+ if (data.Arn !== undefined && data.Arn !== null) {
1446
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1447
+ }
1448
+ return Promise.resolve(contents);
1449
+ };
1450
+ exports.deserializeAws_restJson1DisassociateAccountsCommand = deserializeAws_restJson1DisassociateAccountsCommand;
1451
+ const deserializeAws_restJson1DisassociateAccountsCommandError = async (output, context) => {
1452
+ const parsedOutput = {
1453
+ ...output,
1454
+ body: await parseBody(output.body, context),
1455
+ };
1456
+ let response;
1457
+ let errorCode = "UnknownError";
1458
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1459
+ switch (errorCode) {
1460
+ case "AccessDeniedException":
1461
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1462
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1463
+ case "ConflictException":
1464
+ case "com.amazonaws.billingconductor#ConflictException":
1465
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1466
+ case "InternalServerException":
1467
+ case "com.amazonaws.billingconductor#InternalServerException":
1468
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1469
+ case "ResourceNotFoundException":
1470
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1471
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1472
+ case "ThrottlingException":
1473
+ case "com.amazonaws.billingconductor#ThrottlingException":
1474
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1475
+ case "ValidationException":
1476
+ case "com.amazonaws.billingconductor#ValidationException":
1477
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1478
+ default:
1479
+ const parsedBody = parsedOutput.body;
1480
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1481
+ name: parsedBody.code || parsedBody.Code || errorCode,
1482
+ $fault: "client",
1483
+ $metadata: deserializeMetadata(output),
1484
+ });
1485
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1486
+ }
1487
+ };
1488
+ const deserializeAws_restJson1DisassociatePricingRulesCommand = async (output, context) => {
1489
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1490
+ return deserializeAws_restJson1DisassociatePricingRulesCommandError(output, context);
1491
+ }
1492
+ const contents = {
1493
+ $metadata: deserializeMetadata(output),
1494
+ Arn: undefined,
1495
+ };
1496
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1497
+ if (data.Arn !== undefined && data.Arn !== null) {
1498
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1499
+ }
1500
+ return Promise.resolve(contents);
1501
+ };
1502
+ exports.deserializeAws_restJson1DisassociatePricingRulesCommand = deserializeAws_restJson1DisassociatePricingRulesCommand;
1503
+ const deserializeAws_restJson1DisassociatePricingRulesCommandError = async (output, context) => {
1504
+ const parsedOutput = {
1505
+ ...output,
1506
+ body: await parseBody(output.body, context),
1507
+ };
1508
+ let response;
1509
+ let errorCode = "UnknownError";
1510
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1511
+ switch (errorCode) {
1512
+ case "AccessDeniedException":
1513
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1514
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1515
+ case "ConflictException":
1516
+ case "com.amazonaws.billingconductor#ConflictException":
1517
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1518
+ case "InternalServerException":
1519
+ case "com.amazonaws.billingconductor#InternalServerException":
1520
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1521
+ case "ResourceNotFoundException":
1522
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1523
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1524
+ case "ThrottlingException":
1525
+ case "com.amazonaws.billingconductor#ThrottlingException":
1526
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1527
+ case "ValidationException":
1528
+ case "com.amazonaws.billingconductor#ValidationException":
1529
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1530
+ default:
1531
+ const parsedBody = parsedOutput.body;
1532
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1533
+ name: parsedBody.code || parsedBody.Code || errorCode,
1534
+ $fault: "client",
1535
+ $metadata: deserializeMetadata(output),
1536
+ });
1537
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1538
+ }
1539
+ };
1540
+ const deserializeAws_restJson1ListAccountAssociationsCommand = async (output, context) => {
1541
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1542
+ return deserializeAws_restJson1ListAccountAssociationsCommandError(output, context);
1543
+ }
1544
+ const contents = {
1545
+ $metadata: deserializeMetadata(output),
1546
+ LinkedAccounts: undefined,
1547
+ NextToken: undefined,
1548
+ };
1549
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1550
+ if (data.LinkedAccounts !== undefined && data.LinkedAccounts !== null) {
1551
+ contents.LinkedAccounts = deserializeAws_restJson1AccountAssociationsList(data.LinkedAccounts, context);
1552
+ }
1553
+ if (data.NextToken !== undefined && data.NextToken !== null) {
1554
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1555
+ }
1556
+ return Promise.resolve(contents);
1557
+ };
1558
+ exports.deserializeAws_restJson1ListAccountAssociationsCommand = deserializeAws_restJson1ListAccountAssociationsCommand;
1559
+ const deserializeAws_restJson1ListAccountAssociationsCommandError = async (output, context) => {
1560
+ const parsedOutput = {
1561
+ ...output,
1562
+ body: await parseBody(output.body, context),
1563
+ };
1564
+ let response;
1565
+ let errorCode = "UnknownError";
1566
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1567
+ switch (errorCode) {
1568
+ case "AccessDeniedException":
1569
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1570
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1571
+ case "InternalServerException":
1572
+ case "com.amazonaws.billingconductor#InternalServerException":
1573
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1574
+ case "ResourceNotFoundException":
1575
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1576
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1577
+ case "ThrottlingException":
1578
+ case "com.amazonaws.billingconductor#ThrottlingException":
1579
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1580
+ case "ValidationException":
1581
+ case "com.amazonaws.billingconductor#ValidationException":
1582
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1583
+ default:
1584
+ const parsedBody = parsedOutput.body;
1585
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1586
+ name: parsedBody.code || parsedBody.Code || errorCode,
1587
+ $fault: "client",
1588
+ $metadata: deserializeMetadata(output),
1589
+ });
1590
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1591
+ }
1592
+ };
1593
+ const deserializeAws_restJson1ListBillingGroupCostReportsCommand = async (output, context) => {
1594
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1595
+ return deserializeAws_restJson1ListBillingGroupCostReportsCommandError(output, context);
1596
+ }
1597
+ const contents = {
1598
+ $metadata: deserializeMetadata(output),
1599
+ BillingGroupCostReports: undefined,
1600
+ NextToken: undefined,
1601
+ };
1602
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1603
+ if (data.BillingGroupCostReports !== undefined && data.BillingGroupCostReports !== null) {
1604
+ contents.BillingGroupCostReports = deserializeAws_restJson1BillingGroupCostReportList(data.BillingGroupCostReports, context);
1605
+ }
1606
+ if (data.NextToken !== undefined && data.NextToken !== null) {
1607
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1608
+ }
1609
+ return Promise.resolve(contents);
1610
+ };
1611
+ exports.deserializeAws_restJson1ListBillingGroupCostReportsCommand = deserializeAws_restJson1ListBillingGroupCostReportsCommand;
1612
+ const deserializeAws_restJson1ListBillingGroupCostReportsCommandError = async (output, context) => {
1613
+ const parsedOutput = {
1614
+ ...output,
1615
+ body: await parseBody(output.body, context),
1616
+ };
1617
+ let response;
1618
+ let errorCode = "UnknownError";
1619
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1620
+ switch (errorCode) {
1621
+ case "AccessDeniedException":
1622
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1623
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1624
+ case "InternalServerException":
1625
+ case "com.amazonaws.billingconductor#InternalServerException":
1626
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1627
+ case "ResourceNotFoundException":
1628
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1629
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1630
+ case "ThrottlingException":
1631
+ case "com.amazonaws.billingconductor#ThrottlingException":
1632
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1633
+ case "ValidationException":
1634
+ case "com.amazonaws.billingconductor#ValidationException":
1635
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1636
+ default:
1637
+ const parsedBody = parsedOutput.body;
1638
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1639
+ name: parsedBody.code || parsedBody.Code || errorCode,
1640
+ $fault: "client",
1641
+ $metadata: deserializeMetadata(output),
1642
+ });
1643
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1644
+ }
1645
+ };
1646
+ const deserializeAws_restJson1ListBillingGroupsCommand = async (output, context) => {
1647
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1648
+ return deserializeAws_restJson1ListBillingGroupsCommandError(output, context);
1649
+ }
1650
+ const contents = {
1651
+ $metadata: deserializeMetadata(output),
1652
+ BillingGroups: undefined,
1653
+ NextToken: undefined,
1654
+ };
1655
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1656
+ if (data.BillingGroups !== undefined && data.BillingGroups !== null) {
1657
+ contents.BillingGroups = deserializeAws_restJson1BillingGroupList(data.BillingGroups, context);
1658
+ }
1659
+ if (data.NextToken !== undefined && data.NextToken !== null) {
1660
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1661
+ }
1662
+ return Promise.resolve(contents);
1663
+ };
1664
+ exports.deserializeAws_restJson1ListBillingGroupsCommand = deserializeAws_restJson1ListBillingGroupsCommand;
1665
+ const deserializeAws_restJson1ListBillingGroupsCommandError = async (output, context) => {
1666
+ const parsedOutput = {
1667
+ ...output,
1668
+ body: await parseBody(output.body, context),
1669
+ };
1670
+ let response;
1671
+ let errorCode = "UnknownError";
1672
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1673
+ switch (errorCode) {
1674
+ case "AccessDeniedException":
1675
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1676
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1677
+ case "InternalServerException":
1678
+ case "com.amazonaws.billingconductor#InternalServerException":
1679
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1680
+ case "ResourceNotFoundException":
1681
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1682
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1683
+ case "ThrottlingException":
1684
+ case "com.amazonaws.billingconductor#ThrottlingException":
1685
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1686
+ case "ValidationException":
1687
+ case "com.amazonaws.billingconductor#ValidationException":
1688
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1689
+ default:
1690
+ const parsedBody = parsedOutput.body;
1691
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1692
+ name: parsedBody.code || parsedBody.Code || errorCode,
1693
+ $fault: "client",
1694
+ $metadata: deserializeMetadata(output),
1695
+ });
1696
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1697
+ }
1698
+ };
1699
+ const deserializeAws_restJson1ListCustomLineItemsCommand = async (output, context) => {
1700
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1701
+ return deserializeAws_restJson1ListCustomLineItemsCommandError(output, context);
1702
+ }
1703
+ const contents = {
1704
+ $metadata: deserializeMetadata(output),
1705
+ CustomLineItems: undefined,
1706
+ NextToken: undefined,
1707
+ };
1708
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1709
+ if (data.CustomLineItems !== undefined && data.CustomLineItems !== null) {
1710
+ contents.CustomLineItems = deserializeAws_restJson1CustomLineItemList(data.CustomLineItems, context);
1711
+ }
1712
+ if (data.NextToken !== undefined && data.NextToken !== null) {
1713
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1714
+ }
1715
+ return Promise.resolve(contents);
1716
+ };
1717
+ exports.deserializeAws_restJson1ListCustomLineItemsCommand = deserializeAws_restJson1ListCustomLineItemsCommand;
1718
+ const deserializeAws_restJson1ListCustomLineItemsCommandError = async (output, context) => {
1719
+ const parsedOutput = {
1720
+ ...output,
1721
+ body: await parseBody(output.body, context),
1722
+ };
1723
+ let response;
1724
+ let errorCode = "UnknownError";
1725
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1726
+ switch (errorCode) {
1727
+ case "AccessDeniedException":
1728
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1729
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1730
+ case "InternalServerException":
1731
+ case "com.amazonaws.billingconductor#InternalServerException":
1732
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1733
+ case "ResourceNotFoundException":
1734
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1735
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1736
+ case "ThrottlingException":
1737
+ case "com.amazonaws.billingconductor#ThrottlingException":
1738
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1739
+ case "ValidationException":
1740
+ case "com.amazonaws.billingconductor#ValidationException":
1741
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1742
+ default:
1743
+ const parsedBody = parsedOutput.body;
1744
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1745
+ name: parsedBody.code || parsedBody.Code || errorCode,
1746
+ $fault: "client",
1747
+ $metadata: deserializeMetadata(output),
1748
+ });
1749
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1750
+ }
1751
+ };
1752
+ const deserializeAws_restJson1ListPricingPlansCommand = async (output, context) => {
1753
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1754
+ return deserializeAws_restJson1ListPricingPlansCommandError(output, context);
1755
+ }
1756
+ const contents = {
1757
+ $metadata: deserializeMetadata(output),
1758
+ BillingPeriod: undefined,
1759
+ NextToken: undefined,
1760
+ PricingPlans: undefined,
1761
+ };
1762
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1763
+ if (data.BillingPeriod !== undefined && data.BillingPeriod !== null) {
1764
+ contents.BillingPeriod = (0, smithy_client_1.expectString)(data.BillingPeriod);
1765
+ }
1766
+ if (data.NextToken !== undefined && data.NextToken !== null) {
1767
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1768
+ }
1769
+ if (data.PricingPlans !== undefined && data.PricingPlans !== null) {
1770
+ contents.PricingPlans = deserializeAws_restJson1PricingPlanList(data.PricingPlans, context);
1771
+ }
1772
+ return Promise.resolve(contents);
1773
+ };
1774
+ exports.deserializeAws_restJson1ListPricingPlansCommand = deserializeAws_restJson1ListPricingPlansCommand;
1775
+ const deserializeAws_restJson1ListPricingPlansCommandError = async (output, context) => {
1776
+ const parsedOutput = {
1777
+ ...output,
1778
+ body: await parseBody(output.body, context),
1779
+ };
1780
+ let response;
1781
+ let errorCode = "UnknownError";
1782
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1783
+ switch (errorCode) {
1784
+ case "AccessDeniedException":
1785
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1786
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1787
+ case "InternalServerException":
1788
+ case "com.amazonaws.billingconductor#InternalServerException":
1789
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1790
+ case "ThrottlingException":
1791
+ case "com.amazonaws.billingconductor#ThrottlingException":
1792
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1793
+ case "ValidationException":
1794
+ case "com.amazonaws.billingconductor#ValidationException":
1795
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1796
+ default:
1797
+ const parsedBody = parsedOutput.body;
1798
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1799
+ name: parsedBody.code || parsedBody.Code || errorCode,
1800
+ $fault: "client",
1801
+ $metadata: deserializeMetadata(output),
1802
+ });
1803
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1804
+ }
1805
+ };
1806
+ const deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand = async (output, context) => {
1807
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1808
+ return deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommandError(output, context);
1809
+ }
1810
+ const contents = {
1811
+ $metadata: deserializeMetadata(output),
1812
+ BillingPeriod: undefined,
1813
+ NextToken: undefined,
1814
+ PricingPlanArns: undefined,
1815
+ PricingRuleArn: undefined,
1816
+ };
1817
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1818
+ if (data.BillingPeriod !== undefined && data.BillingPeriod !== null) {
1819
+ contents.BillingPeriod = (0, smithy_client_1.expectString)(data.BillingPeriod);
1820
+ }
1821
+ if (data.NextToken !== undefined && data.NextToken !== null) {
1822
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1823
+ }
1824
+ if (data.PricingPlanArns !== undefined && data.PricingPlanArns !== null) {
1825
+ contents.PricingPlanArns = deserializeAws_restJson1PricingPlanArns(data.PricingPlanArns, context);
1826
+ }
1827
+ if (data.PricingRuleArn !== undefined && data.PricingRuleArn !== null) {
1828
+ contents.PricingRuleArn = (0, smithy_client_1.expectString)(data.PricingRuleArn);
1829
+ }
1830
+ return Promise.resolve(contents);
1831
+ };
1832
+ exports.deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand = deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommand;
1833
+ const deserializeAws_restJson1ListPricingPlansAssociatedWithPricingRuleCommandError = async (output, context) => {
1834
+ const parsedOutput = {
1835
+ ...output,
1836
+ body: await parseBody(output.body, context),
1837
+ };
1838
+ let response;
1839
+ let errorCode = "UnknownError";
1840
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1841
+ switch (errorCode) {
1842
+ case "AccessDeniedException":
1843
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1844
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1845
+ case "InternalServerException":
1846
+ case "com.amazonaws.billingconductor#InternalServerException":
1847
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1848
+ case "ResourceNotFoundException":
1849
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1850
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1851
+ case "ThrottlingException":
1852
+ case "com.amazonaws.billingconductor#ThrottlingException":
1853
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1854
+ case "ValidationException":
1855
+ case "com.amazonaws.billingconductor#ValidationException":
1856
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1857
+ default:
1858
+ const parsedBody = parsedOutput.body;
1859
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1860
+ name: parsedBody.code || parsedBody.Code || errorCode,
1861
+ $fault: "client",
1862
+ $metadata: deserializeMetadata(output),
1863
+ });
1864
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1865
+ }
1866
+ };
1867
+ const deserializeAws_restJson1ListPricingRulesCommand = async (output, context) => {
1868
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1869
+ return deserializeAws_restJson1ListPricingRulesCommandError(output, context);
1870
+ }
1871
+ const contents = {
1872
+ $metadata: deserializeMetadata(output),
1873
+ BillingPeriod: undefined,
1874
+ NextToken: undefined,
1875
+ PricingRules: undefined,
1876
+ };
1877
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1878
+ if (data.BillingPeriod !== undefined && data.BillingPeriod !== null) {
1879
+ contents.BillingPeriod = (0, smithy_client_1.expectString)(data.BillingPeriod);
1880
+ }
1881
+ if (data.NextToken !== undefined && data.NextToken !== null) {
1882
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1883
+ }
1884
+ if (data.PricingRules !== undefined && data.PricingRules !== null) {
1885
+ contents.PricingRules = deserializeAws_restJson1PricingRuleList(data.PricingRules, context);
1886
+ }
1887
+ return Promise.resolve(contents);
1888
+ };
1889
+ exports.deserializeAws_restJson1ListPricingRulesCommand = deserializeAws_restJson1ListPricingRulesCommand;
1890
+ const deserializeAws_restJson1ListPricingRulesCommandError = async (output, context) => {
1891
+ const parsedOutput = {
1892
+ ...output,
1893
+ body: await parseBody(output.body, context),
1894
+ };
1895
+ let response;
1896
+ let errorCode = "UnknownError";
1897
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1898
+ switch (errorCode) {
1899
+ case "AccessDeniedException":
1900
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1901
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1902
+ case "InternalServerException":
1903
+ case "com.amazonaws.billingconductor#InternalServerException":
1904
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1905
+ case "ThrottlingException":
1906
+ case "com.amazonaws.billingconductor#ThrottlingException":
1907
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1908
+ case "ValidationException":
1909
+ case "com.amazonaws.billingconductor#ValidationException":
1910
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1911
+ default:
1912
+ const parsedBody = parsedOutput.body;
1913
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1914
+ name: parsedBody.code || parsedBody.Code || errorCode,
1915
+ $fault: "client",
1916
+ $metadata: deserializeMetadata(output),
1917
+ });
1918
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1919
+ }
1920
+ };
1921
+ const deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand = async (output, context) => {
1922
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1923
+ return deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommandError(output, context);
1924
+ }
1925
+ const contents = {
1926
+ $metadata: deserializeMetadata(output),
1927
+ BillingPeriod: undefined,
1928
+ NextToken: undefined,
1929
+ PricingPlanArn: undefined,
1930
+ PricingRuleArns: undefined,
1931
+ };
1932
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1933
+ if (data.BillingPeriod !== undefined && data.BillingPeriod !== null) {
1934
+ contents.BillingPeriod = (0, smithy_client_1.expectString)(data.BillingPeriod);
1935
+ }
1936
+ if (data.NextToken !== undefined && data.NextToken !== null) {
1937
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
1938
+ }
1939
+ if (data.PricingPlanArn !== undefined && data.PricingPlanArn !== null) {
1940
+ contents.PricingPlanArn = (0, smithy_client_1.expectString)(data.PricingPlanArn);
1941
+ }
1942
+ if (data.PricingRuleArns !== undefined && data.PricingRuleArns !== null) {
1943
+ contents.PricingRuleArns = deserializeAws_restJson1PricingRuleArns(data.PricingRuleArns, context);
1944
+ }
1945
+ return Promise.resolve(contents);
1946
+ };
1947
+ exports.deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand = deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommand;
1948
+ const deserializeAws_restJson1ListPricingRulesAssociatedToPricingPlanCommandError = async (output, context) => {
1949
+ const parsedOutput = {
1950
+ ...output,
1951
+ body: await parseBody(output.body, context),
1952
+ };
1953
+ let response;
1954
+ let errorCode = "UnknownError";
1955
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1956
+ switch (errorCode) {
1957
+ case "AccessDeniedException":
1958
+ case "com.amazonaws.billingconductor#AccessDeniedException":
1959
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1960
+ case "InternalServerException":
1961
+ case "com.amazonaws.billingconductor#InternalServerException":
1962
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1963
+ case "ResourceNotFoundException":
1964
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
1965
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1966
+ case "ThrottlingException":
1967
+ case "com.amazonaws.billingconductor#ThrottlingException":
1968
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1969
+ case "ValidationException":
1970
+ case "com.amazonaws.billingconductor#ValidationException":
1971
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1972
+ default:
1973
+ const parsedBody = parsedOutput.body;
1974
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
1975
+ name: parsedBody.code || parsedBody.Code || errorCode,
1976
+ $fault: "client",
1977
+ $metadata: deserializeMetadata(output),
1978
+ });
1979
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1980
+ }
1981
+ };
1982
+ const deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand = async (output, context) => {
1983
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1984
+ return deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommandError(output, context);
1985
+ }
1986
+ const contents = {
1987
+ $metadata: deserializeMetadata(output),
1988
+ Arn: undefined,
1989
+ AssociatedResources: undefined,
1990
+ NextToken: undefined,
1991
+ };
1992
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1993
+ if (data.Arn !== undefined && data.Arn !== null) {
1994
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
1995
+ }
1996
+ if (data.AssociatedResources !== undefined && data.AssociatedResources !== null) {
1997
+ contents.AssociatedResources = deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemResponseList(data.AssociatedResources, context);
1998
+ }
1999
+ if (data.NextToken !== undefined && data.NextToken !== null) {
2000
+ contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
2001
+ }
2002
+ return Promise.resolve(contents);
2003
+ };
2004
+ exports.deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand = deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommand;
2005
+ const deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemCommandError = async (output, context) => {
2006
+ const parsedOutput = {
2007
+ ...output,
2008
+ body: await parseBody(output.body, context),
2009
+ };
2010
+ let response;
2011
+ let errorCode = "UnknownError";
2012
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2013
+ switch (errorCode) {
2014
+ case "AccessDeniedException":
2015
+ case "com.amazonaws.billingconductor#AccessDeniedException":
2016
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2017
+ case "InternalServerException":
2018
+ case "com.amazonaws.billingconductor#InternalServerException":
2019
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2020
+ case "ResourceNotFoundException":
2021
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
2022
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2023
+ case "ThrottlingException":
2024
+ case "com.amazonaws.billingconductor#ThrottlingException":
2025
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2026
+ case "ValidationException":
2027
+ case "com.amazonaws.billingconductor#ValidationException":
2028
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2029
+ default:
2030
+ const parsedBody = parsedOutput.body;
2031
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
2032
+ name: parsedBody.code || parsedBody.Code || errorCode,
2033
+ $fault: "client",
2034
+ $metadata: deserializeMetadata(output),
2035
+ });
2036
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2037
+ }
2038
+ };
2039
+ const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2040
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
2041
+ return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2042
+ }
2043
+ const contents = {
2044
+ $metadata: deserializeMetadata(output),
2045
+ Tags: undefined,
2046
+ };
2047
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2048
+ if (data.Tags !== undefined && data.Tags !== null) {
2049
+ contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
2050
+ }
2051
+ return Promise.resolve(contents);
2052
+ };
2053
+ exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2054
+ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
2055
+ const parsedOutput = {
2056
+ ...output,
2057
+ body: await parseBody(output.body, context),
2058
+ };
2059
+ let response;
2060
+ let errorCode = "UnknownError";
2061
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2062
+ switch (errorCode) {
2063
+ case "AccessDeniedException":
2064
+ case "com.amazonaws.billingconductor#AccessDeniedException":
2065
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2066
+ case "InternalServerException":
2067
+ case "com.amazonaws.billingconductor#InternalServerException":
2068
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2069
+ case "ResourceNotFoundException":
2070
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
2071
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2072
+ case "ThrottlingException":
2073
+ case "com.amazonaws.billingconductor#ThrottlingException":
2074
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2075
+ case "ValidationException":
2076
+ case "com.amazonaws.billingconductor#ValidationException":
2077
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2078
+ default:
2079
+ const parsedBody = parsedOutput.body;
2080
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
2081
+ name: parsedBody.code || parsedBody.Code || errorCode,
2082
+ $fault: "client",
2083
+ $metadata: deserializeMetadata(output),
2084
+ });
2085
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2086
+ }
2087
+ };
2088
+ const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2089
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
2090
+ return deserializeAws_restJson1TagResourceCommandError(output, context);
2091
+ }
2092
+ const contents = {
2093
+ $metadata: deserializeMetadata(output),
2094
+ };
2095
+ await collectBody(output.body, context);
2096
+ return Promise.resolve(contents);
2097
+ };
2098
+ exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2099
+ const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
2100
+ const parsedOutput = {
2101
+ ...output,
2102
+ body: await parseBody(output.body, context),
2103
+ };
2104
+ let response;
2105
+ let errorCode = "UnknownError";
2106
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2107
+ switch (errorCode) {
2108
+ case "AccessDeniedException":
2109
+ case "com.amazonaws.billingconductor#AccessDeniedException":
2110
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2111
+ case "InternalServerException":
2112
+ case "com.amazonaws.billingconductor#InternalServerException":
2113
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2114
+ case "ResourceNotFoundException":
2115
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
2116
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2117
+ case "ThrottlingException":
2118
+ case "com.amazonaws.billingconductor#ThrottlingException":
2119
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2120
+ case "ValidationException":
2121
+ case "com.amazonaws.billingconductor#ValidationException":
2122
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2123
+ default:
2124
+ const parsedBody = parsedOutput.body;
2125
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
2126
+ name: parsedBody.code || parsedBody.Code || errorCode,
2127
+ $fault: "client",
2128
+ $metadata: deserializeMetadata(output),
2129
+ });
2130
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2131
+ }
2132
+ };
2133
+ const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2134
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
2135
+ return deserializeAws_restJson1UntagResourceCommandError(output, context);
2136
+ }
2137
+ const contents = {
2138
+ $metadata: deserializeMetadata(output),
2139
+ };
2140
+ await collectBody(output.body, context);
2141
+ return Promise.resolve(contents);
2142
+ };
2143
+ exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2144
+ const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
2145
+ const parsedOutput = {
2146
+ ...output,
2147
+ body: await parseBody(output.body, context),
2148
+ };
2149
+ let response;
2150
+ let errorCode = "UnknownError";
2151
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2152
+ switch (errorCode) {
2153
+ case "AccessDeniedException":
2154
+ case "com.amazonaws.billingconductor#AccessDeniedException":
2155
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2156
+ case "InternalServerException":
2157
+ case "com.amazonaws.billingconductor#InternalServerException":
2158
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2159
+ case "ResourceNotFoundException":
2160
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
2161
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2162
+ case "ThrottlingException":
2163
+ case "com.amazonaws.billingconductor#ThrottlingException":
2164
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2165
+ case "ValidationException":
2166
+ case "com.amazonaws.billingconductor#ValidationException":
2167
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2168
+ default:
2169
+ const parsedBody = parsedOutput.body;
2170
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
2171
+ name: parsedBody.code || parsedBody.Code || errorCode,
2172
+ $fault: "client",
2173
+ $metadata: deserializeMetadata(output),
2174
+ });
2175
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2176
+ }
2177
+ };
2178
+ const deserializeAws_restJson1UpdateBillingGroupCommand = async (output, context) => {
2179
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2180
+ return deserializeAws_restJson1UpdateBillingGroupCommandError(output, context);
2181
+ }
2182
+ const contents = {
2183
+ $metadata: deserializeMetadata(output),
2184
+ Arn: undefined,
2185
+ Description: undefined,
2186
+ LastModifiedTime: undefined,
2187
+ Name: undefined,
2188
+ PricingPlanArn: undefined,
2189
+ PrimaryAccountId: undefined,
2190
+ Size: undefined,
2191
+ Status: undefined,
2192
+ StatusReason: undefined,
2193
+ };
2194
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2195
+ if (data.Arn !== undefined && data.Arn !== null) {
2196
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2197
+ }
2198
+ if (data.Description !== undefined && data.Description !== null) {
2199
+ contents.Description = (0, smithy_client_1.expectString)(data.Description);
2200
+ }
2201
+ if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2202
+ contents.LastModifiedTime = (0, smithy_client_1.expectLong)(data.LastModifiedTime);
2203
+ }
2204
+ if (data.Name !== undefined && data.Name !== null) {
2205
+ contents.Name = (0, smithy_client_1.expectString)(data.Name);
2206
+ }
2207
+ if (data.PricingPlanArn !== undefined && data.PricingPlanArn !== null) {
2208
+ contents.PricingPlanArn = (0, smithy_client_1.expectString)(data.PricingPlanArn);
2209
+ }
2210
+ if (data.PrimaryAccountId !== undefined && data.PrimaryAccountId !== null) {
2211
+ contents.PrimaryAccountId = (0, smithy_client_1.expectString)(data.PrimaryAccountId);
2212
+ }
2213
+ if (data.Size !== undefined && data.Size !== null) {
2214
+ contents.Size = (0, smithy_client_1.expectLong)(data.Size);
2215
+ }
2216
+ if (data.Status !== undefined && data.Status !== null) {
2217
+ contents.Status = (0, smithy_client_1.expectString)(data.Status);
2218
+ }
2219
+ if (data.StatusReason !== undefined && data.StatusReason !== null) {
2220
+ contents.StatusReason = (0, smithy_client_1.expectString)(data.StatusReason);
2221
+ }
2222
+ return Promise.resolve(contents);
2223
+ };
2224
+ exports.deserializeAws_restJson1UpdateBillingGroupCommand = deserializeAws_restJson1UpdateBillingGroupCommand;
2225
+ const deserializeAws_restJson1UpdateBillingGroupCommandError = async (output, context) => {
2226
+ const parsedOutput = {
2227
+ ...output,
2228
+ body: await parseBody(output.body, context),
2229
+ };
2230
+ let response;
2231
+ let errorCode = "UnknownError";
2232
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2233
+ switch (errorCode) {
2234
+ case "AccessDeniedException":
2235
+ case "com.amazonaws.billingconductor#AccessDeniedException":
2236
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2237
+ case "ConflictException":
2238
+ case "com.amazonaws.billingconductor#ConflictException":
2239
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2240
+ case "InternalServerException":
2241
+ case "com.amazonaws.billingconductor#InternalServerException":
2242
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2243
+ case "ResourceNotFoundException":
2244
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
2245
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2246
+ case "ThrottlingException":
2247
+ case "com.amazonaws.billingconductor#ThrottlingException":
2248
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2249
+ case "ValidationException":
2250
+ case "com.amazonaws.billingconductor#ValidationException":
2251
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2252
+ default:
2253
+ const parsedBody = parsedOutput.body;
2254
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
2255
+ name: parsedBody.code || parsedBody.Code || errorCode,
2256
+ $fault: "client",
2257
+ $metadata: deserializeMetadata(output),
2258
+ });
2259
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2260
+ }
2261
+ };
2262
+ const deserializeAws_restJson1UpdateCustomLineItemCommand = async (output, context) => {
2263
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2264
+ return deserializeAws_restJson1UpdateCustomLineItemCommandError(output, context);
2265
+ }
2266
+ const contents = {
2267
+ $metadata: deserializeMetadata(output),
2268
+ Arn: undefined,
2269
+ AssociationSize: undefined,
2270
+ BillingGroupArn: undefined,
2271
+ ChargeDetails: undefined,
2272
+ Description: undefined,
2273
+ LastModifiedTime: undefined,
2274
+ Name: undefined,
2275
+ };
2276
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2277
+ if (data.Arn !== undefined && data.Arn !== null) {
2278
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2279
+ }
2280
+ if (data.AssociationSize !== undefined && data.AssociationSize !== null) {
2281
+ contents.AssociationSize = (0, smithy_client_1.expectLong)(data.AssociationSize);
2282
+ }
2283
+ if (data.BillingGroupArn !== undefined && data.BillingGroupArn !== null) {
2284
+ contents.BillingGroupArn = (0, smithy_client_1.expectString)(data.BillingGroupArn);
2285
+ }
2286
+ if (data.ChargeDetails !== undefined && data.ChargeDetails !== null) {
2287
+ contents.ChargeDetails = deserializeAws_restJson1ListCustomLineItemChargeDetails(data.ChargeDetails, context);
2288
+ }
2289
+ if (data.Description !== undefined && data.Description !== null) {
2290
+ contents.Description = (0, smithy_client_1.expectString)(data.Description);
2291
+ }
2292
+ if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2293
+ contents.LastModifiedTime = (0, smithy_client_1.expectLong)(data.LastModifiedTime);
2294
+ }
2295
+ if (data.Name !== undefined && data.Name !== null) {
2296
+ contents.Name = (0, smithy_client_1.expectString)(data.Name);
2297
+ }
2298
+ return Promise.resolve(contents);
2299
+ };
2300
+ exports.deserializeAws_restJson1UpdateCustomLineItemCommand = deserializeAws_restJson1UpdateCustomLineItemCommand;
2301
+ const deserializeAws_restJson1UpdateCustomLineItemCommandError = async (output, context) => {
2302
+ const parsedOutput = {
2303
+ ...output,
2304
+ body: await parseBody(output.body, context),
2305
+ };
2306
+ let response;
2307
+ let errorCode = "UnknownError";
2308
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2309
+ switch (errorCode) {
2310
+ case "AccessDeniedException":
2311
+ case "com.amazonaws.billingconductor#AccessDeniedException":
2312
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2313
+ case "InternalServerException":
2314
+ case "com.amazonaws.billingconductor#InternalServerException":
2315
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2316
+ case "ResourceNotFoundException":
2317
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
2318
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2319
+ case "ThrottlingException":
2320
+ case "com.amazonaws.billingconductor#ThrottlingException":
2321
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2322
+ case "ValidationException":
2323
+ case "com.amazonaws.billingconductor#ValidationException":
2324
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2325
+ default:
2326
+ const parsedBody = parsedOutput.body;
2327
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
2328
+ name: parsedBody.code || parsedBody.Code || errorCode,
2329
+ $fault: "client",
2330
+ $metadata: deserializeMetadata(output),
2331
+ });
2332
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2333
+ }
2334
+ };
2335
+ const deserializeAws_restJson1UpdatePricingPlanCommand = async (output, context) => {
2336
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2337
+ return deserializeAws_restJson1UpdatePricingPlanCommandError(output, context);
2338
+ }
2339
+ const contents = {
2340
+ $metadata: deserializeMetadata(output),
2341
+ Arn: undefined,
2342
+ Description: undefined,
2343
+ LastModifiedTime: undefined,
2344
+ Name: undefined,
2345
+ Size: undefined,
2346
+ };
2347
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2348
+ if (data.Arn !== undefined && data.Arn !== null) {
2349
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2350
+ }
2351
+ if (data.Description !== undefined && data.Description !== null) {
2352
+ contents.Description = (0, smithy_client_1.expectString)(data.Description);
2353
+ }
2354
+ if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2355
+ contents.LastModifiedTime = (0, smithy_client_1.expectLong)(data.LastModifiedTime);
2356
+ }
2357
+ if (data.Name !== undefined && data.Name !== null) {
2358
+ contents.Name = (0, smithy_client_1.expectString)(data.Name);
2359
+ }
2360
+ if (data.Size !== undefined && data.Size !== null) {
2361
+ contents.Size = (0, smithy_client_1.expectLong)(data.Size);
2362
+ }
2363
+ return Promise.resolve(contents);
2364
+ };
2365
+ exports.deserializeAws_restJson1UpdatePricingPlanCommand = deserializeAws_restJson1UpdatePricingPlanCommand;
2366
+ const deserializeAws_restJson1UpdatePricingPlanCommandError = async (output, context) => {
2367
+ const parsedOutput = {
2368
+ ...output,
2369
+ body: await parseBody(output.body, context),
2370
+ };
2371
+ let response;
2372
+ let errorCode = "UnknownError";
2373
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2374
+ switch (errorCode) {
2375
+ case "AccessDeniedException":
2376
+ case "com.amazonaws.billingconductor#AccessDeniedException":
2377
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2378
+ case "ConflictException":
2379
+ case "com.amazonaws.billingconductor#ConflictException":
2380
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2381
+ case "InternalServerException":
2382
+ case "com.amazonaws.billingconductor#InternalServerException":
2383
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2384
+ case "ResourceNotFoundException":
2385
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
2386
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2387
+ case "ThrottlingException":
2388
+ case "com.amazonaws.billingconductor#ThrottlingException":
2389
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2390
+ case "ValidationException":
2391
+ case "com.amazonaws.billingconductor#ValidationException":
2392
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2393
+ default:
2394
+ const parsedBody = parsedOutput.body;
2395
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
2396
+ name: parsedBody.code || parsedBody.Code || errorCode,
2397
+ $fault: "client",
2398
+ $metadata: deserializeMetadata(output),
2399
+ });
2400
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2401
+ }
2402
+ };
2403
+ const deserializeAws_restJson1UpdatePricingRuleCommand = async (output, context) => {
2404
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
2405
+ return deserializeAws_restJson1UpdatePricingRuleCommandError(output, context);
2406
+ }
2407
+ const contents = {
2408
+ $metadata: deserializeMetadata(output),
2409
+ Arn: undefined,
2410
+ AssociatedPricingPlanCount: undefined,
2411
+ Description: undefined,
2412
+ LastModifiedTime: undefined,
2413
+ ModifierPercentage: undefined,
2414
+ Name: undefined,
2415
+ Scope: undefined,
2416
+ Service: undefined,
2417
+ Type: undefined,
2418
+ };
2419
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2420
+ if (data.Arn !== undefined && data.Arn !== null) {
2421
+ contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
2422
+ }
2423
+ if (data.AssociatedPricingPlanCount !== undefined && data.AssociatedPricingPlanCount !== null) {
2424
+ contents.AssociatedPricingPlanCount = (0, smithy_client_1.expectLong)(data.AssociatedPricingPlanCount);
2425
+ }
2426
+ if (data.Description !== undefined && data.Description !== null) {
2427
+ contents.Description = (0, smithy_client_1.expectString)(data.Description);
2428
+ }
2429
+ if (data.LastModifiedTime !== undefined && data.LastModifiedTime !== null) {
2430
+ contents.LastModifiedTime = (0, smithy_client_1.expectLong)(data.LastModifiedTime);
2431
+ }
2432
+ if (data.ModifierPercentage !== undefined && data.ModifierPercentage !== null) {
2433
+ contents.ModifierPercentage = (0, smithy_client_1.limitedParseDouble)(data.ModifierPercentage);
2434
+ }
2435
+ if (data.Name !== undefined && data.Name !== null) {
2436
+ contents.Name = (0, smithy_client_1.expectString)(data.Name);
2437
+ }
2438
+ if (data.Scope !== undefined && data.Scope !== null) {
2439
+ contents.Scope = (0, smithy_client_1.expectString)(data.Scope);
2440
+ }
2441
+ if (data.Service !== undefined && data.Service !== null) {
2442
+ contents.Service = (0, smithy_client_1.expectString)(data.Service);
2443
+ }
2444
+ if (data.Type !== undefined && data.Type !== null) {
2445
+ contents.Type = (0, smithy_client_1.expectString)(data.Type);
2446
+ }
2447
+ return Promise.resolve(contents);
2448
+ };
2449
+ exports.deserializeAws_restJson1UpdatePricingRuleCommand = deserializeAws_restJson1UpdatePricingRuleCommand;
2450
+ const deserializeAws_restJson1UpdatePricingRuleCommandError = async (output, context) => {
2451
+ const parsedOutput = {
2452
+ ...output,
2453
+ body: await parseBody(output.body, context),
2454
+ };
2455
+ let response;
2456
+ let errorCode = "UnknownError";
2457
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2458
+ switch (errorCode) {
2459
+ case "AccessDeniedException":
2460
+ case "com.amazonaws.billingconductor#AccessDeniedException":
2461
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2462
+ case "ConflictException":
2463
+ case "com.amazonaws.billingconductor#ConflictException":
2464
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2465
+ case "InternalServerException":
2466
+ case "com.amazonaws.billingconductor#InternalServerException":
2467
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2468
+ case "ResourceNotFoundException":
2469
+ case "com.amazonaws.billingconductor#ResourceNotFoundException":
2470
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2471
+ case "ThrottlingException":
2472
+ case "com.amazonaws.billingconductor#ThrottlingException":
2473
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2474
+ case "ValidationException":
2475
+ case "com.amazonaws.billingconductor#ValidationException":
2476
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2477
+ default:
2478
+ const parsedBody = parsedOutput.body;
2479
+ response = new BillingconductorServiceException_1.BillingconductorServiceException({
2480
+ name: parsedBody.code || parsedBody.Code || errorCode,
2481
+ $fault: "client",
2482
+ $metadata: deserializeMetadata(output),
2483
+ });
2484
+ throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2485
+ }
2486
+ };
2487
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2488
+ const contents = {};
2489
+ const data = parsedOutput.body;
2490
+ if (data.Message !== undefined && data.Message !== null) {
2491
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
2492
+ }
2493
+ const exception = new models_0_1.AccessDeniedException({
2494
+ $metadata: deserializeMetadata(parsedOutput),
2495
+ ...contents,
2496
+ });
2497
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2498
+ };
2499
+ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2500
+ const contents = {};
2501
+ const data = parsedOutput.body;
2502
+ if (data.Message !== undefined && data.Message !== null) {
2503
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
2504
+ }
2505
+ if (data.ResourceId !== undefined && data.ResourceId !== null) {
2506
+ contents.ResourceId = (0, smithy_client_1.expectString)(data.ResourceId);
2507
+ }
2508
+ if (data.ResourceType !== undefined && data.ResourceType !== null) {
2509
+ contents.ResourceType = (0, smithy_client_1.expectString)(data.ResourceType);
2510
+ }
2511
+ const exception = new models_0_1.ConflictException({
2512
+ $metadata: deserializeMetadata(parsedOutput),
2513
+ ...contents,
2514
+ });
2515
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2516
+ };
2517
+ 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
+ }
2522
+ const data = parsedOutput.body;
2523
+ if (data.Message !== undefined && data.Message !== null) {
2524
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
2525
+ }
2526
+ const exception = new models_0_1.InternalServerException({
2527
+ $metadata: deserializeMetadata(parsedOutput),
2528
+ ...contents,
2529
+ });
2530
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2531
+ };
2532
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2533
+ const contents = {};
2534
+ const data = parsedOutput.body;
2535
+ if (data.Message !== undefined && data.Message !== null) {
2536
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
2537
+ }
2538
+ if (data.ResourceId !== undefined && data.ResourceId !== null) {
2539
+ contents.ResourceId = (0, smithy_client_1.expectString)(data.ResourceId);
2540
+ }
2541
+ if (data.ResourceType !== undefined && data.ResourceType !== null) {
2542
+ contents.ResourceType = (0, smithy_client_1.expectString)(data.ResourceType);
2543
+ }
2544
+ const exception = new models_0_1.ResourceNotFoundException({
2545
+ $metadata: deserializeMetadata(parsedOutput),
2546
+ ...contents,
2547
+ });
2548
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2549
+ };
2550
+ const deserializeAws_restJson1ServiceLimitExceededExceptionResponse = async (parsedOutput, context) => {
2551
+ const contents = {};
2552
+ const data = parsedOutput.body;
2553
+ if (data.LimitCode !== undefined && data.LimitCode !== null) {
2554
+ contents.LimitCode = (0, smithy_client_1.expectString)(data.LimitCode);
2555
+ }
2556
+ if (data.Message !== undefined && data.Message !== null) {
2557
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
2558
+ }
2559
+ if (data.ResourceId !== undefined && data.ResourceId !== null) {
2560
+ contents.ResourceId = (0, smithy_client_1.expectString)(data.ResourceId);
2561
+ }
2562
+ if (data.ResourceType !== undefined && data.ResourceType !== null) {
2563
+ contents.ResourceType = (0, smithy_client_1.expectString)(data.ResourceType);
2564
+ }
2565
+ if (data.ServiceCode !== undefined && data.ServiceCode !== null) {
2566
+ contents.ServiceCode = (0, smithy_client_1.expectString)(data.ServiceCode);
2567
+ }
2568
+ const exception = new models_0_1.ServiceLimitExceededException({
2569
+ $metadata: deserializeMetadata(parsedOutput),
2570
+ ...contents,
2571
+ });
2572
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2573
+ };
2574
+ 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
+ }
2579
+ const data = parsedOutput.body;
2580
+ if (data.Message !== undefined && data.Message !== null) {
2581
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
2582
+ }
2583
+ const exception = new models_0_1.ThrottlingException({
2584
+ $metadata: deserializeMetadata(parsedOutput),
2585
+ ...contents,
2586
+ });
2587
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2588
+ };
2589
+ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2590
+ const contents = {};
2591
+ const data = parsedOutput.body;
2592
+ if (data.Fields !== undefined && data.Fields !== null) {
2593
+ contents.Fields = deserializeAws_restJson1ValidationExceptionFieldList(data.Fields, context);
2594
+ }
2595
+ if (data.Message !== undefined && data.Message !== null) {
2596
+ contents.Message = (0, smithy_client_1.expectString)(data.Message);
2597
+ }
2598
+ if (data.Reason !== undefined && data.Reason !== null) {
2599
+ contents.Reason = (0, smithy_client_1.expectString)(data.Reason);
2600
+ }
2601
+ const exception = new models_0_1.ValidationException({
2602
+ $metadata: deserializeMetadata(parsedOutput),
2603
+ ...contents,
2604
+ });
2605
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2606
+ };
2607
+ const serializeAws_restJson1AccountGrouping = (input, context) => {
2608
+ return {
2609
+ ...(input.LinkedAccountIds !== undefined &&
2610
+ input.LinkedAccountIds !== null && {
2611
+ LinkedAccountIds: serializeAws_restJson1AccountIdList(input.LinkedAccountIds, context),
2612
+ }),
2613
+ };
2614
+ };
2615
+ const serializeAws_restJson1AccountIdList = (input, context) => {
2616
+ return input
2617
+ .filter((e) => e != null)
2618
+ .map((entry) => {
2619
+ if (entry === null) {
2620
+ return null;
2621
+ }
2622
+ return entry;
2623
+ });
2624
+ };
2625
+ const serializeAws_restJson1BillingGroupArnList = (input, context) => {
2626
+ return input
2627
+ .filter((e) => e != null)
2628
+ .map((entry) => {
2629
+ if (entry === null) {
2630
+ return null;
2631
+ }
2632
+ return entry;
2633
+ });
2634
+ };
2635
+ const serializeAws_restJson1ComputationPreference = (input, context) => {
2636
+ return {
2637
+ ...(input.PricingPlanArn !== undefined &&
2638
+ input.PricingPlanArn !== null && { PricingPlanArn: input.PricingPlanArn }),
2639
+ };
2640
+ };
2641
+ const serializeAws_restJson1CustomLineItemArns = (input, context) => {
2642
+ return input
2643
+ .filter((e) => e != null)
2644
+ .map((entry) => {
2645
+ if (entry === null) {
2646
+ return null;
2647
+ }
2648
+ return entry;
2649
+ });
2650
+ };
2651
+ const serializeAws_restJson1CustomLineItemAssociationsList = (input, context) => {
2652
+ return input
2653
+ .filter((e) => e != null)
2654
+ .map((entry) => {
2655
+ if (entry === null) {
2656
+ return null;
2657
+ }
2658
+ return entry;
2659
+ });
2660
+ };
2661
+ const serializeAws_restJson1CustomLineItemBatchAssociationsList = (input, context) => {
2662
+ return input
2663
+ .filter((e) => e != null)
2664
+ .map((entry) => {
2665
+ if (entry === null) {
2666
+ return null;
2667
+ }
2668
+ return entry;
2669
+ });
2670
+ };
2671
+ const serializeAws_restJson1CustomLineItemBatchDisassociationsList = (input, context) => {
2672
+ return input
2673
+ .filter((e) => e != null)
2674
+ .map((entry) => {
2675
+ if (entry === null) {
2676
+ return null;
2677
+ }
2678
+ return entry;
2679
+ });
2680
+ };
2681
+ const serializeAws_restJson1CustomLineItemBillingPeriodRange = (input, context) => {
2682
+ return {
2683
+ ...(input.ExclusiveEndBillingPeriod !== undefined &&
2684
+ input.ExclusiveEndBillingPeriod !== null && { ExclusiveEndBillingPeriod: input.ExclusiveEndBillingPeriod }),
2685
+ ...(input.InclusiveStartBillingPeriod !== undefined &&
2686
+ input.InclusiveStartBillingPeriod !== null && { InclusiveStartBillingPeriod: input.InclusiveStartBillingPeriod }),
2687
+ };
2688
+ };
2689
+ const serializeAws_restJson1CustomLineItemChargeDetails = (input, context) => {
2690
+ return {
2691
+ ...(input.Flat !== undefined &&
2692
+ input.Flat !== null && { Flat: serializeAws_restJson1CustomLineItemFlatChargeDetails(input.Flat, context) }),
2693
+ ...(input.Percentage !== undefined &&
2694
+ input.Percentage !== null && {
2695
+ Percentage: serializeAws_restJson1CustomLineItemPercentageChargeDetails(input.Percentage, context),
2696
+ }),
2697
+ ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }),
2698
+ };
2699
+ };
2700
+ const serializeAws_restJson1CustomLineItemFlatChargeDetails = (input, context) => {
2701
+ return {
2702
+ ...(input.ChargeValue !== undefined &&
2703
+ input.ChargeValue !== null && { ChargeValue: (0, smithy_client_1.serializeFloat)(input.ChargeValue) }),
2704
+ };
2705
+ };
2706
+ const serializeAws_restJson1CustomLineItemNameList = (input, context) => {
2707
+ return input
2708
+ .filter((e) => e != null)
2709
+ .map((entry) => {
2710
+ if (entry === null) {
2711
+ return null;
2712
+ }
2713
+ return entry;
2714
+ });
2715
+ };
2716
+ const serializeAws_restJson1CustomLineItemPercentageChargeDetails = (input, context) => {
2717
+ return {
2718
+ ...(input.AssociatedValues !== undefined &&
2719
+ input.AssociatedValues !== null && {
2720
+ AssociatedValues: serializeAws_restJson1CustomLineItemAssociationsList(input.AssociatedValues, context),
2721
+ }),
2722
+ ...(input.PercentageValue !== undefined &&
2723
+ input.PercentageValue !== null && { PercentageValue: (0, smithy_client_1.serializeFloat)(input.PercentageValue) }),
2724
+ };
2725
+ };
2726
+ const serializeAws_restJson1ListAccountAssociationsFilter = (input, context) => {
2727
+ return {
2728
+ ...(input.AccountId !== undefined && input.AccountId !== null && { AccountId: input.AccountId }),
2729
+ ...(input.Association !== undefined && input.Association !== null && { Association: input.Association }),
2730
+ };
2731
+ };
2732
+ const serializeAws_restJson1ListBillingGroupCostReportsFilter = (input, context) => {
2733
+ return {
2734
+ ...(input.BillingGroupArns !== undefined &&
2735
+ input.BillingGroupArns !== null && {
2736
+ BillingGroupArns: serializeAws_restJson1BillingGroupArnList(input.BillingGroupArns, context),
2737
+ }),
2738
+ };
2739
+ };
2740
+ const serializeAws_restJson1ListBillingGroupsFilter = (input, context) => {
2741
+ return {
2742
+ ...(input.Arns !== undefined &&
2743
+ input.Arns !== null && { Arns: serializeAws_restJson1BillingGroupArnList(input.Arns, context) }),
2744
+ ...(input.PricingPlan !== undefined && input.PricingPlan !== null && { PricingPlan: input.PricingPlan }),
2745
+ };
2746
+ };
2747
+ const serializeAws_restJson1ListCustomLineItemsFilter = (input, context) => {
2748
+ return {
2749
+ ...(input.Arns !== undefined &&
2750
+ input.Arns !== null && { Arns: serializeAws_restJson1CustomLineItemArns(input.Arns, context) }),
2751
+ ...(input.BillingGroups !== undefined &&
2752
+ input.BillingGroups !== null && {
2753
+ BillingGroups: serializeAws_restJson1BillingGroupArnList(input.BillingGroups, context),
2754
+ }),
2755
+ ...(input.Names !== undefined &&
2756
+ input.Names !== null && { Names: serializeAws_restJson1CustomLineItemNameList(input.Names, context) }),
2757
+ };
2758
+ };
2759
+ const serializeAws_restJson1ListPricingPlansFilter = (input, context) => {
2760
+ return {
2761
+ ...(input.Arns !== undefined &&
2762
+ input.Arns !== null && { Arns: serializeAws_restJson1PricingPlanArns(input.Arns, context) }),
2763
+ };
2764
+ };
2765
+ const serializeAws_restJson1ListPricingRulesFilter = (input, context) => {
2766
+ return {
2767
+ ...(input.Arns !== undefined &&
2768
+ input.Arns !== null && { Arns: serializeAws_restJson1PricingRuleArns(input.Arns, context) }),
2769
+ };
2770
+ };
2771
+ const serializeAws_restJson1ListResourcesAssociatedToCustomLineItemFilter = (input, context) => {
2772
+ return {
2773
+ ...(input.Relationship !== undefined && input.Relationship !== null && { Relationship: input.Relationship }),
2774
+ };
2775
+ };
2776
+ const serializeAws_restJson1PricingPlanArns = (input, context) => {
2777
+ return input
2778
+ .filter((e) => e != null)
2779
+ .map((entry) => {
2780
+ if (entry === null) {
2781
+ return null;
2782
+ }
2783
+ return entry;
2784
+ });
2785
+ };
2786
+ const serializeAws_restJson1PricingRuleArns = (input, context) => {
2787
+ return input
2788
+ .filter((e) => e != null)
2789
+ .map((entry) => {
2790
+ if (entry === null) {
2791
+ return null;
2792
+ }
2793
+ return entry;
2794
+ });
2795
+ };
2796
+ const serializeAws_restJson1PricingRuleArnsInput = (input, context) => {
2797
+ return input
2798
+ .filter((e) => e != null)
2799
+ .map((entry) => {
2800
+ if (entry === null) {
2801
+ return null;
2802
+ }
2803
+ return entry;
2804
+ });
2805
+ };
2806
+ const serializeAws_restJson1PricingRuleArnsNonEmptyInput = (input, context) => {
2807
+ return input
2808
+ .filter((e) => e != null)
2809
+ .map((entry) => {
2810
+ if (entry === null) {
2811
+ return null;
2812
+ }
2813
+ return entry;
2814
+ });
2815
+ };
2816
+ const serializeAws_restJson1TagMap = (input, context) => {
2817
+ return Object.entries(input).reduce((acc, [key, value]) => {
2818
+ if (value === null) {
2819
+ return acc;
2820
+ }
2821
+ return {
2822
+ ...acc,
2823
+ [key]: value,
2824
+ };
2825
+ }, {});
2826
+ };
2827
+ const serializeAws_restJson1UpdateCustomLineItemChargeDetails = (input, context) => {
2828
+ return {
2829
+ ...(input.Flat !== undefined &&
2830
+ input.Flat !== null && {
2831
+ Flat: serializeAws_restJson1UpdateCustomLineItemFlatChargeDetails(input.Flat, context),
2832
+ }),
2833
+ ...(input.Percentage !== undefined &&
2834
+ input.Percentage !== null && {
2835
+ Percentage: serializeAws_restJson1UpdateCustomLineItemPercentageChargeDetails(input.Percentage, context),
2836
+ }),
2837
+ };
2838
+ };
2839
+ const serializeAws_restJson1UpdateCustomLineItemFlatChargeDetails = (input, context) => {
2840
+ return {
2841
+ ...(input.ChargeValue !== undefined &&
2842
+ input.ChargeValue !== null && { ChargeValue: (0, smithy_client_1.serializeFloat)(input.ChargeValue) }),
2843
+ };
2844
+ };
2845
+ const serializeAws_restJson1UpdateCustomLineItemPercentageChargeDetails = (input, context) => {
2846
+ return {
2847
+ ...(input.PercentageValue !== undefined &&
2848
+ input.PercentageValue !== null && { PercentageValue: (0, smithy_client_1.serializeFloat)(input.PercentageValue) }),
2849
+ };
2850
+ };
2851
+ const deserializeAws_restJson1AccountAssociationsList = (output, context) => {
2852
+ const retVal = (output || [])
2853
+ .filter((e) => e != null)
2854
+ .map((entry) => {
2855
+ if (entry === null) {
2856
+ return null;
2857
+ }
2858
+ return deserializeAws_restJson1AccountAssociationsListElement(entry, context);
2859
+ });
2860
+ return retVal;
2861
+ };
2862
+ const deserializeAws_restJson1AccountAssociationsListElement = (output, context) => {
2863
+ return {
2864
+ AccountEmail: (0, smithy_client_1.expectString)(output.AccountEmail),
2865
+ AccountId: (0, smithy_client_1.expectString)(output.AccountId),
2866
+ AccountName: (0, smithy_client_1.expectString)(output.AccountName),
2867
+ BillingGroupArn: (0, smithy_client_1.expectString)(output.BillingGroupArn),
2868
+ };
2869
+ };
2870
+ const deserializeAws_restJson1AssociateResourceError = (output, context) => {
2871
+ return {
2872
+ Message: (0, smithy_client_1.expectString)(output.Message),
2873
+ Reason: (0, smithy_client_1.expectString)(output.Reason),
2874
+ };
2875
+ };
2876
+ const deserializeAws_restJson1AssociateResourceResponseElement = (output, context) => {
2877
+ return {
2878
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
2879
+ Error: output.Error !== undefined && output.Error !== null
2880
+ ? deserializeAws_restJson1AssociateResourceError(output.Error, context)
2881
+ : undefined,
2882
+ };
2883
+ };
2884
+ const deserializeAws_restJson1AssociateResourcesResponseList = (output, context) => {
2885
+ const retVal = (output || [])
2886
+ .filter((e) => e != null)
2887
+ .map((entry) => {
2888
+ if (entry === null) {
2889
+ return null;
2890
+ }
2891
+ return deserializeAws_restJson1AssociateResourceResponseElement(entry, context);
2892
+ });
2893
+ return retVal;
2894
+ };
2895
+ const deserializeAws_restJson1BillingGroupCostReportElement = (output, context) => {
2896
+ return {
2897
+ AWSCost: (0, smithy_client_1.expectString)(output.AWSCost),
2898
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
2899
+ Currency: (0, smithy_client_1.expectString)(output.Currency),
2900
+ Margin: (0, smithy_client_1.expectString)(output.Margin),
2901
+ MarginPercentage: (0, smithy_client_1.expectString)(output.MarginPercentage),
2902
+ ProformaCost: (0, smithy_client_1.expectString)(output.ProformaCost),
2903
+ };
2904
+ };
2905
+ const deserializeAws_restJson1BillingGroupCostReportList = (output, context) => {
2906
+ const retVal = (output || [])
2907
+ .filter((e) => e != null)
2908
+ .map((entry) => {
2909
+ if (entry === null) {
2910
+ return null;
2911
+ }
2912
+ return deserializeAws_restJson1BillingGroupCostReportElement(entry, context);
2913
+ });
2914
+ return retVal;
2915
+ };
2916
+ const deserializeAws_restJson1BillingGroupList = (output, context) => {
2917
+ const retVal = (output || [])
2918
+ .filter((e) => e != null)
2919
+ .map((entry) => {
2920
+ if (entry === null) {
2921
+ return null;
2922
+ }
2923
+ return deserializeAws_restJson1BillingGroupListElement(entry, context);
2924
+ });
2925
+ return retVal;
2926
+ };
2927
+ const deserializeAws_restJson1BillingGroupListElement = (output, context) => {
2928
+ return {
2929
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
2930
+ ComputationPreference: output.ComputationPreference !== undefined && output.ComputationPreference !== null
2931
+ ? deserializeAws_restJson1ComputationPreference(output.ComputationPreference, context)
2932
+ : undefined,
2933
+ CreationTime: (0, smithy_client_1.expectLong)(output.CreationTime),
2934
+ Description: (0, smithy_client_1.expectString)(output.Description),
2935
+ LastModifiedTime: (0, smithy_client_1.expectLong)(output.LastModifiedTime),
2936
+ Name: (0, smithy_client_1.expectString)(output.Name),
2937
+ PrimaryAccountId: (0, smithy_client_1.expectString)(output.PrimaryAccountId),
2938
+ Size: (0, smithy_client_1.expectLong)(output.Size),
2939
+ Status: (0, smithy_client_1.expectString)(output.Status),
2940
+ StatusReason: (0, smithy_client_1.expectString)(output.StatusReason),
2941
+ };
2942
+ };
2943
+ const deserializeAws_restJson1ComputationPreference = (output, context) => {
2944
+ return {
2945
+ PricingPlanArn: (0, smithy_client_1.expectString)(output.PricingPlanArn),
2946
+ };
2947
+ };
2948
+ const deserializeAws_restJson1CustomLineItemList = (output, context) => {
2949
+ const retVal = (output || [])
2950
+ .filter((e) => e != null)
2951
+ .map((entry) => {
2952
+ if (entry === null) {
2953
+ return null;
2954
+ }
2955
+ return deserializeAws_restJson1CustomLineItemListElement(entry, context);
2956
+ });
2957
+ return retVal;
2958
+ };
2959
+ const deserializeAws_restJson1CustomLineItemListElement = (output, context) => {
2960
+ return {
2961
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
2962
+ AssociationSize: (0, smithy_client_1.expectLong)(output.AssociationSize),
2963
+ BillingGroupArn: (0, smithy_client_1.expectString)(output.BillingGroupArn),
2964
+ ChargeDetails: output.ChargeDetails !== undefined && output.ChargeDetails !== null
2965
+ ? deserializeAws_restJson1ListCustomLineItemChargeDetails(output.ChargeDetails, context)
2966
+ : undefined,
2967
+ CreationTime: (0, smithy_client_1.expectLong)(output.CreationTime),
2968
+ CurrencyCode: (0, smithy_client_1.expectString)(output.CurrencyCode),
2969
+ Description: (0, smithy_client_1.expectString)(output.Description),
2970
+ LastModifiedTime: (0, smithy_client_1.expectLong)(output.LastModifiedTime),
2971
+ Name: (0, smithy_client_1.expectString)(output.Name),
2972
+ ProductCode: (0, smithy_client_1.expectString)(output.ProductCode),
2973
+ };
2974
+ };
2975
+ const deserializeAws_restJson1DisassociateResourceResponseElement = (output, context) => {
2976
+ return {
2977
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
2978
+ Error: output.Error !== undefined && output.Error !== null
2979
+ ? deserializeAws_restJson1AssociateResourceError(output.Error, context)
2980
+ : undefined,
2981
+ };
2982
+ };
2983
+ const deserializeAws_restJson1DisassociateResourcesResponseList = (output, context) => {
2984
+ const retVal = (output || [])
2985
+ .filter((e) => e != null)
2986
+ .map((entry) => {
2987
+ if (entry === null) {
2988
+ return null;
2989
+ }
2990
+ return deserializeAws_restJson1DisassociateResourceResponseElement(entry, context);
2991
+ });
2992
+ return retVal;
2993
+ };
2994
+ const deserializeAws_restJson1ListCustomLineItemChargeDetails = (output, context) => {
2995
+ return {
2996
+ Flat: output.Flat !== undefined && output.Flat !== null
2997
+ ? deserializeAws_restJson1ListCustomLineItemFlatChargeDetails(output.Flat, context)
2998
+ : undefined,
2999
+ Percentage: output.Percentage !== undefined && output.Percentage !== null
3000
+ ? deserializeAws_restJson1ListCustomLineItemPercentageChargeDetails(output.Percentage, context)
3001
+ : undefined,
3002
+ Type: (0, smithy_client_1.expectString)(output.Type),
3003
+ };
3004
+ };
3005
+ const deserializeAws_restJson1ListCustomLineItemFlatChargeDetails = (output, context) => {
3006
+ return {
3007
+ ChargeValue: (0, smithy_client_1.limitedParseDouble)(output.ChargeValue),
3008
+ };
3009
+ };
3010
+ const deserializeAws_restJson1ListCustomLineItemPercentageChargeDetails = (output, context) => {
3011
+ return {
3012
+ PercentageValue: (0, smithy_client_1.limitedParseDouble)(output.PercentageValue),
3013
+ };
3014
+ };
3015
+ const deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemResponseElement = (output, context) => {
3016
+ return {
3017
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
3018
+ Relationship: (0, smithy_client_1.expectString)(output.Relationship),
3019
+ };
3020
+ };
3021
+ const deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemResponseList = (output, context) => {
3022
+ const retVal = (output || [])
3023
+ .filter((e) => e != null)
3024
+ .map((entry) => {
3025
+ if (entry === null) {
3026
+ return null;
3027
+ }
3028
+ return deserializeAws_restJson1ListResourcesAssociatedToCustomLineItemResponseElement(entry, context);
3029
+ });
3030
+ return retVal;
3031
+ };
3032
+ const deserializeAws_restJson1PricingPlanArns = (output, context) => {
3033
+ const retVal = (output || [])
3034
+ .filter((e) => e != null)
3035
+ .map((entry) => {
3036
+ if (entry === null) {
3037
+ return null;
3038
+ }
3039
+ return (0, smithy_client_1.expectString)(entry);
3040
+ });
3041
+ return retVal;
3042
+ };
3043
+ const deserializeAws_restJson1PricingPlanList = (output, context) => {
3044
+ const retVal = (output || [])
3045
+ .filter((e) => e != null)
3046
+ .map((entry) => {
3047
+ if (entry === null) {
3048
+ return null;
3049
+ }
3050
+ return deserializeAws_restJson1PricingPlanListElement(entry, context);
3051
+ });
3052
+ return retVal;
3053
+ };
3054
+ const deserializeAws_restJson1PricingPlanListElement = (output, context) => {
3055
+ return {
3056
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
3057
+ CreationTime: (0, smithy_client_1.expectLong)(output.CreationTime),
3058
+ Description: (0, smithy_client_1.expectString)(output.Description),
3059
+ LastModifiedTime: (0, smithy_client_1.expectLong)(output.LastModifiedTime),
3060
+ Name: (0, smithy_client_1.expectString)(output.Name),
3061
+ Size: (0, smithy_client_1.expectLong)(output.Size),
3062
+ };
3063
+ };
3064
+ const deserializeAws_restJson1PricingRuleArns = (output, context) => {
3065
+ const retVal = (output || [])
3066
+ .filter((e) => e != null)
3067
+ .map((entry) => {
3068
+ if (entry === null) {
3069
+ return null;
3070
+ }
3071
+ return (0, smithy_client_1.expectString)(entry);
3072
+ });
3073
+ return retVal;
3074
+ };
3075
+ const deserializeAws_restJson1PricingRuleList = (output, context) => {
3076
+ const retVal = (output || [])
3077
+ .filter((e) => e != null)
3078
+ .map((entry) => {
3079
+ if (entry === null) {
3080
+ return null;
3081
+ }
3082
+ return deserializeAws_restJson1PricingRuleListElement(entry, context);
3083
+ });
3084
+ return retVal;
3085
+ };
3086
+ const deserializeAws_restJson1PricingRuleListElement = (output, context) => {
3087
+ return {
3088
+ Arn: (0, smithy_client_1.expectString)(output.Arn),
3089
+ AssociatedPricingPlanCount: (0, smithy_client_1.expectLong)(output.AssociatedPricingPlanCount),
3090
+ CreationTime: (0, smithy_client_1.expectLong)(output.CreationTime),
3091
+ Description: (0, smithy_client_1.expectString)(output.Description),
3092
+ LastModifiedTime: (0, smithy_client_1.expectLong)(output.LastModifiedTime),
3093
+ ModifierPercentage: (0, smithy_client_1.limitedParseDouble)(output.ModifierPercentage),
3094
+ Name: (0, smithy_client_1.expectString)(output.Name),
3095
+ Scope: (0, smithy_client_1.expectString)(output.Scope),
3096
+ Service: (0, smithy_client_1.expectString)(output.Service),
3097
+ Type: (0, smithy_client_1.expectString)(output.Type),
3098
+ };
3099
+ };
3100
+ const deserializeAws_restJson1TagMap = (output, context) => {
3101
+ return Object.entries(output).reduce((acc, [key, value]) => {
3102
+ if (value === null) {
3103
+ return acc;
3104
+ }
3105
+ return {
3106
+ ...acc,
3107
+ [key]: (0, smithy_client_1.expectString)(value),
3108
+ };
3109
+ }, {});
3110
+ };
3111
+ const deserializeAws_restJson1ValidationExceptionField = (output, context) => {
3112
+ return {
3113
+ Message: (0, smithy_client_1.expectString)(output.Message),
3114
+ Name: (0, smithy_client_1.expectString)(output.Name),
3115
+ };
3116
+ };
3117
+ const deserializeAws_restJson1ValidationExceptionFieldList = (output, context) => {
3118
+ const retVal = (output || [])
3119
+ .filter((e) => e != null)
3120
+ .map((entry) => {
3121
+ if (entry === null) {
3122
+ return null;
3123
+ }
3124
+ return deserializeAws_restJson1ValidationExceptionField(entry, context);
3125
+ });
3126
+ return retVal;
3127
+ };
3128
+ const deserializeMetadata = (output) => {
3129
+ var _a;
3130
+ return ({
3131
+ httpStatusCode: output.statusCode,
3132
+ requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
3133
+ extendedRequestId: output.headers["x-amz-id-2"],
3134
+ cfId: output.headers["x-amz-cf-id"],
3135
+ });
3136
+ };
3137
+ const collectBody = (streamBody = new Uint8Array(), context) => {
3138
+ if (streamBody instanceof Uint8Array) {
3139
+ return Promise.resolve(streamBody);
3140
+ }
3141
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
3142
+ };
3143
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
3144
+ const isSerializableHeaderValue = (value) => value !== undefined &&
3145
+ value !== null &&
3146
+ value !== "" &&
3147
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
3148
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
3149
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
3150
+ if (encoded.length) {
3151
+ return JSON.parse(encoded);
3152
+ }
3153
+ return {};
3154
+ });
3155
+ const loadRestJsonErrorCode = (output, data) => {
3156
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
3157
+ const sanitizeErrorCode = (rawValue) => {
3158
+ let cleanValue = rawValue;
3159
+ if (cleanValue.indexOf(":") >= 0) {
3160
+ cleanValue = cleanValue.split(":")[0];
3161
+ }
3162
+ if (cleanValue.indexOf("#") >= 0) {
3163
+ cleanValue = cleanValue.split("#")[1];
3164
+ }
3165
+ return cleanValue;
3166
+ };
3167
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
3168
+ if (headerKey !== undefined) {
3169
+ return sanitizeErrorCode(output.headers[headerKey]);
3170
+ }
3171
+ if (data.code !== undefined) {
3172
+ return sanitizeErrorCode(data.code);
3173
+ }
3174
+ if (data["__type"] !== undefined) {
3175
+ return sanitizeErrorCode(data["__type"]);
3176
+ }
3177
+ return "";
3178
+ };