@aws-sdk/client-appsync 3.131.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/AppSync.js +15 -0
  4. package/dist-cjs/commands/AssociateApiCommand.js +2 -2
  5. package/dist-cjs/commands/CreateApiCacheCommand.js +2 -2
  6. package/dist-cjs/commands/CreateApiKeyCommand.js +2 -2
  7. package/dist-cjs/commands/CreateDataSourceCommand.js +2 -2
  8. package/dist-cjs/commands/CreateDomainNameCommand.js +2 -2
  9. package/dist-cjs/commands/CreateFunctionCommand.js +2 -2
  10. package/dist-cjs/commands/CreateGraphqlApiCommand.js +2 -2
  11. package/dist-cjs/commands/CreateResolverCommand.js +2 -2
  12. package/dist-cjs/commands/CreateTypeCommand.js +2 -2
  13. package/dist-cjs/commands/DeleteApiCacheCommand.js +2 -2
  14. package/dist-cjs/commands/DeleteApiKeyCommand.js +2 -2
  15. package/dist-cjs/commands/DeleteDataSourceCommand.js +2 -2
  16. package/dist-cjs/commands/DeleteDomainNameCommand.js +2 -2
  17. package/dist-cjs/commands/DeleteFunctionCommand.js +2 -2
  18. package/dist-cjs/commands/DeleteGraphqlApiCommand.js +2 -2
  19. package/dist-cjs/commands/DeleteResolverCommand.js +2 -2
  20. package/dist-cjs/commands/DeleteTypeCommand.js +2 -2
  21. package/dist-cjs/commands/DisassociateApiCommand.js +2 -2
  22. package/dist-cjs/commands/EvaluateMappingTemplateCommand.js +36 -0
  23. package/dist-cjs/commands/FlushApiCacheCommand.js +2 -2
  24. package/dist-cjs/commands/GetApiAssociationCommand.js +2 -2
  25. package/dist-cjs/commands/GetApiCacheCommand.js +2 -2
  26. package/dist-cjs/commands/GetDataSourceCommand.js +2 -2
  27. package/dist-cjs/commands/GetDomainNameCommand.js +2 -2
  28. package/dist-cjs/commands/GetFunctionCommand.js +2 -2
  29. package/dist-cjs/commands/GetGraphqlApiCommand.js +2 -2
  30. package/dist-cjs/commands/GetIntrospectionSchemaCommand.js +2 -2
  31. package/dist-cjs/commands/GetResolverCommand.js +2 -2
  32. package/dist-cjs/commands/GetSchemaCreationStatusCommand.js +2 -2
  33. package/dist-cjs/commands/GetTypeCommand.js +2 -2
  34. package/dist-cjs/commands/ListApiKeysCommand.js +2 -2
  35. package/dist-cjs/commands/ListDataSourcesCommand.js +2 -2
  36. package/dist-cjs/commands/ListDomainNamesCommand.js +2 -2
  37. package/dist-cjs/commands/ListFunctionsCommand.js +2 -2
  38. package/dist-cjs/commands/ListGraphqlApisCommand.js +2 -2
  39. package/dist-cjs/commands/ListResolversByFunctionCommand.js +2 -2
  40. package/dist-cjs/commands/ListResolversCommand.js +2 -2
  41. package/dist-cjs/commands/ListTagsForResourceCommand.js +2 -2
  42. package/dist-cjs/commands/ListTypesCommand.js +2 -2
  43. package/dist-cjs/commands/StartSchemaCreationCommand.js +2 -2
  44. package/dist-cjs/commands/TagResourceCommand.js +2 -2
  45. package/dist-cjs/commands/UntagResourceCommand.js +2 -2
  46. package/dist-cjs/commands/UpdateApiCacheCommand.js +2 -2
  47. package/dist-cjs/commands/UpdateApiKeyCommand.js +2 -2
  48. package/dist-cjs/commands/UpdateDataSourceCommand.js +2 -2
  49. package/dist-cjs/commands/UpdateDomainNameCommand.js +2 -2
  50. package/dist-cjs/commands/UpdateFunctionCommand.js +2 -2
  51. package/dist-cjs/commands/UpdateGraphqlApiCommand.js +2 -2
  52. package/dist-cjs/commands/UpdateResolverCommand.js +2 -2
  53. package/dist-cjs/commands/UpdateTypeCommand.js +2 -2
  54. package/dist-cjs/commands/index.js +1 -0
  55. package/dist-cjs/models/models_0.js +524 -766
  56. package/dist-cjs/protocols/Aws_restJson1.js +640 -1356
  57. package/dist-es/AppSync.js +15 -0
  58. package/dist-es/commands/AssociateApiCommand.js +3 -3
  59. package/dist-es/commands/CreateApiCacheCommand.js +3 -3
  60. package/dist-es/commands/CreateApiKeyCommand.js +3 -3
  61. package/dist-es/commands/CreateDataSourceCommand.js +3 -3
  62. package/dist-es/commands/CreateDomainNameCommand.js +3 -3
  63. package/dist-es/commands/CreateFunctionCommand.js +3 -3
  64. package/dist-es/commands/CreateGraphqlApiCommand.js +3 -3
  65. package/dist-es/commands/CreateResolverCommand.js +3 -3
  66. package/dist-es/commands/CreateTypeCommand.js +3 -3
  67. package/dist-es/commands/DeleteApiCacheCommand.js +3 -3
  68. package/dist-es/commands/DeleteApiKeyCommand.js +3 -3
  69. package/dist-es/commands/DeleteDataSourceCommand.js +3 -3
  70. package/dist-es/commands/DeleteDomainNameCommand.js +3 -3
  71. package/dist-es/commands/DeleteFunctionCommand.js +3 -3
  72. package/dist-es/commands/DeleteGraphqlApiCommand.js +3 -3
  73. package/dist-es/commands/DeleteResolverCommand.js +3 -3
  74. package/dist-es/commands/DeleteTypeCommand.js +3 -3
  75. package/dist-es/commands/DisassociateApiCommand.js +3 -3
  76. package/dist-es/commands/EvaluateMappingTemplateCommand.js +39 -0
  77. package/dist-es/commands/FlushApiCacheCommand.js +3 -3
  78. package/dist-es/commands/GetApiAssociationCommand.js +3 -3
  79. package/dist-es/commands/GetApiCacheCommand.js +3 -3
  80. package/dist-es/commands/GetDataSourceCommand.js +3 -3
  81. package/dist-es/commands/GetDomainNameCommand.js +3 -3
  82. package/dist-es/commands/GetFunctionCommand.js +3 -3
  83. package/dist-es/commands/GetGraphqlApiCommand.js +3 -3
  84. package/dist-es/commands/GetIntrospectionSchemaCommand.js +3 -3
  85. package/dist-es/commands/GetResolverCommand.js +3 -3
  86. package/dist-es/commands/GetSchemaCreationStatusCommand.js +3 -3
  87. package/dist-es/commands/GetTypeCommand.js +3 -3
  88. package/dist-es/commands/ListApiKeysCommand.js +3 -3
  89. package/dist-es/commands/ListDataSourcesCommand.js +3 -3
  90. package/dist-es/commands/ListDomainNamesCommand.js +3 -3
  91. package/dist-es/commands/ListFunctionsCommand.js +3 -3
  92. package/dist-es/commands/ListGraphqlApisCommand.js +3 -3
  93. package/dist-es/commands/ListResolversByFunctionCommand.js +3 -3
  94. package/dist-es/commands/ListResolversCommand.js +3 -3
  95. package/dist-es/commands/ListTagsForResourceCommand.js +3 -3
  96. package/dist-es/commands/ListTypesCommand.js +3 -3
  97. package/dist-es/commands/StartSchemaCreationCommand.js +3 -3
  98. package/dist-es/commands/TagResourceCommand.js +3 -3
  99. package/dist-es/commands/UntagResourceCommand.js +3 -3
  100. package/dist-es/commands/UpdateApiCacheCommand.js +3 -3
  101. package/dist-es/commands/UpdateApiKeyCommand.js +3 -3
  102. package/dist-es/commands/UpdateDataSourceCommand.js +3 -3
  103. package/dist-es/commands/UpdateDomainNameCommand.js +3 -3
  104. package/dist-es/commands/UpdateFunctionCommand.js +3 -3
  105. package/dist-es/commands/UpdateGraphqlApiCommand.js +3 -3
  106. package/dist-es/commands/UpdateResolverCommand.js +3 -3
  107. package/dist-es/commands/UpdateTypeCommand.js +3 -3
  108. package/dist-es/commands/index.js +1 -0
  109. package/dist-es/models/models_0.js +130 -508
  110. package/dist-es/protocols/Aws_restJson1.js +857 -1368
  111. package/dist-types/AppSync.d.ts +13 -0
  112. package/dist-types/AppSyncClient.d.ts +3 -2
  113. package/dist-types/commands/EvaluateMappingTemplateCommand.d.ts +41 -0
  114. package/dist-types/commands/index.d.ts +1 -0
  115. package/dist-types/models/models_0.d.ts +551 -761
  116. package/dist-types/protocols/Aws_restJson1.d.ts +3 -0
  117. package/dist-types/ts3.4/AppSync.d.ts +5 -0
  118. package/dist-types/ts3.4/AppSyncClient.d.ts +3 -2
  119. package/dist-types/ts3.4/commands/EvaluateMappingTemplateCommand.d.ts +17 -0
  120. package/dist-types/ts3.4/commands/index.d.ts +1 -0
  121. package/dist-types/ts3.4/models/models_0.d.ts +275 -506
  122. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +3 -0
  123. package/package.json +6 -6
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deserializeAws_restJson1AssociateApiCommand = exports.serializeAws_restJson1UpdateTypeCommand = exports.serializeAws_restJson1UpdateResolverCommand = exports.serializeAws_restJson1UpdateGraphqlApiCommand = exports.serializeAws_restJson1UpdateFunctionCommand = exports.serializeAws_restJson1UpdateDomainNameCommand = exports.serializeAws_restJson1UpdateDataSourceCommand = exports.serializeAws_restJson1UpdateApiKeyCommand = exports.serializeAws_restJson1UpdateApiCacheCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1StartSchemaCreationCommand = exports.serializeAws_restJson1ListTypesCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListResolversByFunctionCommand = exports.serializeAws_restJson1ListResolversCommand = exports.serializeAws_restJson1ListGraphqlApisCommand = exports.serializeAws_restJson1ListFunctionsCommand = exports.serializeAws_restJson1ListDomainNamesCommand = exports.serializeAws_restJson1ListDataSourcesCommand = exports.serializeAws_restJson1ListApiKeysCommand = exports.serializeAws_restJson1GetTypeCommand = exports.serializeAws_restJson1GetSchemaCreationStatusCommand = exports.serializeAws_restJson1GetResolverCommand = exports.serializeAws_restJson1GetIntrospectionSchemaCommand = exports.serializeAws_restJson1GetGraphqlApiCommand = exports.serializeAws_restJson1GetFunctionCommand = exports.serializeAws_restJson1GetDomainNameCommand = exports.serializeAws_restJson1GetDataSourceCommand = exports.serializeAws_restJson1GetApiCacheCommand = exports.serializeAws_restJson1GetApiAssociationCommand = exports.serializeAws_restJson1FlushApiCacheCommand = exports.serializeAws_restJson1DisassociateApiCommand = exports.serializeAws_restJson1DeleteTypeCommand = exports.serializeAws_restJson1DeleteResolverCommand = exports.serializeAws_restJson1DeleteGraphqlApiCommand = exports.serializeAws_restJson1DeleteFunctionCommand = exports.serializeAws_restJson1DeleteDomainNameCommand = exports.serializeAws_restJson1DeleteDataSourceCommand = exports.serializeAws_restJson1DeleteApiKeyCommand = exports.serializeAws_restJson1DeleteApiCacheCommand = exports.serializeAws_restJson1CreateTypeCommand = exports.serializeAws_restJson1CreateResolverCommand = exports.serializeAws_restJson1CreateGraphqlApiCommand = exports.serializeAws_restJson1CreateFunctionCommand = exports.serializeAws_restJson1CreateDomainNameCommand = exports.serializeAws_restJson1CreateDataSourceCommand = exports.serializeAws_restJson1CreateApiKeyCommand = exports.serializeAws_restJson1CreateApiCacheCommand = exports.serializeAws_restJson1AssociateApiCommand = void 0;
4
- exports.deserializeAws_restJson1UpdateTypeCommand = exports.deserializeAws_restJson1UpdateResolverCommand = exports.deserializeAws_restJson1UpdateGraphqlApiCommand = exports.deserializeAws_restJson1UpdateFunctionCommand = exports.deserializeAws_restJson1UpdateDomainNameCommand = exports.deserializeAws_restJson1UpdateDataSourceCommand = exports.deserializeAws_restJson1UpdateApiKeyCommand = exports.deserializeAws_restJson1UpdateApiCacheCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1StartSchemaCreationCommand = exports.deserializeAws_restJson1ListTypesCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListResolversByFunctionCommand = exports.deserializeAws_restJson1ListResolversCommand = exports.deserializeAws_restJson1ListGraphqlApisCommand = exports.deserializeAws_restJson1ListFunctionsCommand = exports.deserializeAws_restJson1ListDomainNamesCommand = exports.deserializeAws_restJson1ListDataSourcesCommand = exports.deserializeAws_restJson1ListApiKeysCommand = exports.deserializeAws_restJson1GetTypeCommand = exports.deserializeAws_restJson1GetSchemaCreationStatusCommand = exports.deserializeAws_restJson1GetResolverCommand = exports.deserializeAws_restJson1GetIntrospectionSchemaCommand = exports.deserializeAws_restJson1GetGraphqlApiCommand = exports.deserializeAws_restJson1GetFunctionCommand = exports.deserializeAws_restJson1GetDomainNameCommand = exports.deserializeAws_restJson1GetDataSourceCommand = exports.deserializeAws_restJson1GetApiCacheCommand = exports.deserializeAws_restJson1GetApiAssociationCommand = exports.deserializeAws_restJson1FlushApiCacheCommand = exports.deserializeAws_restJson1DisassociateApiCommand = exports.deserializeAws_restJson1DeleteTypeCommand = exports.deserializeAws_restJson1DeleteResolverCommand = exports.deserializeAws_restJson1DeleteGraphqlApiCommand = exports.deserializeAws_restJson1DeleteFunctionCommand = exports.deserializeAws_restJson1DeleteDomainNameCommand = exports.deserializeAws_restJson1DeleteDataSourceCommand = exports.deserializeAws_restJson1DeleteApiKeyCommand = exports.deserializeAws_restJson1DeleteApiCacheCommand = exports.deserializeAws_restJson1CreateTypeCommand = exports.deserializeAws_restJson1CreateResolverCommand = exports.deserializeAws_restJson1CreateGraphqlApiCommand = exports.deserializeAws_restJson1CreateFunctionCommand = exports.deserializeAws_restJson1CreateDomainNameCommand = exports.deserializeAws_restJson1CreateDataSourceCommand = exports.deserializeAws_restJson1CreateApiKeyCommand = exports.deserializeAws_restJson1CreateApiCacheCommand = void 0;
3
+ exports.serializeAws_restJson1UpdateTypeCommand = exports.serializeAws_restJson1UpdateResolverCommand = exports.serializeAws_restJson1UpdateGraphqlApiCommand = exports.serializeAws_restJson1UpdateFunctionCommand = exports.serializeAws_restJson1UpdateDomainNameCommand = exports.serializeAws_restJson1UpdateDataSourceCommand = exports.serializeAws_restJson1UpdateApiKeyCommand = exports.serializeAws_restJson1UpdateApiCacheCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1StartSchemaCreationCommand = exports.serializeAws_restJson1ListTypesCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListResolversByFunctionCommand = exports.serializeAws_restJson1ListResolversCommand = exports.serializeAws_restJson1ListGraphqlApisCommand = exports.serializeAws_restJson1ListFunctionsCommand = exports.serializeAws_restJson1ListDomainNamesCommand = exports.serializeAws_restJson1ListDataSourcesCommand = exports.serializeAws_restJson1ListApiKeysCommand = exports.serializeAws_restJson1GetTypeCommand = exports.serializeAws_restJson1GetSchemaCreationStatusCommand = exports.serializeAws_restJson1GetResolverCommand = exports.serializeAws_restJson1GetIntrospectionSchemaCommand = exports.serializeAws_restJson1GetGraphqlApiCommand = exports.serializeAws_restJson1GetFunctionCommand = exports.serializeAws_restJson1GetDomainNameCommand = exports.serializeAws_restJson1GetDataSourceCommand = exports.serializeAws_restJson1GetApiCacheCommand = exports.serializeAws_restJson1GetApiAssociationCommand = exports.serializeAws_restJson1FlushApiCacheCommand = exports.serializeAws_restJson1EvaluateMappingTemplateCommand = exports.serializeAws_restJson1DisassociateApiCommand = exports.serializeAws_restJson1DeleteTypeCommand = exports.serializeAws_restJson1DeleteResolverCommand = exports.serializeAws_restJson1DeleteGraphqlApiCommand = exports.serializeAws_restJson1DeleteFunctionCommand = exports.serializeAws_restJson1DeleteDomainNameCommand = exports.serializeAws_restJson1DeleteDataSourceCommand = exports.serializeAws_restJson1DeleteApiKeyCommand = exports.serializeAws_restJson1DeleteApiCacheCommand = exports.serializeAws_restJson1CreateTypeCommand = exports.serializeAws_restJson1CreateResolverCommand = exports.serializeAws_restJson1CreateGraphqlApiCommand = exports.serializeAws_restJson1CreateFunctionCommand = exports.serializeAws_restJson1CreateDomainNameCommand = exports.serializeAws_restJson1CreateDataSourceCommand = exports.serializeAws_restJson1CreateApiKeyCommand = exports.serializeAws_restJson1CreateApiCacheCommand = exports.serializeAws_restJson1AssociateApiCommand = void 0;
4
+ exports.deserializeAws_restJson1UpdateTypeCommand = exports.deserializeAws_restJson1UpdateResolverCommand = exports.deserializeAws_restJson1UpdateGraphqlApiCommand = exports.deserializeAws_restJson1UpdateFunctionCommand = exports.deserializeAws_restJson1UpdateDomainNameCommand = exports.deserializeAws_restJson1UpdateDataSourceCommand = exports.deserializeAws_restJson1UpdateApiKeyCommand = exports.deserializeAws_restJson1UpdateApiCacheCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1StartSchemaCreationCommand = exports.deserializeAws_restJson1ListTypesCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListResolversByFunctionCommand = exports.deserializeAws_restJson1ListResolversCommand = exports.deserializeAws_restJson1ListGraphqlApisCommand = exports.deserializeAws_restJson1ListFunctionsCommand = exports.deserializeAws_restJson1ListDomainNamesCommand = exports.deserializeAws_restJson1ListDataSourcesCommand = exports.deserializeAws_restJson1ListApiKeysCommand = exports.deserializeAws_restJson1GetTypeCommand = exports.deserializeAws_restJson1GetSchemaCreationStatusCommand = exports.deserializeAws_restJson1GetResolverCommand = exports.deserializeAws_restJson1GetIntrospectionSchemaCommand = exports.deserializeAws_restJson1GetGraphqlApiCommand = exports.deserializeAws_restJson1GetFunctionCommand = exports.deserializeAws_restJson1GetDomainNameCommand = exports.deserializeAws_restJson1GetDataSourceCommand = exports.deserializeAws_restJson1GetApiCacheCommand = exports.deserializeAws_restJson1GetApiAssociationCommand = exports.deserializeAws_restJson1FlushApiCacheCommand = exports.deserializeAws_restJson1EvaluateMappingTemplateCommand = exports.deserializeAws_restJson1DisassociateApiCommand = exports.deserializeAws_restJson1DeleteTypeCommand = exports.deserializeAws_restJson1DeleteResolverCommand = exports.deserializeAws_restJson1DeleteGraphqlApiCommand = exports.deserializeAws_restJson1DeleteFunctionCommand = exports.deserializeAws_restJson1DeleteDomainNameCommand = exports.deserializeAws_restJson1DeleteDataSourceCommand = exports.deserializeAws_restJson1DeleteApiKeyCommand = exports.deserializeAws_restJson1DeleteApiCacheCommand = exports.deserializeAws_restJson1CreateTypeCommand = exports.deserializeAws_restJson1CreateResolverCommand = exports.deserializeAws_restJson1CreateGraphqlApiCommand = exports.deserializeAws_restJson1CreateFunctionCommand = exports.deserializeAws_restJson1CreateDomainNameCommand = exports.deserializeAws_restJson1CreateDataSourceCommand = exports.deserializeAws_restJson1CreateApiKeyCommand = exports.deserializeAws_restJson1CreateApiCacheCommand = exports.deserializeAws_restJson1AssociateApiCommand = void 0;
5
5
  const protocol_http_1 = require("@aws-sdk/protocol-http");
6
6
  const smithy_client_1 = require("@aws-sdk/smithy-client");
7
7
  const AppSyncServiceException_1 = require("../models/AppSyncServiceException");
@@ -13,16 +13,7 @@ const serializeAws_restJson1AssociateApiCommand = async (input, context) => {
13
13
  };
14
14
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
15
15
  "/v1/domainnames/{domainName}/apiassociation";
16
- if (input.domainName !== undefined) {
17
- const labelValue = input.domainName;
18
- if (labelValue.length <= 0) {
19
- throw new Error("Empty value provided for input HTTP label: domainName.");
20
- }
21
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
22
- }
23
- else {
24
- throw new Error("No value provided for input HTTP label: domainName.");
25
- }
16
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
26
17
  let body;
27
18
  body = JSON.stringify({
28
19
  ...(input.apiId != null && { apiId: input.apiId }),
@@ -44,16 +35,7 @@ const serializeAws_restJson1CreateApiCacheCommand = async (input, context) => {
44
35
  "content-type": "application/json",
45
36
  };
46
37
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches";
47
- if (input.apiId !== undefined) {
48
- const labelValue = input.apiId;
49
- if (labelValue.length <= 0) {
50
- throw new Error("Empty value provided for input HTTP label: apiId.");
51
- }
52
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
53
- }
54
- else {
55
- throw new Error("No value provided for input HTTP label: apiId.");
56
- }
38
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
57
39
  let body;
58
40
  body = JSON.stringify({
59
41
  ...(input.apiCachingBehavior != null && { apiCachingBehavior: input.apiCachingBehavior }),
@@ -79,16 +61,7 @@ const serializeAws_restJson1CreateApiKeyCommand = async (input, context) => {
79
61
  "content-type": "application/json",
80
62
  };
81
63
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys";
82
- if (input.apiId !== undefined) {
83
- const labelValue = input.apiId;
84
- if (labelValue.length <= 0) {
85
- throw new Error("Empty value provided for input HTTP label: apiId.");
86
- }
87
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
88
- }
89
- else {
90
- throw new Error("No value provided for input HTTP label: apiId.");
91
- }
64
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
92
65
  let body;
93
66
  body = JSON.stringify({
94
67
  ...(input.description != null && { description: input.description }),
@@ -111,16 +84,7 @@ const serializeAws_restJson1CreateDataSourceCommand = async (input, context) =>
111
84
  "content-type": "application/json",
112
85
  };
113
86
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources";
114
- if (input.apiId !== undefined) {
115
- const labelValue = input.apiId;
116
- if (labelValue.length <= 0) {
117
- throw new Error("Empty value provided for input HTTP label: apiId.");
118
- }
119
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
120
- }
121
- else {
122
- throw new Error("No value provided for input HTTP label: apiId.");
123
- }
87
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
124
88
  let body;
125
89
  body = JSON.stringify({
126
90
  ...(input.description != null && { description: input.description }),
@@ -186,16 +150,7 @@ const serializeAws_restJson1CreateFunctionCommand = async (input, context) => {
186
150
  "content-type": "application/json",
187
151
  };
188
152
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions";
189
- if (input.apiId !== undefined) {
190
- const labelValue = input.apiId;
191
- if (labelValue.length <= 0) {
192
- throw new Error("Empty value provided for input HTTP label: apiId.");
193
- }
194
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
195
- }
196
- else {
197
- throw new Error("No value provided for input HTTP label: apiId.");
198
- }
153
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
199
154
  let body;
200
155
  body = JSON.stringify({
201
156
  ...(input.dataSourceName != null && { dataSourceName: input.dataSourceName }),
@@ -262,26 +217,8 @@ const serializeAws_restJson1CreateResolverCommand = async (input, context) => {
262
217
  };
263
218
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
264
219
  "/v1/apis/{apiId}/types/{typeName}/resolvers";
265
- if (input.apiId !== undefined) {
266
- const labelValue = input.apiId;
267
- if (labelValue.length <= 0) {
268
- throw new Error("Empty value provided for input HTTP label: apiId.");
269
- }
270
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
271
- }
272
- else {
273
- throw new Error("No value provided for input HTTP label: apiId.");
274
- }
275
- if (input.typeName !== undefined) {
276
- const labelValue = input.typeName;
277
- if (labelValue.length <= 0) {
278
- throw new Error("Empty value provided for input HTTP label: typeName.");
279
- }
280
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
281
- }
282
- else {
283
- throw new Error("No value provided for input HTTP label: typeName.");
284
- }
220
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
221
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
285
222
  let body;
286
223
  body = JSON.stringify({
287
224
  ...(input.cachingConfig != null && {
@@ -315,16 +252,7 @@ const serializeAws_restJson1CreateTypeCommand = async (input, context) => {
315
252
  "content-type": "application/json",
316
253
  };
317
254
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types";
318
- if (input.apiId !== undefined) {
319
- const labelValue = input.apiId;
320
- if (labelValue.length <= 0) {
321
- throw new Error("Empty value provided for input HTTP label: apiId.");
322
- }
323
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
324
- }
325
- else {
326
- throw new Error("No value provided for input HTTP label: apiId.");
327
- }
255
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
328
256
  let body;
329
257
  body = JSON.stringify({
330
258
  ...(input.definition != null && { definition: input.definition }),
@@ -345,16 +273,7 @@ const serializeAws_restJson1DeleteApiCacheCommand = async (input, context) => {
345
273
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
346
274
  const headers = {};
347
275
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches";
348
- if (input.apiId !== undefined) {
349
- const labelValue = input.apiId;
350
- if (labelValue.length <= 0) {
351
- throw new Error("Empty value provided for input HTTP label: apiId.");
352
- }
353
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
354
- }
355
- else {
356
- throw new Error("No value provided for input HTTP label: apiId.");
357
- }
276
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
358
277
  let body;
359
278
  return new protocol_http_1.HttpRequest({
360
279
  protocol,
@@ -371,26 +290,8 @@ const serializeAws_restJson1DeleteApiKeyCommand = async (input, context) => {
371
290
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
372
291
  const headers = {};
373
292
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys/{id}";
374
- if (input.apiId !== undefined) {
375
- const labelValue = input.apiId;
376
- if (labelValue.length <= 0) {
377
- throw new Error("Empty value provided for input HTTP label: apiId.");
378
- }
379
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
380
- }
381
- else {
382
- throw new Error("No value provided for input HTTP label: apiId.");
383
- }
384
- if (input.id !== undefined) {
385
- const labelValue = input.id;
386
- if (labelValue.length <= 0) {
387
- throw new Error("Empty value provided for input HTTP label: id.");
388
- }
389
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
390
- }
391
- else {
392
- throw new Error("No value provided for input HTTP label: id.");
393
- }
293
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
294
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
394
295
  let body;
395
296
  return new protocol_http_1.HttpRequest({
396
297
  protocol,
@@ -407,26 +308,8 @@ const serializeAws_restJson1DeleteDataSourceCommand = async (input, context) =>
407
308
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
408
309
  const headers = {};
409
310
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources/{name}";
410
- if (input.apiId !== undefined) {
411
- const labelValue = input.apiId;
412
- if (labelValue.length <= 0) {
413
- throw new Error("Empty value provided for input HTTP label: apiId.");
414
- }
415
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
416
- }
417
- else {
418
- throw new Error("No value provided for input HTTP label: apiId.");
419
- }
420
- if (input.name !== undefined) {
421
- const labelValue = input.name;
422
- if (labelValue.length <= 0) {
423
- throw new Error("Empty value provided for input HTTP label: name.");
424
- }
425
- resolvedPath = resolvedPath.replace("{name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
426
- }
427
- else {
428
- throw new Error("No value provided for input HTTP label: name.");
429
- }
311
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
312
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "name", () => input.name, "{name}", false);
430
313
  let body;
431
314
  return new protocol_http_1.HttpRequest({
432
315
  protocol,
@@ -443,16 +326,7 @@ const serializeAws_restJson1DeleteDomainNameCommand = async (input, context) =>
443
326
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
444
327
  const headers = {};
445
328
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domainnames/{domainName}";
446
- if (input.domainName !== undefined) {
447
- const labelValue = input.domainName;
448
- if (labelValue.length <= 0) {
449
- throw new Error("Empty value provided for input HTTP label: domainName.");
450
- }
451
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
452
- }
453
- else {
454
- throw new Error("No value provided for input HTTP label: domainName.");
455
- }
329
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
456
330
  let body;
457
331
  return new protocol_http_1.HttpRequest({
458
332
  protocol,
@@ -469,26 +343,8 @@ const serializeAws_restJson1DeleteFunctionCommand = async (input, context) => {
469
343
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
470
344
  const headers = {};
471
345
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions/{functionId}";
472
- if (input.apiId !== undefined) {
473
- const labelValue = input.apiId;
474
- if (labelValue.length <= 0) {
475
- throw new Error("Empty value provided for input HTTP label: apiId.");
476
- }
477
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
478
- }
479
- else {
480
- throw new Error("No value provided for input HTTP label: apiId.");
481
- }
482
- if (input.functionId !== undefined) {
483
- const labelValue = input.functionId;
484
- if (labelValue.length <= 0) {
485
- throw new Error("Empty value provided for input HTTP label: functionId.");
486
- }
487
- resolvedPath = resolvedPath.replace("{functionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
488
- }
489
- else {
490
- throw new Error("No value provided for input HTTP label: functionId.");
491
- }
346
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
347
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "functionId", () => input.functionId, "{functionId}", false);
492
348
  let body;
493
349
  return new protocol_http_1.HttpRequest({
494
350
  protocol,
@@ -505,16 +361,7 @@ const serializeAws_restJson1DeleteGraphqlApiCommand = async (input, context) =>
505
361
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
506
362
  const headers = {};
507
363
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}";
508
- if (input.apiId !== undefined) {
509
- const labelValue = input.apiId;
510
- if (labelValue.length <= 0) {
511
- throw new Error("Empty value provided for input HTTP label: apiId.");
512
- }
513
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
514
- }
515
- else {
516
- throw new Error("No value provided for input HTTP label: apiId.");
517
- }
364
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
518
365
  let body;
519
366
  return new protocol_http_1.HttpRequest({
520
367
  protocol,
@@ -532,36 +379,9 @@ const serializeAws_restJson1DeleteResolverCommand = async (input, context) => {
532
379
  const headers = {};
533
380
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
534
381
  "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}";
535
- if (input.apiId !== undefined) {
536
- const labelValue = input.apiId;
537
- if (labelValue.length <= 0) {
538
- throw new Error("Empty value provided for input HTTP label: apiId.");
539
- }
540
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
541
- }
542
- else {
543
- throw new Error("No value provided for input HTTP label: apiId.");
544
- }
545
- if (input.typeName !== undefined) {
546
- const labelValue = input.typeName;
547
- if (labelValue.length <= 0) {
548
- throw new Error("Empty value provided for input HTTP label: typeName.");
549
- }
550
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
551
- }
552
- else {
553
- throw new Error("No value provided for input HTTP label: typeName.");
554
- }
555
- if (input.fieldName !== undefined) {
556
- const labelValue = input.fieldName;
557
- if (labelValue.length <= 0) {
558
- throw new Error("Empty value provided for input HTTP label: fieldName.");
559
- }
560
- resolvedPath = resolvedPath.replace("{fieldName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
561
- }
562
- else {
563
- throw new Error("No value provided for input HTTP label: fieldName.");
564
- }
382
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
383
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
384
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "fieldName", () => input.fieldName, "{fieldName}", false);
565
385
  let body;
566
386
  return new protocol_http_1.HttpRequest({
567
387
  protocol,
@@ -578,26 +398,8 @@ const serializeAws_restJson1DeleteTypeCommand = async (input, context) => {
578
398
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
579
399
  const headers = {};
580
400
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types/{typeName}";
581
- if (input.apiId !== undefined) {
582
- const labelValue = input.apiId;
583
- if (labelValue.length <= 0) {
584
- throw new Error("Empty value provided for input HTTP label: apiId.");
585
- }
586
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
587
- }
588
- else {
589
- throw new Error("No value provided for input HTTP label: apiId.");
590
- }
591
- if (input.typeName !== undefined) {
592
- const labelValue = input.typeName;
593
- if (labelValue.length <= 0) {
594
- throw new Error("Empty value provided for input HTTP label: typeName.");
595
- }
596
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
597
- }
598
- else {
599
- throw new Error("No value provided for input HTTP label: typeName.");
600
- }
401
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
402
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
601
403
  let body;
602
404
  return new protocol_http_1.HttpRequest({
603
405
  protocol,
@@ -615,16 +417,7 @@ const serializeAws_restJson1DisassociateApiCommand = async (input, context) => {
615
417
  const headers = {};
616
418
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
617
419
  "/v1/domainnames/{domainName}/apiassociation";
618
- if (input.domainName !== undefined) {
619
- const labelValue = input.domainName;
620
- if (labelValue.length <= 0) {
621
- throw new Error("Empty value provided for input HTTP label: domainName.");
622
- }
623
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
624
- }
625
- else {
626
- throw new Error("No value provided for input HTTP label: domainName.");
627
- }
420
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
628
421
  let body;
629
422
  return new protocol_http_1.HttpRequest({
630
423
  protocol,
@@ -637,20 +430,33 @@ const serializeAws_restJson1DisassociateApiCommand = async (input, context) => {
637
430
  });
638
431
  };
639
432
  exports.serializeAws_restJson1DisassociateApiCommand = serializeAws_restJson1DisassociateApiCommand;
433
+ const serializeAws_restJson1EvaluateMappingTemplateCommand = async (input, context) => {
434
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
435
+ const headers = {
436
+ "content-type": "application/json",
437
+ };
438
+ const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/dataplane-evaluatetemplate";
439
+ let body;
440
+ body = JSON.stringify({
441
+ ...(input.context != null && { context: input.context }),
442
+ ...(input.template != null && { template: input.template }),
443
+ });
444
+ return new protocol_http_1.HttpRequest({
445
+ protocol,
446
+ hostname,
447
+ port,
448
+ method: "POST",
449
+ headers,
450
+ path: resolvedPath,
451
+ body,
452
+ });
453
+ };
454
+ exports.serializeAws_restJson1EvaluateMappingTemplateCommand = serializeAws_restJson1EvaluateMappingTemplateCommand;
640
455
  const serializeAws_restJson1FlushApiCacheCommand = async (input, context) => {
641
456
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
642
457
  const headers = {};
643
458
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/FlushCache";
644
- if (input.apiId !== undefined) {
645
- const labelValue = input.apiId;
646
- if (labelValue.length <= 0) {
647
- throw new Error("Empty value provided for input HTTP label: apiId.");
648
- }
649
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
650
- }
651
- else {
652
- throw new Error("No value provided for input HTTP label: apiId.");
653
- }
459
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
654
460
  let body;
655
461
  return new protocol_http_1.HttpRequest({
656
462
  protocol,
@@ -668,16 +474,7 @@ const serializeAws_restJson1GetApiAssociationCommand = async (input, context) =>
668
474
  const headers = {};
669
475
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
670
476
  "/v1/domainnames/{domainName}/apiassociation";
671
- if (input.domainName !== undefined) {
672
- const labelValue = input.domainName;
673
- if (labelValue.length <= 0) {
674
- throw new Error("Empty value provided for input HTTP label: domainName.");
675
- }
676
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
677
- }
678
- else {
679
- throw new Error("No value provided for input HTTP label: domainName.");
680
- }
477
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
681
478
  let body;
682
479
  return new protocol_http_1.HttpRequest({
683
480
  protocol,
@@ -694,16 +491,7 @@ const serializeAws_restJson1GetApiCacheCommand = async (input, context) => {
694
491
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
695
492
  const headers = {};
696
493
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches";
697
- if (input.apiId !== undefined) {
698
- const labelValue = input.apiId;
699
- if (labelValue.length <= 0) {
700
- throw new Error("Empty value provided for input HTTP label: apiId.");
701
- }
702
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
703
- }
704
- else {
705
- throw new Error("No value provided for input HTTP label: apiId.");
706
- }
494
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
707
495
  let body;
708
496
  return new protocol_http_1.HttpRequest({
709
497
  protocol,
@@ -720,26 +508,8 @@ const serializeAws_restJson1GetDataSourceCommand = async (input, context) => {
720
508
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
721
509
  const headers = {};
722
510
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources/{name}";
723
- if (input.apiId !== undefined) {
724
- const labelValue = input.apiId;
725
- if (labelValue.length <= 0) {
726
- throw new Error("Empty value provided for input HTTP label: apiId.");
727
- }
728
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
729
- }
730
- else {
731
- throw new Error("No value provided for input HTTP label: apiId.");
732
- }
733
- if (input.name !== undefined) {
734
- const labelValue = input.name;
735
- if (labelValue.length <= 0) {
736
- throw new Error("Empty value provided for input HTTP label: name.");
737
- }
738
- resolvedPath = resolvedPath.replace("{name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
739
- }
740
- else {
741
- throw new Error("No value provided for input HTTP label: name.");
742
- }
511
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
512
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "name", () => input.name, "{name}", false);
743
513
  let body;
744
514
  return new protocol_http_1.HttpRequest({
745
515
  protocol,
@@ -756,16 +526,7 @@ const serializeAws_restJson1GetDomainNameCommand = async (input, context) => {
756
526
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
757
527
  const headers = {};
758
528
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domainnames/{domainName}";
759
- if (input.domainName !== undefined) {
760
- const labelValue = input.domainName;
761
- if (labelValue.length <= 0) {
762
- throw new Error("Empty value provided for input HTTP label: domainName.");
763
- }
764
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
765
- }
766
- else {
767
- throw new Error("No value provided for input HTTP label: domainName.");
768
- }
529
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
769
530
  let body;
770
531
  return new protocol_http_1.HttpRequest({
771
532
  protocol,
@@ -782,26 +543,8 @@ const serializeAws_restJson1GetFunctionCommand = async (input, context) => {
782
543
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
783
544
  const headers = {};
784
545
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions/{functionId}";
785
- if (input.apiId !== undefined) {
786
- const labelValue = input.apiId;
787
- if (labelValue.length <= 0) {
788
- throw new Error("Empty value provided for input HTTP label: apiId.");
789
- }
790
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
791
- }
792
- else {
793
- throw new Error("No value provided for input HTTP label: apiId.");
794
- }
795
- if (input.functionId !== undefined) {
796
- const labelValue = input.functionId;
797
- if (labelValue.length <= 0) {
798
- throw new Error("Empty value provided for input HTTP label: functionId.");
799
- }
800
- resolvedPath = resolvedPath.replace("{functionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
801
- }
802
- else {
803
- throw new Error("No value provided for input HTTP label: functionId.");
804
- }
546
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
547
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "functionId", () => input.functionId, "{functionId}", false);
805
548
  let body;
806
549
  return new protocol_http_1.HttpRequest({
807
550
  protocol,
@@ -818,16 +561,7 @@ const serializeAws_restJson1GetGraphqlApiCommand = async (input, context) => {
818
561
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
819
562
  const headers = {};
820
563
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}";
821
- if (input.apiId !== undefined) {
822
- const labelValue = input.apiId;
823
- if (labelValue.length <= 0) {
824
- throw new Error("Empty value provided for input HTTP label: apiId.");
825
- }
826
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
827
- }
828
- else {
829
- throw new Error("No value provided for input HTTP label: apiId.");
830
- }
564
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
831
565
  let body;
832
566
  return new protocol_http_1.HttpRequest({
833
567
  protocol,
@@ -844,20 +578,11 @@ const serializeAws_restJson1GetIntrospectionSchemaCommand = async (input, contex
844
578
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
845
579
  const headers = {};
846
580
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schema";
847
- if (input.apiId !== undefined) {
848
- const labelValue = input.apiId;
849
- if (labelValue.length <= 0) {
850
- throw new Error("Empty value provided for input HTTP label: apiId.");
851
- }
852
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
853
- }
854
- else {
855
- throw new Error("No value provided for input HTTP label: apiId.");
856
- }
857
- const query = {
858
- ...(input.format !== undefined && { format: input.format }),
859
- ...(input.includeDirectives !== undefined && { includeDirectives: input.includeDirectives.toString() }),
860
- };
581
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
582
+ const query = map({
583
+ format: [, input.format],
584
+ includeDirectives: [() => input.includeDirectives !== void 0, () => input.includeDirectives.toString()],
585
+ });
861
586
  let body;
862
587
  return new protocol_http_1.HttpRequest({
863
588
  protocol,
@@ -876,36 +601,9 @@ const serializeAws_restJson1GetResolverCommand = async (input, context) => {
876
601
  const headers = {};
877
602
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
878
603
  "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}";
879
- if (input.apiId !== undefined) {
880
- const labelValue = input.apiId;
881
- if (labelValue.length <= 0) {
882
- throw new Error("Empty value provided for input HTTP label: apiId.");
883
- }
884
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
885
- }
886
- else {
887
- throw new Error("No value provided for input HTTP label: apiId.");
888
- }
889
- if (input.typeName !== undefined) {
890
- const labelValue = input.typeName;
891
- if (labelValue.length <= 0) {
892
- throw new Error("Empty value provided for input HTTP label: typeName.");
893
- }
894
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
895
- }
896
- else {
897
- throw new Error("No value provided for input HTTP label: typeName.");
898
- }
899
- if (input.fieldName !== undefined) {
900
- const labelValue = input.fieldName;
901
- if (labelValue.length <= 0) {
902
- throw new Error("Empty value provided for input HTTP label: fieldName.");
903
- }
904
- resolvedPath = resolvedPath.replace("{fieldName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
905
- }
906
- else {
907
- throw new Error("No value provided for input HTTP label: fieldName.");
908
- }
604
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
605
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
606
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "fieldName", () => input.fieldName, "{fieldName}", false);
909
607
  let body;
910
608
  return new protocol_http_1.HttpRequest({
911
609
  protocol,
@@ -922,16 +620,7 @@ const serializeAws_restJson1GetSchemaCreationStatusCommand = async (input, conte
922
620
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
923
621
  const headers = {};
924
622
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schemacreation";
925
- if (input.apiId !== undefined) {
926
- const labelValue = input.apiId;
927
- if (labelValue.length <= 0) {
928
- throw new Error("Empty value provided for input HTTP label: apiId.");
929
- }
930
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
931
- }
932
- else {
933
- throw new Error("No value provided for input HTTP label: apiId.");
934
- }
623
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
935
624
  let body;
936
625
  return new protocol_http_1.HttpRequest({
937
626
  protocol,
@@ -948,29 +637,11 @@ const serializeAws_restJson1GetTypeCommand = async (input, context) => {
948
637
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
949
638
  const headers = {};
950
639
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types/{typeName}";
951
- if (input.apiId !== undefined) {
952
- const labelValue = input.apiId;
953
- if (labelValue.length <= 0) {
954
- throw new Error("Empty value provided for input HTTP label: apiId.");
955
- }
956
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
957
- }
958
- else {
959
- throw new Error("No value provided for input HTTP label: apiId.");
960
- }
961
- if (input.typeName !== undefined) {
962
- const labelValue = input.typeName;
963
- if (labelValue.length <= 0) {
964
- throw new Error("Empty value provided for input HTTP label: typeName.");
965
- }
966
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
967
- }
968
- else {
969
- throw new Error("No value provided for input HTTP label: typeName.");
970
- }
971
- const query = {
972
- ...(input.format !== undefined && { format: input.format }),
973
- };
640
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
641
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
642
+ const query = map({
643
+ format: [, input.format],
644
+ });
974
645
  let body;
975
646
  return new protocol_http_1.HttpRequest({
976
647
  protocol,
@@ -988,20 +659,11 @@ const serializeAws_restJson1ListApiKeysCommand = async (input, context) => {
988
659
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
989
660
  const headers = {};
990
661
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys";
991
- if (input.apiId !== undefined) {
992
- const labelValue = input.apiId;
993
- if (labelValue.length <= 0) {
994
- throw new Error("Empty value provided for input HTTP label: apiId.");
995
- }
996
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
997
- }
998
- else {
999
- throw new Error("No value provided for input HTTP label: apiId.");
1000
- }
1001
- const query = {
1002
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1003
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1004
- };
662
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
663
+ const query = map({
664
+ nextToken: [, input.nextToken],
665
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
666
+ });
1005
667
  let body;
1006
668
  return new protocol_http_1.HttpRequest({
1007
669
  protocol,
@@ -1019,20 +681,11 @@ const serializeAws_restJson1ListDataSourcesCommand = async (input, context) => {
1019
681
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1020
682
  const headers = {};
1021
683
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources";
1022
- if (input.apiId !== undefined) {
1023
- const labelValue = input.apiId;
1024
- if (labelValue.length <= 0) {
1025
- throw new Error("Empty value provided for input HTTP label: apiId.");
1026
- }
1027
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1028
- }
1029
- else {
1030
- throw new Error("No value provided for input HTTP label: apiId.");
1031
- }
1032
- const query = {
1033
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1034
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1035
- };
684
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
685
+ const query = map({
686
+ nextToken: [, input.nextToken],
687
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
688
+ });
1036
689
  let body;
1037
690
  return new protocol_http_1.HttpRequest({
1038
691
  protocol,
@@ -1050,10 +703,10 @@ const serializeAws_restJson1ListDomainNamesCommand = async (input, context) => {
1050
703
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1051
704
  const headers = {};
1052
705
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domainnames";
1053
- const query = {
1054
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1055
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1056
- };
706
+ const query = map({
707
+ nextToken: [, input.nextToken],
708
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
709
+ });
1057
710
  let body;
1058
711
  return new protocol_http_1.HttpRequest({
1059
712
  protocol,
@@ -1071,20 +724,11 @@ const serializeAws_restJson1ListFunctionsCommand = async (input, context) => {
1071
724
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1072
725
  const headers = {};
1073
726
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions";
1074
- if (input.apiId !== undefined) {
1075
- const labelValue = input.apiId;
1076
- if (labelValue.length <= 0) {
1077
- throw new Error("Empty value provided for input HTTP label: apiId.");
1078
- }
1079
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1080
- }
1081
- else {
1082
- throw new Error("No value provided for input HTTP label: apiId.");
1083
- }
1084
- const query = {
1085
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1086
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1087
- };
727
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
728
+ const query = map({
729
+ nextToken: [, input.nextToken],
730
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
731
+ });
1088
732
  let body;
1089
733
  return new protocol_http_1.HttpRequest({
1090
734
  protocol,
@@ -1102,10 +746,10 @@ const serializeAws_restJson1ListGraphqlApisCommand = async (input, context) => {
1102
746
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1103
747
  const headers = {};
1104
748
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis";
1105
- const query = {
1106
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1107
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1108
- };
749
+ const query = map({
750
+ nextToken: [, input.nextToken],
751
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
752
+ });
1109
753
  let body;
1110
754
  return new protocol_http_1.HttpRequest({
1111
755
  protocol,
@@ -1124,30 +768,12 @@ const serializeAws_restJson1ListResolversCommand = async (input, context) => {
1124
768
  const headers = {};
1125
769
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1126
770
  "/v1/apis/{apiId}/types/{typeName}/resolvers";
1127
- if (input.apiId !== undefined) {
1128
- const labelValue = input.apiId;
1129
- if (labelValue.length <= 0) {
1130
- throw new Error("Empty value provided for input HTTP label: apiId.");
1131
- }
1132
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1133
- }
1134
- else {
1135
- throw new Error("No value provided for input HTTP label: apiId.");
1136
- }
1137
- if (input.typeName !== undefined) {
1138
- const labelValue = input.typeName;
1139
- if (labelValue.length <= 0) {
1140
- throw new Error("Empty value provided for input HTTP label: typeName.");
1141
- }
1142
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1143
- }
1144
- else {
1145
- throw new Error("No value provided for input HTTP label: typeName.");
1146
- }
1147
- const query = {
1148
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1149
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1150
- };
771
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
772
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
773
+ const query = map({
774
+ nextToken: [, input.nextToken],
775
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
776
+ });
1151
777
  let body;
1152
778
  return new protocol_http_1.HttpRequest({
1153
779
  protocol,
@@ -1166,30 +792,12 @@ const serializeAws_restJson1ListResolversByFunctionCommand = async (input, conte
1166
792
  const headers = {};
1167
793
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1168
794
  "/v1/apis/{apiId}/functions/{functionId}/resolvers";
1169
- if (input.apiId !== undefined) {
1170
- const labelValue = input.apiId;
1171
- if (labelValue.length <= 0) {
1172
- throw new Error("Empty value provided for input HTTP label: apiId.");
1173
- }
1174
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1175
- }
1176
- else {
1177
- throw new Error("No value provided for input HTTP label: apiId.");
1178
- }
1179
- if (input.functionId !== undefined) {
1180
- const labelValue = input.functionId;
1181
- if (labelValue.length <= 0) {
1182
- throw new Error("Empty value provided for input HTTP label: functionId.");
1183
- }
1184
- resolvedPath = resolvedPath.replace("{functionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1185
- }
1186
- else {
1187
- throw new Error("No value provided for input HTTP label: functionId.");
1188
- }
1189
- const query = {
1190
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1191
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1192
- };
795
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
796
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "functionId", () => input.functionId, "{functionId}", false);
797
+ const query = map({
798
+ nextToken: [, input.nextToken],
799
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
800
+ });
1193
801
  let body;
1194
802
  return new protocol_http_1.HttpRequest({
1195
803
  protocol,
@@ -1207,16 +815,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
1207
815
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1208
816
  const headers = {};
1209
817
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}";
1210
- if (input.resourceArn !== undefined) {
1211
- const labelValue = input.resourceArn;
1212
- if (labelValue.length <= 0) {
1213
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1214
- }
1215
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1216
- }
1217
- else {
1218
- throw new Error("No value provided for input HTTP label: resourceArn.");
1219
- }
818
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
1220
819
  let body;
1221
820
  return new protocol_http_1.HttpRequest({
1222
821
  protocol,
@@ -1233,21 +832,12 @@ const serializeAws_restJson1ListTypesCommand = async (input, context) => {
1233
832
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1234
833
  const headers = {};
1235
834
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types";
1236
- if (input.apiId !== undefined) {
1237
- const labelValue = input.apiId;
1238
- if (labelValue.length <= 0) {
1239
- throw new Error("Empty value provided for input HTTP label: apiId.");
1240
- }
1241
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1242
- }
1243
- else {
1244
- throw new Error("No value provided for input HTTP label: apiId.");
1245
- }
1246
- const query = {
1247
- ...(input.format !== undefined && { format: input.format }),
1248
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
1249
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
1250
- };
835
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
836
+ const query = map({
837
+ format: [, input.format],
838
+ nextToken: [, input.nextToken],
839
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
840
+ });
1251
841
  let body;
1252
842
  return new protocol_http_1.HttpRequest({
1253
843
  protocol,
@@ -1267,16 +857,7 @@ const serializeAws_restJson1StartSchemaCreationCommand = async (input, context)
1267
857
  "content-type": "application/json",
1268
858
  };
1269
859
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schemacreation";
1270
- if (input.apiId !== undefined) {
1271
- const labelValue = input.apiId;
1272
- if (labelValue.length <= 0) {
1273
- throw new Error("Empty value provided for input HTTP label: apiId.");
1274
- }
1275
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1276
- }
1277
- else {
1278
- throw new Error("No value provided for input HTTP label: apiId.");
1279
- }
860
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1280
861
  let body;
1281
862
  body = JSON.stringify({
1282
863
  ...(input.definition != null && { definition: context.base64Encoder(input.definition) }),
@@ -1298,16 +879,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
1298
879
  "content-type": "application/json",
1299
880
  };
1300
881
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}";
1301
- if (input.resourceArn !== undefined) {
1302
- const labelValue = input.resourceArn;
1303
- if (labelValue.length <= 0) {
1304
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1305
- }
1306
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1307
- }
1308
- else {
1309
- throw new Error("No value provided for input HTTP label: resourceArn.");
1310
- }
882
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
1311
883
  let body;
1312
884
  body = JSON.stringify({
1313
885
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -1327,19 +899,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
1327
899
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
1328
900
  const headers = {};
1329
901
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}";
1330
- if (input.resourceArn !== undefined) {
1331
- const labelValue = input.resourceArn;
1332
- if (labelValue.length <= 0) {
1333
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
1334
- }
1335
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1336
- }
1337
- else {
1338
- throw new Error("No value provided for input HTTP label: resourceArn.");
1339
- }
1340
- const query = {
1341
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
1342
- };
902
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
903
+ const query = map({
904
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
905
+ });
1343
906
  let body;
1344
907
  return new protocol_http_1.HttpRequest({
1345
908
  protocol,
@@ -1359,16 +922,7 @@ const serializeAws_restJson1UpdateApiCacheCommand = async (input, context) => {
1359
922
  "content-type": "application/json",
1360
923
  };
1361
924
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/ApiCaches/update";
1362
- if (input.apiId !== undefined) {
1363
- const labelValue = input.apiId;
1364
- if (labelValue.length <= 0) {
1365
- throw new Error("Empty value provided for input HTTP label: apiId.");
1366
- }
1367
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1368
- }
1369
- else {
1370
- throw new Error("No value provided for input HTTP label: apiId.");
1371
- }
925
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1372
926
  let body;
1373
927
  body = JSON.stringify({
1374
928
  ...(input.apiCachingBehavior != null && { apiCachingBehavior: input.apiCachingBehavior }),
@@ -1392,26 +946,8 @@ const serializeAws_restJson1UpdateApiKeyCommand = async (input, context) => {
1392
946
  "content-type": "application/json",
1393
947
  };
1394
948
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/apikeys/{id}";
1395
- if (input.apiId !== undefined) {
1396
- const labelValue = input.apiId;
1397
- if (labelValue.length <= 0) {
1398
- throw new Error("Empty value provided for input HTTP label: apiId.");
1399
- }
1400
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1401
- }
1402
- else {
1403
- throw new Error("No value provided for input HTTP label: apiId.");
1404
- }
1405
- if (input.id !== undefined) {
1406
- const labelValue = input.id;
1407
- if (labelValue.length <= 0) {
1408
- throw new Error("Empty value provided for input HTTP label: id.");
1409
- }
1410
- resolvedPath = resolvedPath.replace("{id}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1411
- }
1412
- else {
1413
- throw new Error("No value provided for input HTTP label: id.");
1414
- }
949
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
950
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "id", () => input.id, "{id}", false);
1415
951
  let body;
1416
952
  body = JSON.stringify({
1417
953
  ...(input.description != null && { description: input.description }),
@@ -1434,26 +970,8 @@ const serializeAws_restJson1UpdateDataSourceCommand = async (input, context) =>
1434
970
  "content-type": "application/json",
1435
971
  };
1436
972
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/datasources/{name}";
1437
- if (input.apiId !== undefined) {
1438
- const labelValue = input.apiId;
1439
- if (labelValue.length <= 0) {
1440
- throw new Error("Empty value provided for input HTTP label: apiId.");
1441
- }
1442
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1443
- }
1444
- else {
1445
- throw new Error("No value provided for input HTTP label: apiId.");
1446
- }
1447
- if (input.name !== undefined) {
1448
- const labelValue = input.name;
1449
- if (labelValue.length <= 0) {
1450
- throw new Error("Empty value provided for input HTTP label: name.");
1451
- }
1452
- resolvedPath = resolvedPath.replace("{name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1453
- }
1454
- else {
1455
- throw new Error("No value provided for input HTTP label: name.");
1456
- }
973
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
974
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "name", () => input.name, "{name}", false);
1457
975
  let body;
1458
976
  body = JSON.stringify({
1459
977
  ...(input.description != null && { description: input.description }),
@@ -1495,16 +1013,7 @@ const serializeAws_restJson1UpdateDomainNameCommand = async (input, context) =>
1495
1013
  "content-type": "application/json",
1496
1014
  };
1497
1015
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/domainnames/{domainName}";
1498
- if (input.domainName !== undefined) {
1499
- const labelValue = input.domainName;
1500
- if (labelValue.length <= 0) {
1501
- throw new Error("Empty value provided for input HTTP label: domainName.");
1502
- }
1503
- resolvedPath = resolvedPath.replace("{domainName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1504
- }
1505
- else {
1506
- throw new Error("No value provided for input HTTP label: domainName.");
1507
- }
1016
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "domainName", () => input.domainName, "{domainName}", false);
1508
1017
  let body;
1509
1018
  body = JSON.stringify({
1510
1019
  ...(input.description != null && { description: input.description }),
@@ -1526,26 +1035,8 @@ const serializeAws_restJson1UpdateFunctionCommand = async (input, context) => {
1526
1035
  "content-type": "application/json",
1527
1036
  };
1528
1037
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/functions/{functionId}";
1529
- if (input.apiId !== undefined) {
1530
- const labelValue = input.apiId;
1531
- if (labelValue.length <= 0) {
1532
- throw new Error("Empty value provided for input HTTP label: apiId.");
1533
- }
1534
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1535
- }
1536
- else {
1537
- throw new Error("No value provided for input HTTP label: apiId.");
1538
- }
1539
- if (input.functionId !== undefined) {
1540
- const labelValue = input.functionId;
1541
- if (labelValue.length <= 0) {
1542
- throw new Error("Empty value provided for input HTTP label: functionId.");
1543
- }
1544
- resolvedPath = resolvedPath.replace("{functionId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1545
- }
1546
- else {
1547
- throw new Error("No value provided for input HTTP label: functionId.");
1548
- }
1038
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1039
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "functionId", () => input.functionId, "{functionId}", false);
1549
1040
  let body;
1550
1041
  body = JSON.stringify({
1551
1042
  ...(input.dataSourceName != null && { dataSourceName: input.dataSourceName }),
@@ -1574,16 +1065,7 @@ const serializeAws_restJson1UpdateGraphqlApiCommand = async (input, context) =>
1574
1065
  "content-type": "application/json",
1575
1066
  };
1576
1067
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}";
1577
- if (input.apiId !== undefined) {
1578
- const labelValue = input.apiId;
1579
- if (labelValue.length <= 0) {
1580
- throw new Error("Empty value provided for input HTTP label: apiId.");
1581
- }
1582
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1583
- }
1584
- else {
1585
- throw new Error("No value provided for input HTTP label: apiId.");
1586
- }
1068
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1587
1069
  let body;
1588
1070
  body = JSON.stringify({
1589
1071
  ...(input.additionalAuthenticationProviders != null && {
@@ -1621,36 +1103,9 @@ const serializeAws_restJson1UpdateResolverCommand = async (input, context) => {
1621
1103
  };
1622
1104
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
1623
1105
  "/v1/apis/{apiId}/types/{typeName}/resolvers/{fieldName}";
1624
- if (input.apiId !== undefined) {
1625
- const labelValue = input.apiId;
1626
- if (labelValue.length <= 0) {
1627
- throw new Error("Empty value provided for input HTTP label: apiId.");
1628
- }
1629
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1630
- }
1631
- else {
1632
- throw new Error("No value provided for input HTTP label: apiId.");
1633
- }
1634
- if (input.typeName !== undefined) {
1635
- const labelValue = input.typeName;
1636
- if (labelValue.length <= 0) {
1637
- throw new Error("Empty value provided for input HTTP label: typeName.");
1638
- }
1639
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1640
- }
1641
- else {
1642
- throw new Error("No value provided for input HTTP label: typeName.");
1643
- }
1644
- if (input.fieldName !== undefined) {
1645
- const labelValue = input.fieldName;
1646
- if (labelValue.length <= 0) {
1647
- throw new Error("Empty value provided for input HTTP label: fieldName.");
1648
- }
1649
- resolvedPath = resolvedPath.replace("{fieldName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1650
- }
1651
- else {
1652
- throw new Error("No value provided for input HTTP label: fieldName.");
1653
- }
1106
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1107
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
1108
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "fieldName", () => input.fieldName, "{fieldName}", false);
1654
1109
  let body;
1655
1110
  body = JSON.stringify({
1656
1111
  ...(input.cachingConfig != null && {
@@ -1683,26 +1138,8 @@ const serializeAws_restJson1UpdateTypeCommand = async (input, context) => {
1683
1138
  "content-type": "application/json",
1684
1139
  };
1685
1140
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types/{typeName}";
1686
- if (input.apiId !== undefined) {
1687
- const labelValue = input.apiId;
1688
- if (labelValue.length <= 0) {
1689
- throw new Error("Empty value provided for input HTTP label: apiId.");
1690
- }
1691
- resolvedPath = resolvedPath.replace("{apiId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1692
- }
1693
- else {
1694
- throw new Error("No value provided for input HTTP label: apiId.");
1695
- }
1696
- if (input.typeName !== undefined) {
1697
- const labelValue = input.typeName;
1698
- if (labelValue.length <= 0) {
1699
- throw new Error("Empty value provided for input HTTP label: typeName.");
1700
- }
1701
- resolvedPath = resolvedPath.replace("{typeName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
1702
- }
1703
- else {
1704
- throw new Error("No value provided for input HTTP label: typeName.");
1705
- }
1141
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "apiId", () => input.apiId, "{apiId}", false);
1142
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "typeName", () => input.typeName, "{typeName}", false);
1706
1143
  let body;
1707
1144
  body = JSON.stringify({
1708
1145
  ...(input.definition != null && { definition: input.definition }),
@@ -1723,15 +1160,14 @@ const deserializeAws_restJson1AssociateApiCommand = async (output, context) => {
1723
1160
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1724
1161
  return deserializeAws_restJson1AssociateApiCommandError(output, context);
1725
1162
  }
1726
- const contents = {
1163
+ const contents = map({
1727
1164
  $metadata: deserializeMetadata(output),
1728
- apiAssociation: undefined,
1729
- };
1165
+ });
1730
1166
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1731
- if (data.apiAssociation !== undefined && data.apiAssociation !== null) {
1167
+ if (data.apiAssociation != null) {
1732
1168
  contents.apiAssociation = deserializeAws_restJson1ApiAssociation(data.apiAssociation, context);
1733
1169
  }
1734
- return Promise.resolve(contents);
1170
+ return contents;
1735
1171
  };
1736
1172
  exports.deserializeAws_restJson1AssociateApiCommand = deserializeAws_restJson1AssociateApiCommand;
1737
1173
  const deserializeAws_restJson1AssociateApiCommandError = async (output, context) => {
@@ -1739,7 +1175,6 @@ const deserializeAws_restJson1AssociateApiCommandError = async (output, context)
1739
1175
  ...output,
1740
1176
  body: await parseBody(output.body, context),
1741
1177
  };
1742
- let response;
1743
1178
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1744
1179
  switch (errorCode) {
1745
1180
  case "AccessDeniedException":
@@ -1756,29 +1191,26 @@ const deserializeAws_restJson1AssociateApiCommandError = async (output, context)
1756
1191
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1757
1192
  default:
1758
1193
  const parsedBody = parsedOutput.body;
1759
- const $metadata = deserializeMetadata(output);
1760
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1761
- response = new AppSyncServiceException_1.AppSyncServiceException({
1762
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1763
- $fault: "client",
1764
- $metadata,
1194
+ (0, smithy_client_1.throwDefaultError)({
1195
+ output,
1196
+ parsedBody,
1197
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1198
+ errorCode,
1765
1199
  });
1766
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1767
1200
  }
1768
1201
  };
1769
1202
  const deserializeAws_restJson1CreateApiCacheCommand = async (output, context) => {
1770
1203
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1771
1204
  return deserializeAws_restJson1CreateApiCacheCommandError(output, context);
1772
1205
  }
1773
- const contents = {
1206
+ const contents = map({
1774
1207
  $metadata: deserializeMetadata(output),
1775
- apiCache: undefined,
1776
- };
1208
+ });
1777
1209
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1778
- if (data.apiCache !== undefined && data.apiCache !== null) {
1210
+ if (data.apiCache != null) {
1779
1211
  contents.apiCache = deserializeAws_restJson1ApiCache(data.apiCache, context);
1780
1212
  }
1781
- return Promise.resolve(contents);
1213
+ return contents;
1782
1214
  };
1783
1215
  exports.deserializeAws_restJson1CreateApiCacheCommand = deserializeAws_restJson1CreateApiCacheCommand;
1784
1216
  const deserializeAws_restJson1CreateApiCacheCommandError = async (output, context) => {
@@ -1786,7 +1218,6 @@ const deserializeAws_restJson1CreateApiCacheCommandError = async (output, contex
1786
1218
  ...output,
1787
1219
  body: await parseBody(output.body, context),
1788
1220
  };
1789
- let response;
1790
1221
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1791
1222
  switch (errorCode) {
1792
1223
  case "BadRequestException":
@@ -1806,29 +1237,26 @@ const deserializeAws_restJson1CreateApiCacheCommandError = async (output, contex
1806
1237
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1807
1238
  default:
1808
1239
  const parsedBody = parsedOutput.body;
1809
- const $metadata = deserializeMetadata(output);
1810
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1811
- response = new AppSyncServiceException_1.AppSyncServiceException({
1812
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1813
- $fault: "client",
1814
- $metadata,
1240
+ (0, smithy_client_1.throwDefaultError)({
1241
+ output,
1242
+ parsedBody,
1243
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1244
+ errorCode,
1815
1245
  });
1816
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1817
1246
  }
1818
1247
  };
1819
1248
  const deserializeAws_restJson1CreateApiKeyCommand = async (output, context) => {
1820
1249
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1821
1250
  return deserializeAws_restJson1CreateApiKeyCommandError(output, context);
1822
1251
  }
1823
- const contents = {
1252
+ const contents = map({
1824
1253
  $metadata: deserializeMetadata(output),
1825
- apiKey: undefined,
1826
- };
1254
+ });
1827
1255
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1828
- if (data.apiKey !== undefined && data.apiKey !== null) {
1256
+ if (data.apiKey != null) {
1829
1257
  contents.apiKey = deserializeAws_restJson1ApiKey(data.apiKey, context);
1830
1258
  }
1831
- return Promise.resolve(contents);
1259
+ return contents;
1832
1260
  };
1833
1261
  exports.deserializeAws_restJson1CreateApiKeyCommand = deserializeAws_restJson1CreateApiKeyCommand;
1834
1262
  const deserializeAws_restJson1CreateApiKeyCommandError = async (output, context) => {
@@ -1836,7 +1264,6 @@ const deserializeAws_restJson1CreateApiKeyCommandError = async (output, context)
1836
1264
  ...output,
1837
1265
  body: await parseBody(output.body, context),
1838
1266
  };
1839
- let response;
1840
1267
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1841
1268
  switch (errorCode) {
1842
1269
  case "ApiKeyLimitExceededException":
@@ -1862,29 +1289,26 @@ const deserializeAws_restJson1CreateApiKeyCommandError = async (output, context)
1862
1289
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1863
1290
  default:
1864
1291
  const parsedBody = parsedOutput.body;
1865
- const $metadata = deserializeMetadata(output);
1866
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1867
- response = new AppSyncServiceException_1.AppSyncServiceException({
1868
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1869
- $fault: "client",
1870
- $metadata,
1292
+ (0, smithy_client_1.throwDefaultError)({
1293
+ output,
1294
+ parsedBody,
1295
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1296
+ errorCode,
1871
1297
  });
1872
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1873
1298
  }
1874
1299
  };
1875
1300
  const deserializeAws_restJson1CreateDataSourceCommand = async (output, context) => {
1876
1301
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1877
1302
  return deserializeAws_restJson1CreateDataSourceCommandError(output, context);
1878
1303
  }
1879
- const contents = {
1304
+ const contents = map({
1880
1305
  $metadata: deserializeMetadata(output),
1881
- dataSource: undefined,
1882
- };
1306
+ });
1883
1307
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1884
- if (data.dataSource !== undefined && data.dataSource !== null) {
1308
+ if (data.dataSource != null) {
1885
1309
  contents.dataSource = deserializeAws_restJson1DataSource(data.dataSource, context);
1886
1310
  }
1887
- return Promise.resolve(contents);
1311
+ return contents;
1888
1312
  };
1889
1313
  exports.deserializeAws_restJson1CreateDataSourceCommand = deserializeAws_restJson1CreateDataSourceCommand;
1890
1314
  const deserializeAws_restJson1CreateDataSourceCommandError = async (output, context) => {
@@ -1892,7 +1316,6 @@ const deserializeAws_restJson1CreateDataSourceCommandError = async (output, cont
1892
1316
  ...output,
1893
1317
  body: await parseBody(output.body, context),
1894
1318
  };
1895
- let response;
1896
1319
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1897
1320
  switch (errorCode) {
1898
1321
  case "BadRequestException":
@@ -1912,29 +1335,26 @@ const deserializeAws_restJson1CreateDataSourceCommandError = async (output, cont
1912
1335
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1913
1336
  default:
1914
1337
  const parsedBody = parsedOutput.body;
1915
- const $metadata = deserializeMetadata(output);
1916
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1917
- response = new AppSyncServiceException_1.AppSyncServiceException({
1918
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1919
- $fault: "client",
1920
- $metadata,
1338
+ (0, smithy_client_1.throwDefaultError)({
1339
+ output,
1340
+ parsedBody,
1341
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1342
+ errorCode,
1921
1343
  });
1922
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1923
1344
  }
1924
1345
  };
1925
1346
  const deserializeAws_restJson1CreateDomainNameCommand = async (output, context) => {
1926
1347
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1927
1348
  return deserializeAws_restJson1CreateDomainNameCommandError(output, context);
1928
1349
  }
1929
- const contents = {
1350
+ const contents = map({
1930
1351
  $metadata: deserializeMetadata(output),
1931
- domainNameConfig: undefined,
1932
- };
1352
+ });
1933
1353
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1934
- if (data.domainNameConfig !== undefined && data.domainNameConfig !== null) {
1354
+ if (data.domainNameConfig != null) {
1935
1355
  contents.domainNameConfig = deserializeAws_restJson1DomainNameConfig(data.domainNameConfig, context);
1936
1356
  }
1937
- return Promise.resolve(contents);
1357
+ return contents;
1938
1358
  };
1939
1359
  exports.deserializeAws_restJson1CreateDomainNameCommand = deserializeAws_restJson1CreateDomainNameCommand;
1940
1360
  const deserializeAws_restJson1CreateDomainNameCommandError = async (output, context) => {
@@ -1942,7 +1362,6 @@ const deserializeAws_restJson1CreateDomainNameCommandError = async (output, cont
1942
1362
  ...output,
1943
1363
  body: await parseBody(output.body, context),
1944
1364
  };
1945
- let response;
1946
1365
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1947
1366
  switch (errorCode) {
1948
1367
  case "AccessDeniedException":
@@ -1956,29 +1375,26 @@ const deserializeAws_restJson1CreateDomainNameCommandError = async (output, cont
1956
1375
  throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1957
1376
  default:
1958
1377
  const parsedBody = parsedOutput.body;
1959
- const $metadata = deserializeMetadata(output);
1960
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1961
- response = new AppSyncServiceException_1.AppSyncServiceException({
1962
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1963
- $fault: "client",
1964
- $metadata,
1378
+ (0, smithy_client_1.throwDefaultError)({
1379
+ output,
1380
+ parsedBody,
1381
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1382
+ errorCode,
1965
1383
  });
1966
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1967
1384
  }
1968
1385
  };
1969
1386
  const deserializeAws_restJson1CreateFunctionCommand = async (output, context) => {
1970
1387
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1971
1388
  return deserializeAws_restJson1CreateFunctionCommandError(output, context);
1972
1389
  }
1973
- const contents = {
1390
+ const contents = map({
1974
1391
  $metadata: deserializeMetadata(output),
1975
- functionConfiguration: undefined,
1976
- };
1392
+ });
1977
1393
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1978
- if (data.functionConfiguration !== undefined && data.functionConfiguration !== null) {
1394
+ if (data.functionConfiguration != null) {
1979
1395
  contents.functionConfiguration = deserializeAws_restJson1FunctionConfiguration(data.functionConfiguration, context);
1980
1396
  }
1981
- return Promise.resolve(contents);
1397
+ return contents;
1982
1398
  };
1983
1399
  exports.deserializeAws_restJson1CreateFunctionCommand = deserializeAws_restJson1CreateFunctionCommand;
1984
1400
  const deserializeAws_restJson1CreateFunctionCommandError = async (output, context) => {
@@ -1986,7 +1402,6 @@ const deserializeAws_restJson1CreateFunctionCommandError = async (output, contex
1986
1402
  ...output,
1987
1403
  body: await parseBody(output.body, context),
1988
1404
  };
1989
- let response;
1990
1405
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1991
1406
  switch (errorCode) {
1992
1407
  case "ConcurrentModificationException":
@@ -2003,29 +1418,26 @@ const deserializeAws_restJson1CreateFunctionCommandError = async (output, contex
2003
1418
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2004
1419
  default:
2005
1420
  const parsedBody = parsedOutput.body;
2006
- const $metadata = deserializeMetadata(output);
2007
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2008
- response = new AppSyncServiceException_1.AppSyncServiceException({
2009
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2010
- $fault: "client",
2011
- $metadata,
1421
+ (0, smithy_client_1.throwDefaultError)({
1422
+ output,
1423
+ parsedBody,
1424
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1425
+ errorCode,
2012
1426
  });
2013
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2014
1427
  }
2015
1428
  };
2016
1429
  const deserializeAws_restJson1CreateGraphqlApiCommand = async (output, context) => {
2017
1430
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2018
1431
  return deserializeAws_restJson1CreateGraphqlApiCommandError(output, context);
2019
1432
  }
2020
- const contents = {
1433
+ const contents = map({
2021
1434
  $metadata: deserializeMetadata(output),
2022
- graphqlApi: undefined,
2023
- };
1435
+ });
2024
1436
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2025
- if (data.graphqlApi !== undefined && data.graphqlApi !== null) {
1437
+ if (data.graphqlApi != null) {
2026
1438
  contents.graphqlApi = deserializeAws_restJson1GraphqlApi(data.graphqlApi, context);
2027
1439
  }
2028
- return Promise.resolve(contents);
1440
+ return contents;
2029
1441
  };
2030
1442
  exports.deserializeAws_restJson1CreateGraphqlApiCommand = deserializeAws_restJson1CreateGraphqlApiCommand;
2031
1443
  const deserializeAws_restJson1CreateGraphqlApiCommandError = async (output, context) => {
@@ -2033,7 +1445,6 @@ const deserializeAws_restJson1CreateGraphqlApiCommandError = async (output, cont
2033
1445
  ...output,
2034
1446
  body: await parseBody(output.body, context),
2035
1447
  };
2036
- let response;
2037
1448
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2038
1449
  switch (errorCode) {
2039
1450
  case "ApiLimitExceededException":
@@ -2056,29 +1467,26 @@ const deserializeAws_restJson1CreateGraphqlApiCommandError = async (output, cont
2056
1467
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2057
1468
  default:
2058
1469
  const parsedBody = parsedOutput.body;
2059
- const $metadata = deserializeMetadata(output);
2060
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2061
- response = new AppSyncServiceException_1.AppSyncServiceException({
2062
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2063
- $fault: "client",
2064
- $metadata,
1470
+ (0, smithy_client_1.throwDefaultError)({
1471
+ output,
1472
+ parsedBody,
1473
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1474
+ errorCode,
2065
1475
  });
2066
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2067
1476
  }
2068
1477
  };
2069
1478
  const deserializeAws_restJson1CreateResolverCommand = async (output, context) => {
2070
1479
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2071
1480
  return deserializeAws_restJson1CreateResolverCommandError(output, context);
2072
1481
  }
2073
- const contents = {
1482
+ const contents = map({
2074
1483
  $metadata: deserializeMetadata(output),
2075
- resolver: undefined,
2076
- };
1484
+ });
2077
1485
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2078
- if (data.resolver !== undefined && data.resolver !== null) {
1486
+ if (data.resolver != null) {
2079
1487
  contents.resolver = deserializeAws_restJson1Resolver(data.resolver, context);
2080
1488
  }
2081
- return Promise.resolve(contents);
1489
+ return contents;
2082
1490
  };
2083
1491
  exports.deserializeAws_restJson1CreateResolverCommand = deserializeAws_restJson1CreateResolverCommand;
2084
1492
  const deserializeAws_restJson1CreateResolverCommandError = async (output, context) => {
@@ -2086,7 +1494,6 @@ const deserializeAws_restJson1CreateResolverCommandError = async (output, contex
2086
1494
  ...output,
2087
1495
  body: await parseBody(output.body, context),
2088
1496
  };
2089
- let response;
2090
1497
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2091
1498
  switch (errorCode) {
2092
1499
  case "ConcurrentModificationException":
@@ -2103,29 +1510,26 @@ const deserializeAws_restJson1CreateResolverCommandError = async (output, contex
2103
1510
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2104
1511
  default:
2105
1512
  const parsedBody = parsedOutput.body;
2106
- const $metadata = deserializeMetadata(output);
2107
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2108
- response = new AppSyncServiceException_1.AppSyncServiceException({
2109
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2110
- $fault: "client",
2111
- $metadata,
1513
+ (0, smithy_client_1.throwDefaultError)({
1514
+ output,
1515
+ parsedBody,
1516
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1517
+ errorCode,
2112
1518
  });
2113
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2114
1519
  }
2115
1520
  };
2116
1521
  const deserializeAws_restJson1CreateTypeCommand = async (output, context) => {
2117
1522
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2118
1523
  return deserializeAws_restJson1CreateTypeCommandError(output, context);
2119
1524
  }
2120
- const contents = {
1525
+ const contents = map({
2121
1526
  $metadata: deserializeMetadata(output),
2122
- type: undefined,
2123
- };
1527
+ });
2124
1528
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2125
- if (data.type !== undefined && data.type !== null) {
1529
+ if (data.type != null) {
2126
1530
  contents.type = deserializeAws_restJson1Type(data.type, context);
2127
1531
  }
2128
- return Promise.resolve(contents);
1532
+ return contents;
2129
1533
  };
2130
1534
  exports.deserializeAws_restJson1CreateTypeCommand = deserializeAws_restJson1CreateTypeCommand;
2131
1535
  const deserializeAws_restJson1CreateTypeCommandError = async (output, context) => {
@@ -2133,7 +1537,6 @@ const deserializeAws_restJson1CreateTypeCommandError = async (output, context) =
2133
1537
  ...output,
2134
1538
  body: await parseBody(output.body, context),
2135
1539
  };
2136
- let response;
2137
1540
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2138
1541
  switch (errorCode) {
2139
1542
  case "BadRequestException":
@@ -2153,25 +1556,23 @@ const deserializeAws_restJson1CreateTypeCommandError = async (output, context) =
2153
1556
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2154
1557
  default:
2155
1558
  const parsedBody = parsedOutput.body;
2156
- const $metadata = deserializeMetadata(output);
2157
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2158
- response = new AppSyncServiceException_1.AppSyncServiceException({
2159
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2160
- $fault: "client",
2161
- $metadata,
1559
+ (0, smithy_client_1.throwDefaultError)({
1560
+ output,
1561
+ parsedBody,
1562
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1563
+ errorCode,
2162
1564
  });
2163
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2164
1565
  }
2165
1566
  };
2166
1567
  const deserializeAws_restJson1DeleteApiCacheCommand = async (output, context) => {
2167
1568
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2168
1569
  return deserializeAws_restJson1DeleteApiCacheCommandError(output, context);
2169
1570
  }
2170
- const contents = {
1571
+ const contents = map({
2171
1572
  $metadata: deserializeMetadata(output),
2172
- };
1573
+ });
2173
1574
  await collectBody(output.body, context);
2174
- return Promise.resolve(contents);
1575
+ return contents;
2175
1576
  };
2176
1577
  exports.deserializeAws_restJson1DeleteApiCacheCommand = deserializeAws_restJson1DeleteApiCacheCommand;
2177
1578
  const deserializeAws_restJson1DeleteApiCacheCommandError = async (output, context) => {
@@ -2179,7 +1580,6 @@ const deserializeAws_restJson1DeleteApiCacheCommandError = async (output, contex
2179
1580
  ...output,
2180
1581
  body: await parseBody(output.body, context),
2181
1582
  };
2182
- let response;
2183
1583
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2184
1584
  switch (errorCode) {
2185
1585
  case "BadRequestException":
@@ -2199,25 +1599,23 @@ const deserializeAws_restJson1DeleteApiCacheCommandError = async (output, contex
2199
1599
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2200
1600
  default:
2201
1601
  const parsedBody = parsedOutput.body;
2202
- const $metadata = deserializeMetadata(output);
2203
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2204
- response = new AppSyncServiceException_1.AppSyncServiceException({
2205
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2206
- $fault: "client",
2207
- $metadata,
1602
+ (0, smithy_client_1.throwDefaultError)({
1603
+ output,
1604
+ parsedBody,
1605
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1606
+ errorCode,
2208
1607
  });
2209
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2210
1608
  }
2211
1609
  };
2212
1610
  const deserializeAws_restJson1DeleteApiKeyCommand = async (output, context) => {
2213
1611
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2214
1612
  return deserializeAws_restJson1DeleteApiKeyCommandError(output, context);
2215
1613
  }
2216
- const contents = {
1614
+ const contents = map({
2217
1615
  $metadata: deserializeMetadata(output),
2218
- };
1616
+ });
2219
1617
  await collectBody(output.body, context);
2220
- return Promise.resolve(contents);
1618
+ return contents;
2221
1619
  };
2222
1620
  exports.deserializeAws_restJson1DeleteApiKeyCommand = deserializeAws_restJson1DeleteApiKeyCommand;
2223
1621
  const deserializeAws_restJson1DeleteApiKeyCommandError = async (output, context) => {
@@ -2225,7 +1623,6 @@ const deserializeAws_restJson1DeleteApiKeyCommandError = async (output, context)
2225
1623
  ...output,
2226
1624
  body: await parseBody(output.body, context),
2227
1625
  };
2228
- let response;
2229
1626
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2230
1627
  switch (errorCode) {
2231
1628
  case "BadRequestException":
@@ -2242,25 +1639,23 @@ const deserializeAws_restJson1DeleteApiKeyCommandError = async (output, context)
2242
1639
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2243
1640
  default:
2244
1641
  const parsedBody = parsedOutput.body;
2245
- const $metadata = deserializeMetadata(output);
2246
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2247
- response = new AppSyncServiceException_1.AppSyncServiceException({
2248
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2249
- $fault: "client",
2250
- $metadata,
1642
+ (0, smithy_client_1.throwDefaultError)({
1643
+ output,
1644
+ parsedBody,
1645
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1646
+ errorCode,
2251
1647
  });
2252
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2253
1648
  }
2254
1649
  };
2255
1650
  const deserializeAws_restJson1DeleteDataSourceCommand = async (output, context) => {
2256
1651
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2257
1652
  return deserializeAws_restJson1DeleteDataSourceCommandError(output, context);
2258
1653
  }
2259
- const contents = {
1654
+ const contents = map({
2260
1655
  $metadata: deserializeMetadata(output),
2261
- };
1656
+ });
2262
1657
  await collectBody(output.body, context);
2263
- return Promise.resolve(contents);
1658
+ return contents;
2264
1659
  };
2265
1660
  exports.deserializeAws_restJson1DeleteDataSourceCommand = deserializeAws_restJson1DeleteDataSourceCommand;
2266
1661
  const deserializeAws_restJson1DeleteDataSourceCommandError = async (output, context) => {
@@ -2268,7 +1663,6 @@ const deserializeAws_restJson1DeleteDataSourceCommandError = async (output, cont
2268
1663
  ...output,
2269
1664
  body: await parseBody(output.body, context),
2270
1665
  };
2271
- let response;
2272
1666
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2273
1667
  switch (errorCode) {
2274
1668
  case "BadRequestException":
@@ -2288,25 +1682,23 @@ const deserializeAws_restJson1DeleteDataSourceCommandError = async (output, cont
2288
1682
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2289
1683
  default:
2290
1684
  const parsedBody = parsedOutput.body;
2291
- const $metadata = deserializeMetadata(output);
2292
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2293
- response = new AppSyncServiceException_1.AppSyncServiceException({
2294
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2295
- $fault: "client",
2296
- $metadata,
1685
+ (0, smithy_client_1.throwDefaultError)({
1686
+ output,
1687
+ parsedBody,
1688
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1689
+ errorCode,
2297
1690
  });
2298
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2299
1691
  }
2300
1692
  };
2301
1693
  const deserializeAws_restJson1DeleteDomainNameCommand = async (output, context) => {
2302
1694
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2303
1695
  return deserializeAws_restJson1DeleteDomainNameCommandError(output, context);
2304
1696
  }
2305
- const contents = {
1697
+ const contents = map({
2306
1698
  $metadata: deserializeMetadata(output),
2307
- };
1699
+ });
2308
1700
  await collectBody(output.body, context);
2309
- return Promise.resolve(contents);
1701
+ return contents;
2310
1702
  };
2311
1703
  exports.deserializeAws_restJson1DeleteDomainNameCommand = deserializeAws_restJson1DeleteDomainNameCommand;
2312
1704
  const deserializeAws_restJson1DeleteDomainNameCommandError = async (output, context) => {
@@ -2314,7 +1706,6 @@ const deserializeAws_restJson1DeleteDomainNameCommandError = async (output, cont
2314
1706
  ...output,
2315
1707
  body: await parseBody(output.body, context),
2316
1708
  };
2317
- let response;
2318
1709
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2319
1710
  switch (errorCode) {
2320
1711
  case "AccessDeniedException":
@@ -2334,25 +1725,23 @@ const deserializeAws_restJson1DeleteDomainNameCommandError = async (output, cont
2334
1725
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2335
1726
  default:
2336
1727
  const parsedBody = parsedOutput.body;
2337
- const $metadata = deserializeMetadata(output);
2338
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2339
- response = new AppSyncServiceException_1.AppSyncServiceException({
2340
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2341
- $fault: "client",
2342
- $metadata,
1728
+ (0, smithy_client_1.throwDefaultError)({
1729
+ output,
1730
+ parsedBody,
1731
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1732
+ errorCode,
2343
1733
  });
2344
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2345
1734
  }
2346
1735
  };
2347
1736
  const deserializeAws_restJson1DeleteFunctionCommand = async (output, context) => {
2348
1737
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2349
1738
  return deserializeAws_restJson1DeleteFunctionCommandError(output, context);
2350
1739
  }
2351
- const contents = {
1740
+ const contents = map({
2352
1741
  $metadata: deserializeMetadata(output),
2353
- };
1742
+ });
2354
1743
  await collectBody(output.body, context);
2355
- return Promise.resolve(contents);
1744
+ return contents;
2356
1745
  };
2357
1746
  exports.deserializeAws_restJson1DeleteFunctionCommand = deserializeAws_restJson1DeleteFunctionCommand;
2358
1747
  const deserializeAws_restJson1DeleteFunctionCommandError = async (output, context) => {
@@ -2360,7 +1749,6 @@ const deserializeAws_restJson1DeleteFunctionCommandError = async (output, contex
2360
1749
  ...output,
2361
1750
  body: await parseBody(output.body, context),
2362
1751
  };
2363
- let response;
2364
1752
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2365
1753
  switch (errorCode) {
2366
1754
  case "ConcurrentModificationException":
@@ -2377,25 +1765,23 @@ const deserializeAws_restJson1DeleteFunctionCommandError = async (output, contex
2377
1765
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2378
1766
  default:
2379
1767
  const parsedBody = parsedOutput.body;
2380
- const $metadata = deserializeMetadata(output);
2381
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2382
- response = new AppSyncServiceException_1.AppSyncServiceException({
2383
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2384
- $fault: "client",
2385
- $metadata,
1768
+ (0, smithy_client_1.throwDefaultError)({
1769
+ output,
1770
+ parsedBody,
1771
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1772
+ errorCode,
2386
1773
  });
2387
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2388
1774
  }
2389
1775
  };
2390
1776
  const deserializeAws_restJson1DeleteGraphqlApiCommand = async (output, context) => {
2391
1777
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2392
1778
  return deserializeAws_restJson1DeleteGraphqlApiCommandError(output, context);
2393
1779
  }
2394
- const contents = {
1780
+ const contents = map({
2395
1781
  $metadata: deserializeMetadata(output),
2396
- };
1782
+ });
2397
1783
  await collectBody(output.body, context);
2398
- return Promise.resolve(contents);
1784
+ return contents;
2399
1785
  };
2400
1786
  exports.deserializeAws_restJson1DeleteGraphqlApiCommand = deserializeAws_restJson1DeleteGraphqlApiCommand;
2401
1787
  const deserializeAws_restJson1DeleteGraphqlApiCommandError = async (output, context) => {
@@ -2403,7 +1789,6 @@ const deserializeAws_restJson1DeleteGraphqlApiCommandError = async (output, cont
2403
1789
  ...output,
2404
1790
  body: await parseBody(output.body, context),
2405
1791
  };
2406
- let response;
2407
1792
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2408
1793
  switch (errorCode) {
2409
1794
  case "AccessDeniedException":
@@ -2426,25 +1811,23 @@ const deserializeAws_restJson1DeleteGraphqlApiCommandError = async (output, cont
2426
1811
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2427
1812
  default:
2428
1813
  const parsedBody = parsedOutput.body;
2429
- const $metadata = deserializeMetadata(output);
2430
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2431
- response = new AppSyncServiceException_1.AppSyncServiceException({
2432
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2433
- $fault: "client",
2434
- $metadata,
1814
+ (0, smithy_client_1.throwDefaultError)({
1815
+ output,
1816
+ parsedBody,
1817
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1818
+ errorCode,
2435
1819
  });
2436
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2437
1820
  }
2438
1821
  };
2439
1822
  const deserializeAws_restJson1DeleteResolverCommand = async (output, context) => {
2440
1823
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2441
1824
  return deserializeAws_restJson1DeleteResolverCommandError(output, context);
2442
1825
  }
2443
- const contents = {
1826
+ const contents = map({
2444
1827
  $metadata: deserializeMetadata(output),
2445
- };
1828
+ });
2446
1829
  await collectBody(output.body, context);
2447
- return Promise.resolve(contents);
1830
+ return contents;
2448
1831
  };
2449
1832
  exports.deserializeAws_restJson1DeleteResolverCommand = deserializeAws_restJson1DeleteResolverCommand;
2450
1833
  const deserializeAws_restJson1DeleteResolverCommandError = async (output, context) => {
@@ -2452,7 +1835,6 @@ const deserializeAws_restJson1DeleteResolverCommandError = async (output, contex
2452
1835
  ...output,
2453
1836
  body: await parseBody(output.body, context),
2454
1837
  };
2455
- let response;
2456
1838
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2457
1839
  switch (errorCode) {
2458
1840
  case "ConcurrentModificationException":
@@ -2469,25 +1851,23 @@ const deserializeAws_restJson1DeleteResolverCommandError = async (output, contex
2469
1851
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2470
1852
  default:
2471
1853
  const parsedBody = parsedOutput.body;
2472
- const $metadata = deserializeMetadata(output);
2473
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2474
- response = new AppSyncServiceException_1.AppSyncServiceException({
2475
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2476
- $fault: "client",
2477
- $metadata,
1854
+ (0, smithy_client_1.throwDefaultError)({
1855
+ output,
1856
+ parsedBody,
1857
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1858
+ errorCode,
2478
1859
  });
2479
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2480
1860
  }
2481
1861
  };
2482
1862
  const deserializeAws_restJson1DeleteTypeCommand = async (output, context) => {
2483
1863
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2484
1864
  return deserializeAws_restJson1DeleteTypeCommandError(output, context);
2485
1865
  }
2486
- const contents = {
1866
+ const contents = map({
2487
1867
  $metadata: deserializeMetadata(output),
2488
- };
1868
+ });
2489
1869
  await collectBody(output.body, context);
2490
- return Promise.resolve(contents);
1870
+ return contents;
2491
1871
  };
2492
1872
  exports.deserializeAws_restJson1DeleteTypeCommand = deserializeAws_restJson1DeleteTypeCommand;
2493
1873
  const deserializeAws_restJson1DeleteTypeCommandError = async (output, context) => {
@@ -2495,7 +1875,6 @@ const deserializeAws_restJson1DeleteTypeCommandError = async (output, context) =
2495
1875
  ...output,
2496
1876
  body: await parseBody(output.body, context),
2497
1877
  };
2498
- let response;
2499
1878
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2500
1879
  switch (errorCode) {
2501
1880
  case "BadRequestException":
@@ -2515,25 +1894,23 @@ const deserializeAws_restJson1DeleteTypeCommandError = async (output, context) =
2515
1894
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2516
1895
  default:
2517
1896
  const parsedBody = parsedOutput.body;
2518
- const $metadata = deserializeMetadata(output);
2519
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2520
- response = new AppSyncServiceException_1.AppSyncServiceException({
2521
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2522
- $fault: "client",
2523
- $metadata,
1897
+ (0, smithy_client_1.throwDefaultError)({
1898
+ output,
1899
+ parsedBody,
1900
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1901
+ errorCode,
2524
1902
  });
2525
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2526
1903
  }
2527
1904
  };
2528
1905
  const deserializeAws_restJson1DisassociateApiCommand = async (output, context) => {
2529
1906
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2530
1907
  return deserializeAws_restJson1DisassociateApiCommandError(output, context);
2531
1908
  }
2532
- const contents = {
1909
+ const contents = map({
2533
1910
  $metadata: deserializeMetadata(output),
2534
- };
1911
+ });
2535
1912
  await collectBody(output.body, context);
2536
- return Promise.resolve(contents);
1913
+ return contents;
2537
1914
  };
2538
1915
  exports.deserializeAws_restJson1DisassociateApiCommand = deserializeAws_restJson1DisassociateApiCommand;
2539
1916
  const deserializeAws_restJson1DisassociateApiCommandError = async (output, context) => {
@@ -2541,7 +1918,6 @@ const deserializeAws_restJson1DisassociateApiCommandError = async (output, conte
2541
1918
  ...output,
2542
1919
  body: await parseBody(output.body, context),
2543
1920
  };
2544
- let response;
2545
1921
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2546
1922
  switch (errorCode) {
2547
1923
  case "AccessDeniedException":
@@ -2561,25 +1937,66 @@ const deserializeAws_restJson1DisassociateApiCommandError = async (output, conte
2561
1937
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2562
1938
  default:
2563
1939
  const parsedBody = parsedOutput.body;
2564
- const $metadata = deserializeMetadata(output);
2565
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2566
- response = new AppSyncServiceException_1.AppSyncServiceException({
2567
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2568
- $fault: "client",
2569
- $metadata,
1940
+ (0, smithy_client_1.throwDefaultError)({
1941
+ output,
1942
+ parsedBody,
1943
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1944
+ errorCode,
1945
+ });
1946
+ }
1947
+ };
1948
+ const deserializeAws_restJson1EvaluateMappingTemplateCommand = async (output, context) => {
1949
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1950
+ return deserializeAws_restJson1EvaluateMappingTemplateCommandError(output, context);
1951
+ }
1952
+ const contents = map({
1953
+ $metadata: deserializeMetadata(output),
1954
+ });
1955
+ const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1956
+ if (data.error != null) {
1957
+ contents.error = deserializeAws_restJson1ErrorDetail(data.error, context);
1958
+ }
1959
+ if (data.evaluationResult != null) {
1960
+ contents.evaluationResult = (0, smithy_client_1.expectString)(data.evaluationResult);
1961
+ }
1962
+ return contents;
1963
+ };
1964
+ exports.deserializeAws_restJson1EvaluateMappingTemplateCommand = deserializeAws_restJson1EvaluateMappingTemplateCommand;
1965
+ const deserializeAws_restJson1EvaluateMappingTemplateCommandError = async (output, context) => {
1966
+ const parsedOutput = {
1967
+ ...output,
1968
+ body: await parseBody(output.body, context),
1969
+ };
1970
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1971
+ switch (errorCode) {
1972
+ case "AccessDeniedException":
1973
+ case "com.amazonaws.appsync#AccessDeniedException":
1974
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1975
+ case "BadRequestException":
1976
+ case "com.amazonaws.appsync#BadRequestException":
1977
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1978
+ case "InternalFailureException":
1979
+ case "com.amazonaws.appsync#InternalFailureException":
1980
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1981
+ default:
1982
+ const parsedBody = parsedOutput.body;
1983
+ (0, smithy_client_1.throwDefaultError)({
1984
+ output,
1985
+ parsedBody,
1986
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
1987
+ errorCode,
2570
1988
  });
2571
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2572
1989
  }
2573
1990
  };
2574
1991
  const deserializeAws_restJson1FlushApiCacheCommand = async (output, context) => {
2575
1992
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2576
1993
  return deserializeAws_restJson1FlushApiCacheCommandError(output, context);
2577
1994
  }
2578
- const contents = {
1995
+ const contents = map({
2579
1996
  $metadata: deserializeMetadata(output),
2580
- };
1997
+ });
2581
1998
  await collectBody(output.body, context);
2582
- return Promise.resolve(contents);
1999
+ return contents;
2583
2000
  };
2584
2001
  exports.deserializeAws_restJson1FlushApiCacheCommand = deserializeAws_restJson1FlushApiCacheCommand;
2585
2002
  const deserializeAws_restJson1FlushApiCacheCommandError = async (output, context) => {
@@ -2587,7 +2004,6 @@ const deserializeAws_restJson1FlushApiCacheCommandError = async (output, context
2587
2004
  ...output,
2588
2005
  body: await parseBody(output.body, context),
2589
2006
  };
2590
- let response;
2591
2007
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2592
2008
  switch (errorCode) {
2593
2009
  case "BadRequestException":
@@ -2607,29 +2023,26 @@ const deserializeAws_restJson1FlushApiCacheCommandError = async (output, context
2607
2023
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2608
2024
  default:
2609
2025
  const parsedBody = parsedOutput.body;
2610
- const $metadata = deserializeMetadata(output);
2611
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2612
- response = new AppSyncServiceException_1.AppSyncServiceException({
2613
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2614
- $fault: "client",
2615
- $metadata,
2026
+ (0, smithy_client_1.throwDefaultError)({
2027
+ output,
2028
+ parsedBody,
2029
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2030
+ errorCode,
2616
2031
  });
2617
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2618
2032
  }
2619
2033
  };
2620
2034
  const deserializeAws_restJson1GetApiAssociationCommand = async (output, context) => {
2621
2035
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2622
2036
  return deserializeAws_restJson1GetApiAssociationCommandError(output, context);
2623
2037
  }
2624
- const contents = {
2038
+ const contents = map({
2625
2039
  $metadata: deserializeMetadata(output),
2626
- apiAssociation: undefined,
2627
- };
2040
+ });
2628
2041
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2629
- if (data.apiAssociation !== undefined && data.apiAssociation !== null) {
2042
+ if (data.apiAssociation != null) {
2630
2043
  contents.apiAssociation = deserializeAws_restJson1ApiAssociation(data.apiAssociation, context);
2631
2044
  }
2632
- return Promise.resolve(contents);
2045
+ return contents;
2633
2046
  };
2634
2047
  exports.deserializeAws_restJson1GetApiAssociationCommand = deserializeAws_restJson1GetApiAssociationCommand;
2635
2048
  const deserializeAws_restJson1GetApiAssociationCommandError = async (output, context) => {
@@ -2637,7 +2050,6 @@ const deserializeAws_restJson1GetApiAssociationCommandError = async (output, con
2637
2050
  ...output,
2638
2051
  body: await parseBody(output.body, context),
2639
2052
  };
2640
- let response;
2641
2053
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2642
2054
  switch (errorCode) {
2643
2055
  case "AccessDeniedException":
@@ -2654,29 +2066,26 @@ const deserializeAws_restJson1GetApiAssociationCommandError = async (output, con
2654
2066
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2655
2067
  default:
2656
2068
  const parsedBody = parsedOutput.body;
2657
- const $metadata = deserializeMetadata(output);
2658
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2659
- response = new AppSyncServiceException_1.AppSyncServiceException({
2660
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2661
- $fault: "client",
2662
- $metadata,
2069
+ (0, smithy_client_1.throwDefaultError)({
2070
+ output,
2071
+ parsedBody,
2072
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2073
+ errorCode,
2663
2074
  });
2664
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2665
2075
  }
2666
2076
  };
2667
2077
  const deserializeAws_restJson1GetApiCacheCommand = async (output, context) => {
2668
2078
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2669
2079
  return deserializeAws_restJson1GetApiCacheCommandError(output, context);
2670
2080
  }
2671
- const contents = {
2081
+ const contents = map({
2672
2082
  $metadata: deserializeMetadata(output),
2673
- apiCache: undefined,
2674
- };
2083
+ });
2675
2084
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2676
- if (data.apiCache !== undefined && data.apiCache !== null) {
2085
+ if (data.apiCache != null) {
2677
2086
  contents.apiCache = deserializeAws_restJson1ApiCache(data.apiCache, context);
2678
2087
  }
2679
- return Promise.resolve(contents);
2088
+ return contents;
2680
2089
  };
2681
2090
  exports.deserializeAws_restJson1GetApiCacheCommand = deserializeAws_restJson1GetApiCacheCommand;
2682
2091
  const deserializeAws_restJson1GetApiCacheCommandError = async (output, context) => {
@@ -2684,7 +2093,6 @@ const deserializeAws_restJson1GetApiCacheCommandError = async (output, context)
2684
2093
  ...output,
2685
2094
  body: await parseBody(output.body, context),
2686
2095
  };
2687
- let response;
2688
2096
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2689
2097
  switch (errorCode) {
2690
2098
  case "BadRequestException":
@@ -2704,29 +2112,26 @@ const deserializeAws_restJson1GetApiCacheCommandError = async (output, context)
2704
2112
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2705
2113
  default:
2706
2114
  const parsedBody = parsedOutput.body;
2707
- const $metadata = deserializeMetadata(output);
2708
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2709
- response = new AppSyncServiceException_1.AppSyncServiceException({
2710
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2711
- $fault: "client",
2712
- $metadata,
2115
+ (0, smithy_client_1.throwDefaultError)({
2116
+ output,
2117
+ parsedBody,
2118
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2119
+ errorCode,
2713
2120
  });
2714
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2715
2121
  }
2716
2122
  };
2717
2123
  const deserializeAws_restJson1GetDataSourceCommand = async (output, context) => {
2718
2124
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2719
2125
  return deserializeAws_restJson1GetDataSourceCommandError(output, context);
2720
2126
  }
2721
- const contents = {
2127
+ const contents = map({
2722
2128
  $metadata: deserializeMetadata(output),
2723
- dataSource: undefined,
2724
- };
2129
+ });
2725
2130
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2726
- if (data.dataSource !== undefined && data.dataSource !== null) {
2131
+ if (data.dataSource != null) {
2727
2132
  contents.dataSource = deserializeAws_restJson1DataSource(data.dataSource, context);
2728
2133
  }
2729
- return Promise.resolve(contents);
2134
+ return contents;
2730
2135
  };
2731
2136
  exports.deserializeAws_restJson1GetDataSourceCommand = deserializeAws_restJson1GetDataSourceCommand;
2732
2137
  const deserializeAws_restJson1GetDataSourceCommandError = async (output, context) => {
@@ -2734,7 +2139,6 @@ const deserializeAws_restJson1GetDataSourceCommandError = async (output, context
2734
2139
  ...output,
2735
2140
  body: await parseBody(output.body, context),
2736
2141
  };
2737
- let response;
2738
2142
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2739
2143
  switch (errorCode) {
2740
2144
  case "BadRequestException":
@@ -2754,29 +2158,26 @@ const deserializeAws_restJson1GetDataSourceCommandError = async (output, context
2754
2158
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2755
2159
  default:
2756
2160
  const parsedBody = parsedOutput.body;
2757
- const $metadata = deserializeMetadata(output);
2758
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2759
- response = new AppSyncServiceException_1.AppSyncServiceException({
2760
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2761
- $fault: "client",
2762
- $metadata,
2161
+ (0, smithy_client_1.throwDefaultError)({
2162
+ output,
2163
+ parsedBody,
2164
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2165
+ errorCode,
2763
2166
  });
2764
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2765
2167
  }
2766
2168
  };
2767
2169
  const deserializeAws_restJson1GetDomainNameCommand = async (output, context) => {
2768
2170
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2769
2171
  return deserializeAws_restJson1GetDomainNameCommandError(output, context);
2770
2172
  }
2771
- const contents = {
2173
+ const contents = map({
2772
2174
  $metadata: deserializeMetadata(output),
2773
- domainNameConfig: undefined,
2774
- };
2175
+ });
2775
2176
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2776
- if (data.domainNameConfig !== undefined && data.domainNameConfig !== null) {
2177
+ if (data.domainNameConfig != null) {
2777
2178
  contents.domainNameConfig = deserializeAws_restJson1DomainNameConfig(data.domainNameConfig, context);
2778
2179
  }
2779
- return Promise.resolve(contents);
2180
+ return contents;
2780
2181
  };
2781
2182
  exports.deserializeAws_restJson1GetDomainNameCommand = deserializeAws_restJson1GetDomainNameCommand;
2782
2183
  const deserializeAws_restJson1GetDomainNameCommandError = async (output, context) => {
@@ -2784,7 +2185,6 @@ const deserializeAws_restJson1GetDomainNameCommandError = async (output, context
2784
2185
  ...output,
2785
2186
  body: await parseBody(output.body, context),
2786
2187
  };
2787
- let response;
2788
2188
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2789
2189
  switch (errorCode) {
2790
2190
  case "AccessDeniedException":
@@ -2801,29 +2201,26 @@ const deserializeAws_restJson1GetDomainNameCommandError = async (output, context
2801
2201
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2802
2202
  default:
2803
2203
  const parsedBody = parsedOutput.body;
2804
- const $metadata = deserializeMetadata(output);
2805
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2806
- response = new AppSyncServiceException_1.AppSyncServiceException({
2807
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2808
- $fault: "client",
2809
- $metadata,
2204
+ (0, smithy_client_1.throwDefaultError)({
2205
+ output,
2206
+ parsedBody,
2207
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2208
+ errorCode,
2810
2209
  });
2811
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2812
2210
  }
2813
2211
  };
2814
2212
  const deserializeAws_restJson1GetFunctionCommand = async (output, context) => {
2815
2213
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2816
2214
  return deserializeAws_restJson1GetFunctionCommandError(output, context);
2817
2215
  }
2818
- const contents = {
2216
+ const contents = map({
2819
2217
  $metadata: deserializeMetadata(output),
2820
- functionConfiguration: undefined,
2821
- };
2218
+ });
2822
2219
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2823
- if (data.functionConfiguration !== undefined && data.functionConfiguration !== null) {
2220
+ if (data.functionConfiguration != null) {
2824
2221
  contents.functionConfiguration = deserializeAws_restJson1FunctionConfiguration(data.functionConfiguration, context);
2825
2222
  }
2826
- return Promise.resolve(contents);
2223
+ return contents;
2827
2224
  };
2828
2225
  exports.deserializeAws_restJson1GetFunctionCommand = deserializeAws_restJson1GetFunctionCommand;
2829
2226
  const deserializeAws_restJson1GetFunctionCommandError = async (output, context) => {
@@ -2831,7 +2228,6 @@ const deserializeAws_restJson1GetFunctionCommandError = async (output, context)
2831
2228
  ...output,
2832
2229
  body: await parseBody(output.body, context),
2833
2230
  };
2834
- let response;
2835
2231
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2836
2232
  switch (errorCode) {
2837
2233
  case "ConcurrentModificationException":
@@ -2845,29 +2241,26 @@ const deserializeAws_restJson1GetFunctionCommandError = async (output, context)
2845
2241
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2846
2242
  default:
2847
2243
  const parsedBody = parsedOutput.body;
2848
- const $metadata = deserializeMetadata(output);
2849
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2850
- response = new AppSyncServiceException_1.AppSyncServiceException({
2851
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2852
- $fault: "client",
2853
- $metadata,
2244
+ (0, smithy_client_1.throwDefaultError)({
2245
+ output,
2246
+ parsedBody,
2247
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2248
+ errorCode,
2854
2249
  });
2855
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2856
2250
  }
2857
2251
  };
2858
2252
  const deserializeAws_restJson1GetGraphqlApiCommand = async (output, context) => {
2859
2253
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2860
2254
  return deserializeAws_restJson1GetGraphqlApiCommandError(output, context);
2861
2255
  }
2862
- const contents = {
2256
+ const contents = map({
2863
2257
  $metadata: deserializeMetadata(output),
2864
- graphqlApi: undefined,
2865
- };
2258
+ });
2866
2259
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2867
- if (data.graphqlApi !== undefined && data.graphqlApi !== null) {
2260
+ if (data.graphqlApi != null) {
2868
2261
  contents.graphqlApi = deserializeAws_restJson1GraphqlApi(data.graphqlApi, context);
2869
2262
  }
2870
- return Promise.resolve(contents);
2263
+ return contents;
2871
2264
  };
2872
2265
  exports.deserializeAws_restJson1GetGraphqlApiCommand = deserializeAws_restJson1GetGraphqlApiCommand;
2873
2266
  const deserializeAws_restJson1GetGraphqlApiCommandError = async (output, context) => {
@@ -2875,7 +2268,6 @@ const deserializeAws_restJson1GetGraphqlApiCommandError = async (output, context
2875
2268
  ...output,
2876
2269
  body: await parseBody(output.body, context),
2877
2270
  };
2878
- let response;
2879
2271
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2880
2272
  switch (errorCode) {
2881
2273
  case "AccessDeniedException":
@@ -2895,27 +2287,24 @@ const deserializeAws_restJson1GetGraphqlApiCommandError = async (output, context
2895
2287
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2896
2288
  default:
2897
2289
  const parsedBody = parsedOutput.body;
2898
- const $metadata = deserializeMetadata(output);
2899
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2900
- response = new AppSyncServiceException_1.AppSyncServiceException({
2901
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2902
- $fault: "client",
2903
- $metadata,
2290
+ (0, smithy_client_1.throwDefaultError)({
2291
+ output,
2292
+ parsedBody,
2293
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2294
+ errorCode,
2904
2295
  });
2905
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2906
2296
  }
2907
2297
  };
2908
2298
  const deserializeAws_restJson1GetIntrospectionSchemaCommand = async (output, context) => {
2909
2299
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2910
2300
  return deserializeAws_restJson1GetIntrospectionSchemaCommandError(output, context);
2911
2301
  }
2912
- const contents = {
2302
+ const contents = map({
2913
2303
  $metadata: deserializeMetadata(output),
2914
- schema: undefined,
2915
- };
2304
+ });
2916
2305
  const data = await collectBody(output.body, context);
2917
2306
  contents.schema = data;
2918
- return Promise.resolve(contents);
2307
+ return contents;
2919
2308
  };
2920
2309
  exports.deserializeAws_restJson1GetIntrospectionSchemaCommand = deserializeAws_restJson1GetIntrospectionSchemaCommand;
2921
2310
  const deserializeAws_restJson1GetIntrospectionSchemaCommandError = async (output, context) => {
@@ -2923,7 +2312,6 @@ const deserializeAws_restJson1GetIntrospectionSchemaCommandError = async (output
2923
2312
  ...output,
2924
2313
  body: await parseBody(output.body, context),
2925
2314
  };
2926
- let response;
2927
2315
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2928
2316
  switch (errorCode) {
2929
2317
  case "GraphQLSchemaException":
@@ -2940,29 +2328,26 @@ const deserializeAws_restJson1GetIntrospectionSchemaCommandError = async (output
2940
2328
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2941
2329
  default:
2942
2330
  const parsedBody = parsedOutput.body;
2943
- const $metadata = deserializeMetadata(output);
2944
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2945
- response = new AppSyncServiceException_1.AppSyncServiceException({
2946
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2947
- $fault: "client",
2948
- $metadata,
2331
+ (0, smithy_client_1.throwDefaultError)({
2332
+ output,
2333
+ parsedBody,
2334
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2335
+ errorCode,
2949
2336
  });
2950
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2951
2337
  }
2952
2338
  };
2953
2339
  const deserializeAws_restJson1GetResolverCommand = async (output, context) => {
2954
2340
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2955
2341
  return deserializeAws_restJson1GetResolverCommandError(output, context);
2956
2342
  }
2957
- const contents = {
2343
+ const contents = map({
2958
2344
  $metadata: deserializeMetadata(output),
2959
- resolver: undefined,
2960
- };
2345
+ });
2961
2346
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2962
- if (data.resolver !== undefined && data.resolver !== null) {
2347
+ if (data.resolver != null) {
2963
2348
  contents.resolver = deserializeAws_restJson1Resolver(data.resolver, context);
2964
2349
  }
2965
- return Promise.resolve(contents);
2350
+ return contents;
2966
2351
  };
2967
2352
  exports.deserializeAws_restJson1GetResolverCommand = deserializeAws_restJson1GetResolverCommand;
2968
2353
  const deserializeAws_restJson1GetResolverCommandError = async (output, context) => {
@@ -2970,7 +2355,6 @@ const deserializeAws_restJson1GetResolverCommandError = async (output, context)
2970
2355
  ...output,
2971
2356
  body: await parseBody(output.body, context),
2972
2357
  };
2973
- let response;
2974
2358
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2975
2359
  switch (errorCode) {
2976
2360
  case "ConcurrentModificationException":
@@ -2984,33 +2368,29 @@ const deserializeAws_restJson1GetResolverCommandError = async (output, context)
2984
2368
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2985
2369
  default:
2986
2370
  const parsedBody = parsedOutput.body;
2987
- const $metadata = deserializeMetadata(output);
2988
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2989
- response = new AppSyncServiceException_1.AppSyncServiceException({
2990
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2991
- $fault: "client",
2992
- $metadata,
2371
+ (0, smithy_client_1.throwDefaultError)({
2372
+ output,
2373
+ parsedBody,
2374
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2375
+ errorCode,
2993
2376
  });
2994
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2995
2377
  }
2996
2378
  };
2997
2379
  const deserializeAws_restJson1GetSchemaCreationStatusCommand = async (output, context) => {
2998
2380
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2999
2381
  return deserializeAws_restJson1GetSchemaCreationStatusCommandError(output, context);
3000
2382
  }
3001
- const contents = {
2383
+ const contents = map({
3002
2384
  $metadata: deserializeMetadata(output),
3003
- details: undefined,
3004
- status: undefined,
3005
- };
2385
+ });
3006
2386
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3007
- if (data.details !== undefined && data.details !== null) {
2387
+ if (data.details != null) {
3008
2388
  contents.details = (0, smithy_client_1.expectString)(data.details);
3009
2389
  }
3010
- if (data.status !== undefined && data.status !== null) {
2390
+ if (data.status != null) {
3011
2391
  contents.status = (0, smithy_client_1.expectString)(data.status);
3012
2392
  }
3013
- return Promise.resolve(contents);
2393
+ return contents;
3014
2394
  };
3015
2395
  exports.deserializeAws_restJson1GetSchemaCreationStatusCommand = deserializeAws_restJson1GetSchemaCreationStatusCommand;
3016
2396
  const deserializeAws_restJson1GetSchemaCreationStatusCommandError = async (output, context) => {
@@ -3018,7 +2398,6 @@ const deserializeAws_restJson1GetSchemaCreationStatusCommandError = async (outpu
3018
2398
  ...output,
3019
2399
  body: await parseBody(output.body, context),
3020
2400
  };
3021
- let response;
3022
2401
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3023
2402
  switch (errorCode) {
3024
2403
  case "BadRequestException":
@@ -3035,29 +2414,26 @@ const deserializeAws_restJson1GetSchemaCreationStatusCommandError = async (outpu
3035
2414
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3036
2415
  default:
3037
2416
  const parsedBody = parsedOutput.body;
3038
- const $metadata = deserializeMetadata(output);
3039
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3040
- response = new AppSyncServiceException_1.AppSyncServiceException({
3041
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3042
- $fault: "client",
3043
- $metadata,
2417
+ (0, smithy_client_1.throwDefaultError)({
2418
+ output,
2419
+ parsedBody,
2420
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2421
+ errorCode,
3044
2422
  });
3045
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3046
2423
  }
3047
2424
  };
3048
2425
  const deserializeAws_restJson1GetTypeCommand = async (output, context) => {
3049
2426
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3050
2427
  return deserializeAws_restJson1GetTypeCommandError(output, context);
3051
2428
  }
3052
- const contents = {
2429
+ const contents = map({
3053
2430
  $metadata: deserializeMetadata(output),
3054
- type: undefined,
3055
- };
2431
+ });
3056
2432
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3057
- if (data.type !== undefined && data.type !== null) {
2433
+ if (data.type != null) {
3058
2434
  contents.type = deserializeAws_restJson1Type(data.type, context);
3059
2435
  }
3060
- return Promise.resolve(contents);
2436
+ return contents;
3061
2437
  };
3062
2438
  exports.deserializeAws_restJson1GetTypeCommand = deserializeAws_restJson1GetTypeCommand;
3063
2439
  const deserializeAws_restJson1GetTypeCommandError = async (output, context) => {
@@ -3065,7 +2441,6 @@ const deserializeAws_restJson1GetTypeCommandError = async (output, context) => {
3065
2441
  ...output,
3066
2442
  body: await parseBody(output.body, context),
3067
2443
  };
3068
- let response;
3069
2444
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3070
2445
  switch (errorCode) {
3071
2446
  case "BadRequestException":
@@ -3085,33 +2460,29 @@ const deserializeAws_restJson1GetTypeCommandError = async (output, context) => {
3085
2460
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3086
2461
  default:
3087
2462
  const parsedBody = parsedOutput.body;
3088
- const $metadata = deserializeMetadata(output);
3089
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3090
- response = new AppSyncServiceException_1.AppSyncServiceException({
3091
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3092
- $fault: "client",
3093
- $metadata,
2463
+ (0, smithy_client_1.throwDefaultError)({
2464
+ output,
2465
+ parsedBody,
2466
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2467
+ errorCode,
3094
2468
  });
3095
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3096
2469
  }
3097
2470
  };
3098
2471
  const deserializeAws_restJson1ListApiKeysCommand = async (output, context) => {
3099
2472
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3100
2473
  return deserializeAws_restJson1ListApiKeysCommandError(output, context);
3101
2474
  }
3102
- const contents = {
2475
+ const contents = map({
3103
2476
  $metadata: deserializeMetadata(output),
3104
- apiKeys: undefined,
3105
- nextToken: undefined,
3106
- };
2477
+ });
3107
2478
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3108
- if (data.apiKeys !== undefined && data.apiKeys !== null) {
2479
+ if (data.apiKeys != null) {
3109
2480
  contents.apiKeys = deserializeAws_restJson1ApiKeys(data.apiKeys, context);
3110
2481
  }
3111
- if (data.nextToken !== undefined && data.nextToken !== null) {
2482
+ if (data.nextToken != null) {
3112
2483
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3113
2484
  }
3114
- return Promise.resolve(contents);
2485
+ return contents;
3115
2486
  };
3116
2487
  exports.deserializeAws_restJson1ListApiKeysCommand = deserializeAws_restJson1ListApiKeysCommand;
3117
2488
  const deserializeAws_restJson1ListApiKeysCommandError = async (output, context) => {
@@ -3119,7 +2490,6 @@ const deserializeAws_restJson1ListApiKeysCommandError = async (output, context)
3119
2490
  ...output,
3120
2491
  body: await parseBody(output.body, context),
3121
2492
  };
3122
- let response;
3123
2493
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3124
2494
  switch (errorCode) {
3125
2495
  case "BadRequestException":
@@ -3136,33 +2506,29 @@ const deserializeAws_restJson1ListApiKeysCommandError = async (output, context)
3136
2506
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3137
2507
  default:
3138
2508
  const parsedBody = parsedOutput.body;
3139
- const $metadata = deserializeMetadata(output);
3140
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3141
- response = new AppSyncServiceException_1.AppSyncServiceException({
3142
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3143
- $fault: "client",
3144
- $metadata,
2509
+ (0, smithy_client_1.throwDefaultError)({
2510
+ output,
2511
+ parsedBody,
2512
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2513
+ errorCode,
3145
2514
  });
3146
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3147
2515
  }
3148
2516
  };
3149
2517
  const deserializeAws_restJson1ListDataSourcesCommand = async (output, context) => {
3150
2518
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3151
2519
  return deserializeAws_restJson1ListDataSourcesCommandError(output, context);
3152
2520
  }
3153
- const contents = {
2521
+ const contents = map({
3154
2522
  $metadata: deserializeMetadata(output),
3155
- dataSources: undefined,
3156
- nextToken: undefined,
3157
- };
2523
+ });
3158
2524
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3159
- if (data.dataSources !== undefined && data.dataSources !== null) {
2525
+ if (data.dataSources != null) {
3160
2526
  contents.dataSources = deserializeAws_restJson1DataSources(data.dataSources, context);
3161
2527
  }
3162
- if (data.nextToken !== undefined && data.nextToken !== null) {
2528
+ if (data.nextToken != null) {
3163
2529
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3164
2530
  }
3165
- return Promise.resolve(contents);
2531
+ return contents;
3166
2532
  };
3167
2533
  exports.deserializeAws_restJson1ListDataSourcesCommand = deserializeAws_restJson1ListDataSourcesCommand;
3168
2534
  const deserializeAws_restJson1ListDataSourcesCommandError = async (output, context) => {
@@ -3170,7 +2536,6 @@ const deserializeAws_restJson1ListDataSourcesCommandError = async (output, conte
3170
2536
  ...output,
3171
2537
  body: await parseBody(output.body, context),
3172
2538
  };
3173
- let response;
3174
2539
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3175
2540
  switch (errorCode) {
3176
2541
  case "BadRequestException":
@@ -3187,33 +2552,29 @@ const deserializeAws_restJson1ListDataSourcesCommandError = async (output, conte
3187
2552
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3188
2553
  default:
3189
2554
  const parsedBody = parsedOutput.body;
3190
- const $metadata = deserializeMetadata(output);
3191
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3192
- response = new AppSyncServiceException_1.AppSyncServiceException({
3193
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3194
- $fault: "client",
3195
- $metadata,
2555
+ (0, smithy_client_1.throwDefaultError)({
2556
+ output,
2557
+ parsedBody,
2558
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2559
+ errorCode,
3196
2560
  });
3197
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3198
2561
  }
3199
2562
  };
3200
2563
  const deserializeAws_restJson1ListDomainNamesCommand = async (output, context) => {
3201
2564
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3202
2565
  return deserializeAws_restJson1ListDomainNamesCommandError(output, context);
3203
2566
  }
3204
- const contents = {
2567
+ const contents = map({
3205
2568
  $metadata: deserializeMetadata(output),
3206
- domainNameConfigs: undefined,
3207
- nextToken: undefined,
3208
- };
2569
+ });
3209
2570
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3210
- if (data.domainNameConfigs !== undefined && data.domainNameConfigs !== null) {
2571
+ if (data.domainNameConfigs != null) {
3211
2572
  contents.domainNameConfigs = deserializeAws_restJson1DomainNameConfigs(data.domainNameConfigs, context);
3212
2573
  }
3213
- if (data.nextToken !== undefined && data.nextToken !== null) {
2574
+ if (data.nextToken != null) {
3214
2575
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3215
2576
  }
3216
- return Promise.resolve(contents);
2577
+ return contents;
3217
2578
  };
3218
2579
  exports.deserializeAws_restJson1ListDomainNamesCommand = deserializeAws_restJson1ListDomainNamesCommand;
3219
2580
  const deserializeAws_restJson1ListDomainNamesCommandError = async (output, context) => {
@@ -3221,7 +2582,6 @@ const deserializeAws_restJson1ListDomainNamesCommandError = async (output, conte
3221
2582
  ...output,
3222
2583
  body: await parseBody(output.body, context),
3223
2584
  };
3224
- let response;
3225
2585
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3226
2586
  switch (errorCode) {
3227
2587
  case "AccessDeniedException":
@@ -3235,33 +2595,29 @@ const deserializeAws_restJson1ListDomainNamesCommandError = async (output, conte
3235
2595
  throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3236
2596
  default:
3237
2597
  const parsedBody = parsedOutput.body;
3238
- const $metadata = deserializeMetadata(output);
3239
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3240
- response = new AppSyncServiceException_1.AppSyncServiceException({
3241
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3242
- $fault: "client",
3243
- $metadata,
2598
+ (0, smithy_client_1.throwDefaultError)({
2599
+ output,
2600
+ parsedBody,
2601
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2602
+ errorCode,
3244
2603
  });
3245
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3246
2604
  }
3247
2605
  };
3248
2606
  const deserializeAws_restJson1ListFunctionsCommand = async (output, context) => {
3249
2607
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3250
2608
  return deserializeAws_restJson1ListFunctionsCommandError(output, context);
3251
2609
  }
3252
- const contents = {
2610
+ const contents = map({
3253
2611
  $metadata: deserializeMetadata(output),
3254
- functions: undefined,
3255
- nextToken: undefined,
3256
- };
2612
+ });
3257
2613
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3258
- if (data.functions !== undefined && data.functions !== null) {
2614
+ if (data.functions != null) {
3259
2615
  contents.functions = deserializeAws_restJson1Functions(data.functions, context);
3260
2616
  }
3261
- if (data.nextToken !== undefined && data.nextToken !== null) {
2617
+ if (data.nextToken != null) {
3262
2618
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3263
2619
  }
3264
- return Promise.resolve(contents);
2620
+ return contents;
3265
2621
  };
3266
2622
  exports.deserializeAws_restJson1ListFunctionsCommand = deserializeAws_restJson1ListFunctionsCommand;
3267
2623
  const deserializeAws_restJson1ListFunctionsCommandError = async (output, context) => {
@@ -3269,7 +2625,6 @@ const deserializeAws_restJson1ListFunctionsCommandError = async (output, context
3269
2625
  ...output,
3270
2626
  body: await parseBody(output.body, context),
3271
2627
  };
3272
- let response;
3273
2628
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3274
2629
  switch (errorCode) {
3275
2630
  case "BadRequestException":
@@ -3286,33 +2641,29 @@ const deserializeAws_restJson1ListFunctionsCommandError = async (output, context
3286
2641
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3287
2642
  default:
3288
2643
  const parsedBody = parsedOutput.body;
3289
- const $metadata = deserializeMetadata(output);
3290
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3291
- response = new AppSyncServiceException_1.AppSyncServiceException({
3292
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3293
- $fault: "client",
3294
- $metadata,
2644
+ (0, smithy_client_1.throwDefaultError)({
2645
+ output,
2646
+ parsedBody,
2647
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2648
+ errorCode,
3295
2649
  });
3296
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3297
2650
  }
3298
2651
  };
3299
2652
  const deserializeAws_restJson1ListGraphqlApisCommand = async (output, context) => {
3300
2653
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3301
2654
  return deserializeAws_restJson1ListGraphqlApisCommandError(output, context);
3302
2655
  }
3303
- const contents = {
2656
+ const contents = map({
3304
2657
  $metadata: deserializeMetadata(output),
3305
- graphqlApis: undefined,
3306
- nextToken: undefined,
3307
- };
2658
+ });
3308
2659
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3309
- if (data.graphqlApis !== undefined && data.graphqlApis !== null) {
2660
+ if (data.graphqlApis != null) {
3310
2661
  contents.graphqlApis = deserializeAws_restJson1GraphqlApis(data.graphqlApis, context);
3311
2662
  }
3312
- if (data.nextToken !== undefined && data.nextToken !== null) {
2663
+ if (data.nextToken != null) {
3313
2664
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3314
2665
  }
3315
- return Promise.resolve(contents);
2666
+ return contents;
3316
2667
  };
3317
2668
  exports.deserializeAws_restJson1ListGraphqlApisCommand = deserializeAws_restJson1ListGraphqlApisCommand;
3318
2669
  const deserializeAws_restJson1ListGraphqlApisCommandError = async (output, context) => {
@@ -3320,7 +2671,6 @@ const deserializeAws_restJson1ListGraphqlApisCommandError = async (output, conte
3320
2671
  ...output,
3321
2672
  body: await parseBody(output.body, context),
3322
2673
  };
3323
- let response;
3324
2674
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3325
2675
  switch (errorCode) {
3326
2676
  case "BadRequestException":
@@ -3334,33 +2684,29 @@ const deserializeAws_restJson1ListGraphqlApisCommandError = async (output, conte
3334
2684
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3335
2685
  default:
3336
2686
  const parsedBody = parsedOutput.body;
3337
- const $metadata = deserializeMetadata(output);
3338
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3339
- response = new AppSyncServiceException_1.AppSyncServiceException({
3340
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3341
- $fault: "client",
3342
- $metadata,
2687
+ (0, smithy_client_1.throwDefaultError)({
2688
+ output,
2689
+ parsedBody,
2690
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2691
+ errorCode,
3343
2692
  });
3344
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3345
2693
  }
3346
2694
  };
3347
2695
  const deserializeAws_restJson1ListResolversCommand = async (output, context) => {
3348
2696
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3349
2697
  return deserializeAws_restJson1ListResolversCommandError(output, context);
3350
2698
  }
3351
- const contents = {
2699
+ const contents = map({
3352
2700
  $metadata: deserializeMetadata(output),
3353
- nextToken: undefined,
3354
- resolvers: undefined,
3355
- };
2701
+ });
3356
2702
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3357
- if (data.nextToken !== undefined && data.nextToken !== null) {
2703
+ if (data.nextToken != null) {
3358
2704
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3359
2705
  }
3360
- if (data.resolvers !== undefined && data.resolvers !== null) {
2706
+ if (data.resolvers != null) {
3361
2707
  contents.resolvers = deserializeAws_restJson1Resolvers(data.resolvers, context);
3362
2708
  }
3363
- return Promise.resolve(contents);
2709
+ return contents;
3364
2710
  };
3365
2711
  exports.deserializeAws_restJson1ListResolversCommand = deserializeAws_restJson1ListResolversCommand;
3366
2712
  const deserializeAws_restJson1ListResolversCommandError = async (output, context) => {
@@ -3368,7 +2714,6 @@ const deserializeAws_restJson1ListResolversCommandError = async (output, context
3368
2714
  ...output,
3369
2715
  body: await parseBody(output.body, context),
3370
2716
  };
3371
- let response;
3372
2717
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3373
2718
  switch (errorCode) {
3374
2719
  case "BadRequestException":
@@ -3385,33 +2730,29 @@ const deserializeAws_restJson1ListResolversCommandError = async (output, context
3385
2730
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3386
2731
  default:
3387
2732
  const parsedBody = parsedOutput.body;
3388
- const $metadata = deserializeMetadata(output);
3389
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3390
- response = new AppSyncServiceException_1.AppSyncServiceException({
3391
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3392
- $fault: "client",
3393
- $metadata,
2733
+ (0, smithy_client_1.throwDefaultError)({
2734
+ output,
2735
+ parsedBody,
2736
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2737
+ errorCode,
3394
2738
  });
3395
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3396
2739
  }
3397
2740
  };
3398
2741
  const deserializeAws_restJson1ListResolversByFunctionCommand = async (output, context) => {
3399
2742
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3400
2743
  return deserializeAws_restJson1ListResolversByFunctionCommandError(output, context);
3401
2744
  }
3402
- const contents = {
2745
+ const contents = map({
3403
2746
  $metadata: deserializeMetadata(output),
3404
- nextToken: undefined,
3405
- resolvers: undefined,
3406
- };
2747
+ });
3407
2748
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3408
- if (data.nextToken !== undefined && data.nextToken !== null) {
2749
+ if (data.nextToken != null) {
3409
2750
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3410
2751
  }
3411
- if (data.resolvers !== undefined && data.resolvers !== null) {
2752
+ if (data.resolvers != null) {
3412
2753
  contents.resolvers = deserializeAws_restJson1Resolvers(data.resolvers, context);
3413
2754
  }
3414
- return Promise.resolve(contents);
2755
+ return contents;
3415
2756
  };
3416
2757
  exports.deserializeAws_restJson1ListResolversByFunctionCommand = deserializeAws_restJson1ListResolversByFunctionCommand;
3417
2758
  const deserializeAws_restJson1ListResolversByFunctionCommandError = async (output, context) => {
@@ -3419,7 +2760,6 @@ const deserializeAws_restJson1ListResolversByFunctionCommandError = async (outpu
3419
2760
  ...output,
3420
2761
  body: await parseBody(output.body, context),
3421
2762
  };
3422
- let response;
3423
2763
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3424
2764
  switch (errorCode) {
3425
2765
  case "BadRequestException":
@@ -3436,29 +2776,26 @@ const deserializeAws_restJson1ListResolversByFunctionCommandError = async (outpu
3436
2776
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3437
2777
  default:
3438
2778
  const parsedBody = parsedOutput.body;
3439
- const $metadata = deserializeMetadata(output);
3440
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3441
- response = new AppSyncServiceException_1.AppSyncServiceException({
3442
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3443
- $fault: "client",
3444
- $metadata,
2779
+ (0, smithy_client_1.throwDefaultError)({
2780
+ output,
2781
+ parsedBody,
2782
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2783
+ errorCode,
3445
2784
  });
3446
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3447
2785
  }
3448
2786
  };
3449
2787
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
3450
2788
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3451
2789
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
3452
2790
  }
3453
- const contents = {
2791
+ const contents = map({
3454
2792
  $metadata: deserializeMetadata(output),
3455
- tags: undefined,
3456
- };
2793
+ });
3457
2794
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3458
- if (data.tags !== undefined && data.tags !== null) {
2795
+ if (data.tags != null) {
3459
2796
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
3460
2797
  }
3461
- return Promise.resolve(contents);
2798
+ return contents;
3462
2799
  };
3463
2800
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
3464
2801
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -3466,7 +2803,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
3466
2803
  ...output,
3467
2804
  body: await parseBody(output.body, context),
3468
2805
  };
3469
- let response;
3470
2806
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3471
2807
  switch (errorCode) {
3472
2808
  case "AccessDeniedException":
@@ -3489,33 +2825,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
3489
2825
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3490
2826
  default:
3491
2827
  const parsedBody = parsedOutput.body;
3492
- const $metadata = deserializeMetadata(output);
3493
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3494
- response = new AppSyncServiceException_1.AppSyncServiceException({
3495
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3496
- $fault: "client",
3497
- $metadata,
2828
+ (0, smithy_client_1.throwDefaultError)({
2829
+ output,
2830
+ parsedBody,
2831
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2832
+ errorCode,
3498
2833
  });
3499
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3500
2834
  }
3501
2835
  };
3502
2836
  const deserializeAws_restJson1ListTypesCommand = async (output, context) => {
3503
2837
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3504
2838
  return deserializeAws_restJson1ListTypesCommandError(output, context);
3505
2839
  }
3506
- const contents = {
2840
+ const contents = map({
3507
2841
  $metadata: deserializeMetadata(output),
3508
- nextToken: undefined,
3509
- types: undefined,
3510
- };
2842
+ });
3511
2843
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3512
- if (data.nextToken !== undefined && data.nextToken !== null) {
2844
+ if (data.nextToken != null) {
3513
2845
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
3514
2846
  }
3515
- if (data.types !== undefined && data.types !== null) {
2847
+ if (data.types != null) {
3516
2848
  contents.types = deserializeAws_restJson1TypeList(data.types, context);
3517
2849
  }
3518
- return Promise.resolve(contents);
2850
+ return contents;
3519
2851
  };
3520
2852
  exports.deserializeAws_restJson1ListTypesCommand = deserializeAws_restJson1ListTypesCommand;
3521
2853
  const deserializeAws_restJson1ListTypesCommandError = async (output, context) => {
@@ -3523,7 +2855,6 @@ const deserializeAws_restJson1ListTypesCommandError = async (output, context) =>
3523
2855
  ...output,
3524
2856
  body: await parseBody(output.body, context),
3525
2857
  };
3526
- let response;
3527
2858
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3528
2859
  switch (errorCode) {
3529
2860
  case "BadRequestException":
@@ -3543,29 +2874,26 @@ const deserializeAws_restJson1ListTypesCommandError = async (output, context) =>
3543
2874
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3544
2875
  default:
3545
2876
  const parsedBody = parsedOutput.body;
3546
- const $metadata = deserializeMetadata(output);
3547
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3548
- response = new AppSyncServiceException_1.AppSyncServiceException({
3549
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3550
- $fault: "client",
3551
- $metadata,
2877
+ (0, smithy_client_1.throwDefaultError)({
2878
+ output,
2879
+ parsedBody,
2880
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2881
+ errorCode,
3552
2882
  });
3553
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3554
2883
  }
3555
2884
  };
3556
2885
  const deserializeAws_restJson1StartSchemaCreationCommand = async (output, context) => {
3557
2886
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3558
2887
  return deserializeAws_restJson1StartSchemaCreationCommandError(output, context);
3559
2888
  }
3560
- const contents = {
2889
+ const contents = map({
3561
2890
  $metadata: deserializeMetadata(output),
3562
- status: undefined,
3563
- };
2891
+ });
3564
2892
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3565
- if (data.status !== undefined && data.status !== null) {
2893
+ if (data.status != null) {
3566
2894
  contents.status = (0, smithy_client_1.expectString)(data.status);
3567
2895
  }
3568
- return Promise.resolve(contents);
2896
+ return contents;
3569
2897
  };
3570
2898
  exports.deserializeAws_restJson1StartSchemaCreationCommand = deserializeAws_restJson1StartSchemaCreationCommand;
3571
2899
  const deserializeAws_restJson1StartSchemaCreationCommandError = async (output, context) => {
@@ -3573,7 +2901,6 @@ const deserializeAws_restJson1StartSchemaCreationCommandError = async (output, c
3573
2901
  ...output,
3574
2902
  body: await parseBody(output.body, context),
3575
2903
  };
3576
- let response;
3577
2904
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3578
2905
  switch (errorCode) {
3579
2906
  case "BadRequestException":
@@ -3593,25 +2920,23 @@ const deserializeAws_restJson1StartSchemaCreationCommandError = async (output, c
3593
2920
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3594
2921
  default:
3595
2922
  const parsedBody = parsedOutput.body;
3596
- const $metadata = deserializeMetadata(output);
3597
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3598
- response = new AppSyncServiceException_1.AppSyncServiceException({
3599
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3600
- $fault: "client",
3601
- $metadata,
2923
+ (0, smithy_client_1.throwDefaultError)({
2924
+ output,
2925
+ parsedBody,
2926
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2927
+ errorCode,
3602
2928
  });
3603
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3604
2929
  }
3605
2930
  };
3606
2931
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
3607
2932
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3608
2933
  return deserializeAws_restJson1TagResourceCommandError(output, context);
3609
2934
  }
3610
- const contents = {
2935
+ const contents = map({
3611
2936
  $metadata: deserializeMetadata(output),
3612
- };
2937
+ });
3613
2938
  await collectBody(output.body, context);
3614
- return Promise.resolve(contents);
2939
+ return contents;
3615
2940
  };
3616
2941
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
3617
2942
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -3619,7 +2944,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
3619
2944
  ...output,
3620
2945
  body: await parseBody(output.body, context),
3621
2946
  };
3622
- let response;
3623
2947
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3624
2948
  switch (errorCode) {
3625
2949
  case "AccessDeniedException":
@@ -3642,25 +2966,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
3642
2966
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3643
2967
  default:
3644
2968
  const parsedBody = parsedOutput.body;
3645
- const $metadata = deserializeMetadata(output);
3646
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3647
- response = new AppSyncServiceException_1.AppSyncServiceException({
3648
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3649
- $fault: "client",
3650
- $metadata,
2969
+ (0, smithy_client_1.throwDefaultError)({
2970
+ output,
2971
+ parsedBody,
2972
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
2973
+ errorCode,
3651
2974
  });
3652
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3653
2975
  }
3654
2976
  };
3655
2977
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
3656
2978
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3657
2979
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
3658
2980
  }
3659
- const contents = {
2981
+ const contents = map({
3660
2982
  $metadata: deserializeMetadata(output),
3661
- };
2983
+ });
3662
2984
  await collectBody(output.body, context);
3663
- return Promise.resolve(contents);
2985
+ return contents;
3664
2986
  };
3665
2987
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
3666
2988
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -3668,7 +2990,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3668
2990
  ...output,
3669
2991
  body: await parseBody(output.body, context),
3670
2992
  };
3671
- let response;
3672
2993
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3673
2994
  switch (errorCode) {
3674
2995
  case "AccessDeniedException":
@@ -3691,29 +3012,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3691
3012
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3692
3013
  default:
3693
3014
  const parsedBody = parsedOutput.body;
3694
- const $metadata = deserializeMetadata(output);
3695
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3696
- response = new AppSyncServiceException_1.AppSyncServiceException({
3697
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3698
- $fault: "client",
3699
- $metadata,
3015
+ (0, smithy_client_1.throwDefaultError)({
3016
+ output,
3017
+ parsedBody,
3018
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3019
+ errorCode,
3700
3020
  });
3701
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3702
3021
  }
3703
3022
  };
3704
3023
  const deserializeAws_restJson1UpdateApiCacheCommand = async (output, context) => {
3705
3024
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3706
3025
  return deserializeAws_restJson1UpdateApiCacheCommandError(output, context);
3707
3026
  }
3708
- const contents = {
3027
+ const contents = map({
3709
3028
  $metadata: deserializeMetadata(output),
3710
- apiCache: undefined,
3711
- };
3029
+ });
3712
3030
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3713
- if (data.apiCache !== undefined && data.apiCache !== null) {
3031
+ if (data.apiCache != null) {
3714
3032
  contents.apiCache = deserializeAws_restJson1ApiCache(data.apiCache, context);
3715
3033
  }
3716
- return Promise.resolve(contents);
3034
+ return contents;
3717
3035
  };
3718
3036
  exports.deserializeAws_restJson1UpdateApiCacheCommand = deserializeAws_restJson1UpdateApiCacheCommand;
3719
3037
  const deserializeAws_restJson1UpdateApiCacheCommandError = async (output, context) => {
@@ -3721,7 +3039,6 @@ const deserializeAws_restJson1UpdateApiCacheCommandError = async (output, contex
3721
3039
  ...output,
3722
3040
  body: await parseBody(output.body, context),
3723
3041
  };
3724
- let response;
3725
3042
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3726
3043
  switch (errorCode) {
3727
3044
  case "BadRequestException":
@@ -3741,29 +3058,26 @@ const deserializeAws_restJson1UpdateApiCacheCommandError = async (output, contex
3741
3058
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3742
3059
  default:
3743
3060
  const parsedBody = parsedOutput.body;
3744
- const $metadata = deserializeMetadata(output);
3745
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3746
- response = new AppSyncServiceException_1.AppSyncServiceException({
3747
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3748
- $fault: "client",
3749
- $metadata,
3061
+ (0, smithy_client_1.throwDefaultError)({
3062
+ output,
3063
+ parsedBody,
3064
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3065
+ errorCode,
3750
3066
  });
3751
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3752
3067
  }
3753
3068
  };
3754
3069
  const deserializeAws_restJson1UpdateApiKeyCommand = async (output, context) => {
3755
3070
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3756
3071
  return deserializeAws_restJson1UpdateApiKeyCommandError(output, context);
3757
3072
  }
3758
- const contents = {
3073
+ const contents = map({
3759
3074
  $metadata: deserializeMetadata(output),
3760
- apiKey: undefined,
3761
- };
3075
+ });
3762
3076
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3763
- if (data.apiKey !== undefined && data.apiKey !== null) {
3077
+ if (data.apiKey != null) {
3764
3078
  contents.apiKey = deserializeAws_restJson1ApiKey(data.apiKey, context);
3765
3079
  }
3766
- return Promise.resolve(contents);
3080
+ return contents;
3767
3081
  };
3768
3082
  exports.deserializeAws_restJson1UpdateApiKeyCommand = deserializeAws_restJson1UpdateApiKeyCommand;
3769
3083
  const deserializeAws_restJson1UpdateApiKeyCommandError = async (output, context) => {
@@ -3771,7 +3085,6 @@ const deserializeAws_restJson1UpdateApiKeyCommandError = async (output, context)
3771
3085
  ...output,
3772
3086
  body: await parseBody(output.body, context),
3773
3087
  };
3774
- let response;
3775
3088
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3776
3089
  switch (errorCode) {
3777
3090
  case "ApiKeyValidityOutOfBoundsException":
@@ -3794,29 +3107,26 @@ const deserializeAws_restJson1UpdateApiKeyCommandError = async (output, context)
3794
3107
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3795
3108
  default:
3796
3109
  const parsedBody = parsedOutput.body;
3797
- const $metadata = deserializeMetadata(output);
3798
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3799
- response = new AppSyncServiceException_1.AppSyncServiceException({
3800
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3801
- $fault: "client",
3802
- $metadata,
3110
+ (0, smithy_client_1.throwDefaultError)({
3111
+ output,
3112
+ parsedBody,
3113
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3114
+ errorCode,
3803
3115
  });
3804
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3805
3116
  }
3806
3117
  };
3807
3118
  const deserializeAws_restJson1UpdateDataSourceCommand = async (output, context) => {
3808
3119
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3809
3120
  return deserializeAws_restJson1UpdateDataSourceCommandError(output, context);
3810
3121
  }
3811
- const contents = {
3122
+ const contents = map({
3812
3123
  $metadata: deserializeMetadata(output),
3813
- dataSource: undefined,
3814
- };
3124
+ });
3815
3125
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3816
- if (data.dataSource !== undefined && data.dataSource !== null) {
3126
+ if (data.dataSource != null) {
3817
3127
  contents.dataSource = deserializeAws_restJson1DataSource(data.dataSource, context);
3818
3128
  }
3819
- return Promise.resolve(contents);
3129
+ return contents;
3820
3130
  };
3821
3131
  exports.deserializeAws_restJson1UpdateDataSourceCommand = deserializeAws_restJson1UpdateDataSourceCommand;
3822
3132
  const deserializeAws_restJson1UpdateDataSourceCommandError = async (output, context) => {
@@ -3824,7 +3134,6 @@ const deserializeAws_restJson1UpdateDataSourceCommandError = async (output, cont
3824
3134
  ...output,
3825
3135
  body: await parseBody(output.body, context),
3826
3136
  };
3827
- let response;
3828
3137
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3829
3138
  switch (errorCode) {
3830
3139
  case "BadRequestException":
@@ -3844,29 +3153,26 @@ const deserializeAws_restJson1UpdateDataSourceCommandError = async (output, cont
3844
3153
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3845
3154
  default:
3846
3155
  const parsedBody = parsedOutput.body;
3847
- const $metadata = deserializeMetadata(output);
3848
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3849
- response = new AppSyncServiceException_1.AppSyncServiceException({
3850
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3851
- $fault: "client",
3852
- $metadata,
3156
+ (0, smithy_client_1.throwDefaultError)({
3157
+ output,
3158
+ parsedBody,
3159
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3160
+ errorCode,
3853
3161
  });
3854
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3855
3162
  }
3856
3163
  };
3857
3164
  const deserializeAws_restJson1UpdateDomainNameCommand = async (output, context) => {
3858
3165
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3859
3166
  return deserializeAws_restJson1UpdateDomainNameCommandError(output, context);
3860
3167
  }
3861
- const contents = {
3168
+ const contents = map({
3862
3169
  $metadata: deserializeMetadata(output),
3863
- domainNameConfig: undefined,
3864
- };
3170
+ });
3865
3171
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3866
- if (data.domainNameConfig !== undefined && data.domainNameConfig !== null) {
3172
+ if (data.domainNameConfig != null) {
3867
3173
  contents.domainNameConfig = deserializeAws_restJson1DomainNameConfig(data.domainNameConfig, context);
3868
3174
  }
3869
- return Promise.resolve(contents);
3175
+ return contents;
3870
3176
  };
3871
3177
  exports.deserializeAws_restJson1UpdateDomainNameCommand = deserializeAws_restJson1UpdateDomainNameCommand;
3872
3178
  const deserializeAws_restJson1UpdateDomainNameCommandError = async (output, context) => {
@@ -3874,7 +3180,6 @@ const deserializeAws_restJson1UpdateDomainNameCommandError = async (output, cont
3874
3180
  ...output,
3875
3181
  body: await parseBody(output.body, context),
3876
3182
  };
3877
- let response;
3878
3183
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3879
3184
  switch (errorCode) {
3880
3185
  case "AccessDeniedException":
@@ -3894,29 +3199,26 @@ const deserializeAws_restJson1UpdateDomainNameCommandError = async (output, cont
3894
3199
  throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3895
3200
  default:
3896
3201
  const parsedBody = parsedOutput.body;
3897
- const $metadata = deserializeMetadata(output);
3898
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3899
- response = new AppSyncServiceException_1.AppSyncServiceException({
3900
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3901
- $fault: "client",
3902
- $metadata,
3202
+ (0, smithy_client_1.throwDefaultError)({
3203
+ output,
3204
+ parsedBody,
3205
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3206
+ errorCode,
3903
3207
  });
3904
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3905
3208
  }
3906
3209
  };
3907
3210
  const deserializeAws_restJson1UpdateFunctionCommand = async (output, context) => {
3908
3211
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3909
3212
  return deserializeAws_restJson1UpdateFunctionCommandError(output, context);
3910
3213
  }
3911
- const contents = {
3214
+ const contents = map({
3912
3215
  $metadata: deserializeMetadata(output),
3913
- functionConfiguration: undefined,
3914
- };
3216
+ });
3915
3217
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3916
- if (data.functionConfiguration !== undefined && data.functionConfiguration !== null) {
3218
+ if (data.functionConfiguration != null) {
3917
3219
  contents.functionConfiguration = deserializeAws_restJson1FunctionConfiguration(data.functionConfiguration, context);
3918
3220
  }
3919
- return Promise.resolve(contents);
3221
+ return contents;
3920
3222
  };
3921
3223
  exports.deserializeAws_restJson1UpdateFunctionCommand = deserializeAws_restJson1UpdateFunctionCommand;
3922
3224
  const deserializeAws_restJson1UpdateFunctionCommandError = async (output, context) => {
@@ -3924,7 +3226,6 @@ const deserializeAws_restJson1UpdateFunctionCommandError = async (output, contex
3924
3226
  ...output,
3925
3227
  body: await parseBody(output.body, context),
3926
3228
  };
3927
- let response;
3928
3229
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3929
3230
  switch (errorCode) {
3930
3231
  case "ConcurrentModificationException":
@@ -3941,29 +3242,26 @@ const deserializeAws_restJson1UpdateFunctionCommandError = async (output, contex
3941
3242
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3942
3243
  default:
3943
3244
  const parsedBody = parsedOutput.body;
3944
- const $metadata = deserializeMetadata(output);
3945
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3946
- response = new AppSyncServiceException_1.AppSyncServiceException({
3947
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
3948
- $fault: "client",
3949
- $metadata,
3245
+ (0, smithy_client_1.throwDefaultError)({
3246
+ output,
3247
+ parsedBody,
3248
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3249
+ errorCode,
3950
3250
  });
3951
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
3952
3251
  }
3953
3252
  };
3954
3253
  const deserializeAws_restJson1UpdateGraphqlApiCommand = async (output, context) => {
3955
3254
  if (output.statusCode !== 200 && output.statusCode >= 300) {
3956
3255
  return deserializeAws_restJson1UpdateGraphqlApiCommandError(output, context);
3957
3256
  }
3958
- const contents = {
3257
+ const contents = map({
3959
3258
  $metadata: deserializeMetadata(output),
3960
- graphqlApi: undefined,
3961
- };
3259
+ });
3962
3260
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
3963
- if (data.graphqlApi !== undefined && data.graphqlApi !== null) {
3261
+ if (data.graphqlApi != null) {
3964
3262
  contents.graphqlApi = deserializeAws_restJson1GraphqlApi(data.graphqlApi, context);
3965
3263
  }
3966
- return Promise.resolve(contents);
3264
+ return contents;
3967
3265
  };
3968
3266
  exports.deserializeAws_restJson1UpdateGraphqlApiCommand = deserializeAws_restJson1UpdateGraphqlApiCommand;
3969
3267
  const deserializeAws_restJson1UpdateGraphqlApiCommandError = async (output, context) => {
@@ -3971,7 +3269,6 @@ const deserializeAws_restJson1UpdateGraphqlApiCommandError = async (output, cont
3971
3269
  ...output,
3972
3270
  body: await parseBody(output.body, context),
3973
3271
  };
3974
- let response;
3975
3272
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3976
3273
  switch (errorCode) {
3977
3274
  case "AccessDeniedException":
@@ -3994,29 +3291,26 @@ const deserializeAws_restJson1UpdateGraphqlApiCommandError = async (output, cont
3994
3291
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3995
3292
  default:
3996
3293
  const parsedBody = parsedOutput.body;
3997
- const $metadata = deserializeMetadata(output);
3998
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
3999
- response = new AppSyncServiceException_1.AppSyncServiceException({
4000
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4001
- $fault: "client",
4002
- $metadata,
3294
+ (0, smithy_client_1.throwDefaultError)({
3295
+ output,
3296
+ parsedBody,
3297
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3298
+ errorCode,
4003
3299
  });
4004
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4005
3300
  }
4006
3301
  };
4007
3302
  const deserializeAws_restJson1UpdateResolverCommand = async (output, context) => {
4008
3303
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4009
3304
  return deserializeAws_restJson1UpdateResolverCommandError(output, context);
4010
3305
  }
4011
- const contents = {
3306
+ const contents = map({
4012
3307
  $metadata: deserializeMetadata(output),
4013
- resolver: undefined,
4014
- };
3308
+ });
4015
3309
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4016
- if (data.resolver !== undefined && data.resolver !== null) {
3310
+ if (data.resolver != null) {
4017
3311
  contents.resolver = deserializeAws_restJson1Resolver(data.resolver, context);
4018
3312
  }
4019
- return Promise.resolve(contents);
3313
+ return contents;
4020
3314
  };
4021
3315
  exports.deserializeAws_restJson1UpdateResolverCommand = deserializeAws_restJson1UpdateResolverCommand;
4022
3316
  const deserializeAws_restJson1UpdateResolverCommandError = async (output, context) => {
@@ -4024,7 +3318,6 @@ const deserializeAws_restJson1UpdateResolverCommandError = async (output, contex
4024
3318
  ...output,
4025
3319
  body: await parseBody(output.body, context),
4026
3320
  };
4027
- let response;
4028
3321
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4029
3322
  switch (errorCode) {
4030
3323
  case "ConcurrentModificationException":
@@ -4041,29 +3334,26 @@ const deserializeAws_restJson1UpdateResolverCommandError = async (output, contex
4041
3334
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
4042
3335
  default:
4043
3336
  const parsedBody = parsedOutput.body;
4044
- const $metadata = deserializeMetadata(output);
4045
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4046
- response = new AppSyncServiceException_1.AppSyncServiceException({
4047
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4048
- $fault: "client",
4049
- $metadata,
3337
+ (0, smithy_client_1.throwDefaultError)({
3338
+ output,
3339
+ parsedBody,
3340
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3341
+ errorCode,
4050
3342
  });
4051
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4052
3343
  }
4053
3344
  };
4054
3345
  const deserializeAws_restJson1UpdateTypeCommand = async (output, context) => {
4055
3346
  if (output.statusCode !== 200 && output.statusCode >= 300) {
4056
3347
  return deserializeAws_restJson1UpdateTypeCommandError(output, context);
4057
3348
  }
4058
- const contents = {
3349
+ const contents = map({
4059
3350
  $metadata: deserializeMetadata(output),
4060
- type: undefined,
4061
- };
3351
+ });
4062
3352
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
4063
- if (data.type !== undefined && data.type !== null) {
3353
+ if (data.type != null) {
4064
3354
  contents.type = deserializeAws_restJson1Type(data.type, context);
4065
3355
  }
4066
- return Promise.resolve(contents);
3356
+ return contents;
4067
3357
  };
4068
3358
  exports.deserializeAws_restJson1UpdateTypeCommand = deserializeAws_restJson1UpdateTypeCommand;
4069
3359
  const deserializeAws_restJson1UpdateTypeCommandError = async (output, context) => {
@@ -4071,7 +3361,6 @@ const deserializeAws_restJson1UpdateTypeCommandError = async (output, context) =
4071
3361
  ...output,
4072
3362
  body: await parseBody(output.body, context),
4073
3363
  };
4074
- let response;
4075
3364
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4076
3365
  switch (errorCode) {
4077
3366
  case "BadRequestException":
@@ -4091,20 +3380,19 @@ const deserializeAws_restJson1UpdateTypeCommandError = async (output, context) =
4091
3380
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
4092
3381
  default:
4093
3382
  const parsedBody = parsedOutput.body;
4094
- const $metadata = deserializeMetadata(output);
4095
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
4096
- response = new AppSyncServiceException_1.AppSyncServiceException({
4097
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
4098
- $fault: "client",
4099
- $metadata,
3383
+ (0, smithy_client_1.throwDefaultError)({
3384
+ output,
3385
+ parsedBody,
3386
+ exceptionCtor: AppSyncServiceException_1.AppSyncServiceException,
3387
+ errorCode,
4100
3388
  });
4101
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
4102
3389
  }
4103
3390
  };
3391
+ const map = smithy_client_1.map;
4104
3392
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
4105
- const contents = {};
3393
+ const contents = map({});
4106
3394
  const data = parsedOutput.body;
4107
- if (data.message !== undefined && data.message !== null) {
3395
+ if (data.message != null) {
4108
3396
  contents.message = (0, smithy_client_1.expectString)(data.message);
4109
3397
  }
4110
3398
  const exception = new models_0_1.AccessDeniedException({
@@ -4114,9 +3402,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
4114
3402
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4115
3403
  };
4116
3404
  const deserializeAws_restJson1ApiKeyLimitExceededExceptionResponse = async (parsedOutput, context) => {
4117
- const contents = {};
3405
+ const contents = map({});
4118
3406
  const data = parsedOutput.body;
4119
- if (data.message !== undefined && data.message !== null) {
3407
+ if (data.message != null) {
4120
3408
  contents.message = (0, smithy_client_1.expectString)(data.message);
4121
3409
  }
4122
3410
  const exception = new models_0_1.ApiKeyLimitExceededException({
@@ -4126,9 +3414,9 @@ const deserializeAws_restJson1ApiKeyLimitExceededExceptionResponse = async (pars
4126
3414
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4127
3415
  };
4128
3416
  const deserializeAws_restJson1ApiKeyValidityOutOfBoundsExceptionResponse = async (parsedOutput, context) => {
4129
- const contents = {};
3417
+ const contents = map({});
4130
3418
  const data = parsedOutput.body;
4131
- if (data.message !== undefined && data.message !== null) {
3419
+ if (data.message != null) {
4132
3420
  contents.message = (0, smithy_client_1.expectString)(data.message);
4133
3421
  }
4134
3422
  const exception = new models_0_1.ApiKeyValidityOutOfBoundsException({
@@ -4138,9 +3426,9 @@ const deserializeAws_restJson1ApiKeyValidityOutOfBoundsExceptionResponse = async
4138
3426
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4139
3427
  };
4140
3428
  const deserializeAws_restJson1ApiLimitExceededExceptionResponse = async (parsedOutput, context) => {
4141
- const contents = {};
3429
+ const contents = map({});
4142
3430
  const data = parsedOutput.body;
4143
- if (data.message !== undefined && data.message !== null) {
3431
+ if (data.message != null) {
4144
3432
  contents.message = (0, smithy_client_1.expectString)(data.message);
4145
3433
  }
4146
3434
  const exception = new models_0_1.ApiLimitExceededException({
@@ -4150,9 +3438,9 @@ const deserializeAws_restJson1ApiLimitExceededExceptionResponse = async (parsedO
4150
3438
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4151
3439
  };
4152
3440
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
4153
- const contents = {};
3441
+ const contents = map({});
4154
3442
  const data = parsedOutput.body;
4155
- if (data.message !== undefined && data.message !== null) {
3443
+ if (data.message != null) {
4156
3444
  contents.message = (0, smithy_client_1.expectString)(data.message);
4157
3445
  }
4158
3446
  const exception = new models_0_1.BadRequestException({
@@ -4162,9 +3450,9 @@ const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput,
4162
3450
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4163
3451
  };
4164
3452
  const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
4165
- const contents = {};
3453
+ const contents = map({});
4166
3454
  const data = parsedOutput.body;
4167
- if (data.message !== undefined && data.message !== null) {
3455
+ if (data.message != null) {
4168
3456
  contents.message = (0, smithy_client_1.expectString)(data.message);
4169
3457
  }
4170
3458
  const exception = new models_0_1.ConcurrentModificationException({
@@ -4174,9 +3462,9 @@ const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (p
4174
3462
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4175
3463
  };
4176
3464
  const deserializeAws_restJson1GraphQLSchemaExceptionResponse = async (parsedOutput, context) => {
4177
- const contents = {};
3465
+ const contents = map({});
4178
3466
  const data = parsedOutput.body;
4179
- if (data.message !== undefined && data.message !== null) {
3467
+ if (data.message != null) {
4180
3468
  contents.message = (0, smithy_client_1.expectString)(data.message);
4181
3469
  }
4182
3470
  const exception = new models_0_1.GraphQLSchemaException({
@@ -4186,9 +3474,9 @@ const deserializeAws_restJson1GraphQLSchemaExceptionResponse = async (parsedOutp
4186
3474
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4187
3475
  };
4188
3476
  const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
4189
- const contents = {};
3477
+ const contents = map({});
4190
3478
  const data = parsedOutput.body;
4191
- if (data.message !== undefined && data.message !== null) {
3479
+ if (data.message != null) {
4192
3480
  contents.message = (0, smithy_client_1.expectString)(data.message);
4193
3481
  }
4194
3482
  const exception = new models_0_1.InternalFailureException({
@@ -4198,9 +3486,9 @@ const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOu
4198
3486
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4199
3487
  };
4200
3488
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
4201
- const contents = {};
3489
+ const contents = map({});
4202
3490
  const data = parsedOutput.body;
4203
- if (data.message !== undefined && data.message !== null) {
3491
+ if (data.message != null) {
4204
3492
  contents.message = (0, smithy_client_1.expectString)(data.message);
4205
3493
  }
4206
3494
  const exception = new models_0_1.LimitExceededException({
@@ -4210,9 +3498,9 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
4210
3498
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4211
3499
  };
4212
3500
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
4213
- const contents = {};
3501
+ const contents = map({});
4214
3502
  const data = parsedOutput.body;
4215
- if (data.message !== undefined && data.message !== null) {
3503
+ if (data.message != null) {
4216
3504
  contents.message = (0, smithy_client_1.expectString)(data.message);
4217
3505
  }
4218
3506
  const exception = new models_0_1.NotFoundException({
@@ -4222,9 +3510,9 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
4222
3510
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
4223
3511
  };
4224
3512
  const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
4225
- const contents = {};
3513
+ const contents = map({});
4226
3514
  const data = parsedOutput.body;
4227
- if (data.message !== undefined && data.message !== null) {
3515
+ if (data.message != null) {
4228
3516
  contents.message = (0, smithy_client_1.expectString)(data.message);
4229
3517
  }
4230
3518
  const exception = new models_0_1.UnauthorizedException({
@@ -4251,9 +3539,6 @@ const serializeAws_restJson1AdditionalAuthenticationProviders = (input, context)
4251
3539
  return input
4252
3540
  .filter((e) => e != null)
4253
3541
  .map((entry) => {
4254
- if (entry === null) {
4255
- return null;
4256
- }
4257
3542
  return serializeAws_restJson1AdditionalAuthenticationProvider(entry, context);
4258
3543
  });
4259
3544
  };
@@ -4281,9 +3566,6 @@ const serializeAws_restJson1CachingKeys = (input, context) => {
4281
3566
  return input
4282
3567
  .filter((e) => e != null)
4283
3568
  .map((entry) => {
4284
- if (entry === null) {
4285
- return null;
4286
- }
4287
3569
  return entry;
4288
3570
  });
4289
3571
  };
@@ -4322,9 +3604,6 @@ const serializeAws_restJson1FunctionsIds = (input, context) => {
4322
3604
  return input
4323
3605
  .filter((e) => e != null)
4324
3606
  .map((entry) => {
4325
- if (entry === null) {
4326
- return null;
4327
- }
4328
3607
  return entry;
4329
3608
  });
4330
3609
  };
@@ -4608,6 +3887,11 @@ const deserializeAws_restJson1ElasticsearchDataSourceConfig = (output, context)
4608
3887
  endpoint: (0, smithy_client_1.expectString)(output.endpoint),
4609
3888
  };
4610
3889
  };
3890
+ const deserializeAws_restJson1ErrorDetail = (output, context) => {
3891
+ return {
3892
+ message: (0, smithy_client_1.expectString)(output.message),
3893
+ };
3894
+ };
4611
3895
  const deserializeAws_restJson1FunctionConfiguration = (output, context) => {
4612
3896
  return {
4613
3897
  dataSourceName: (0, smithy_client_1.expectString)(output.dataSourceName),