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