@elastic/elasticsearch 7.15.0 → 8.0.0-beta.1

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 (344) hide show
  1. package/README.md +10 -11
  2. package/index.d.ts +4 -2971
  3. package/index.js +25 -321
  4. package/lib/api/api/async_search.d.ts +23 -0
  5. package/lib/api/api/async_search.js +130 -0
  6. package/lib/api/api/async_search.js.map +1 -0
  7. package/lib/api/api/autoscaling.d.ts +23 -0
  8. package/lib/api/api/autoscaling.js +109 -0
  9. package/lib/api/api/autoscaling.js.map +1 -0
  10. package/lib/api/api/bulk.d.ts +10 -0
  11. package/lib/api/api/bulk.js +58 -0
  12. package/lib/api/api/bulk.js.map +1 -0
  13. package/lib/api/api/cat.d.ts +86 -0
  14. package/lib/api/api/cat.js +611 -0
  15. package/lib/api/api/cat.js.map +1 -0
  16. package/lib/api/api/ccr.d.ts +50 -0
  17. package/lib/api/api/ccr.js +320 -0
  18. package/lib/api/api/ccr.js.map +1 -0
  19. package/lib/api/api/clear_scroll.d.ts +10 -0
  20. package/lib/api/api/clear_scroll.js +54 -0
  21. package/lib/api/api/clear_scroll.js.map +1 -0
  22. package/lib/api/api/close_point_in_time.d.ts +10 -0
  23. package/lib/api/api/close_point_in_time.js +53 -0
  24. package/lib/api/api/close_point_in_time.js.map +1 -0
  25. package/lib/api/api/cluster.d.ts +56 -0
  26. package/lib/api/api/cluster.js +392 -0
  27. package/lib/api/api/cluster.js.map +1 -0
  28. package/lib/api/api/count.d.ts +10 -0
  29. package/lib/api/api/count.js +62 -0
  30. package/lib/api/api/count.js.map +1 -0
  31. package/lib/api/api/create.d.ts +10 -0
  32. package/lib/api/api/create.js +46 -0
  33. package/lib/api/api/create.js.map +1 -0
  34. package/lib/api/api/dangling_indices.d.ts +20 -0
  35. package/lib/api/api/dangling_indices.js +85 -0
  36. package/lib/api/api/dangling_indices.js.map +1 -0
  37. package/lib/api/api/delete.d.ts +10 -0
  38. package/lib/api/api/delete.js +39 -0
  39. package/lib/api/api/delete.js.map +1 -0
  40. package/lib/api/api/delete_by_query.d.ts +10 -0
  41. package/lib/api/api/delete_by_query.js +53 -0
  42. package/lib/api/api/delete_by_query.js.map +1 -0
  43. package/lib/api/api/delete_by_query_rethrottle.d.ts +10 -0
  44. package/lib/api/api/delete_by_query_rethrottle.js +39 -0
  45. package/lib/api/api/delete_by_query_rethrottle.js.map +1 -0
  46. package/lib/api/api/delete_script.d.ts +10 -0
  47. package/lib/api/api/delete_script.js +39 -0
  48. package/lib/api/api/delete_script.js.map +1 -0
  49. package/lib/api/api/enrich.d.ts +26 -0
  50. package/lib/api/api/enrich.js +142 -0
  51. package/lib/api/api/enrich.js.map +1 -0
  52. package/lib/api/api/eql.d.ts +23 -0
  53. package/lib/api/api/eql.js +115 -0
  54. package/lib/api/api/eql.js.map +1 -0
  55. package/lib/api/api/exists.d.ts +10 -0
  56. package/lib/api/api/exists.js +39 -0
  57. package/lib/api/api/exists.js.map +1 -0
  58. package/lib/api/api/exists_source.d.ts +10 -0
  59. package/lib/api/api/exists_source.js +39 -0
  60. package/lib/api/api/exists_source.js.map +1 -0
  61. package/lib/api/api/explain.d.ts +10 -0
  62. package/lib/api/api/explain.js +53 -0
  63. package/lib/api/api/explain.js.map +1 -0
  64. package/lib/api/api/features.d.ts +17 -0
  65. package/lib/api/api/features.js +69 -0
  66. package/lib/api/api/features.js.map +1 -0
  67. package/lib/api/api/field_caps.d.ts +10 -0
  68. package/lib/api/api/field_caps.js +62 -0
  69. package/lib/api/api/field_caps.js.map +1 -0
  70. package/lib/api/api/fleet.d.ts +20 -0
  71. package/lib/api/api/fleet.js +92 -0
  72. package/lib/api/api/fleet.js.map +1 -0
  73. package/lib/api/api/get.d.ts +10 -0
  74. package/lib/api/api/get.js +39 -0
  75. package/lib/api/api/get.js.map +1 -0
  76. package/lib/api/api/get_script.d.ts +10 -0
  77. package/lib/api/api/get_script.js +39 -0
  78. package/lib/api/api/get_script.js.map +1 -0
  79. package/lib/api/api/get_script_context.d.ts +10 -0
  80. package/lib/api/api/get_script_context.js +40 -0
  81. package/lib/api/api/get_script_context.js.map +1 -0
  82. package/lib/api/api/get_script_languages.d.ts +10 -0
  83. package/lib/api/api/get_script_languages.js +40 -0
  84. package/lib/api/api/get_script_languages.js.map +1 -0
  85. package/lib/api/api/get_source.d.ts +10 -0
  86. package/lib/api/api/get_source.js +39 -0
  87. package/lib/api/api/get_source.js.map +1 -0
  88. package/lib/api/api/graph.d.ts +14 -0
  89. package/lib/api/api/graph.js +64 -0
  90. package/lib/api/api/graph.js.map +1 -0
  91. package/lib/api/api/ilm.d.ts +44 -0
  92. package/lib/api/api/ilm.js +260 -0
  93. package/lib/api/api/ilm.js.map +1 -0
  94. package/lib/api/api/index.d.ts +10 -0
  95. package/lib/api/api/index.js +54 -0
  96. package/lib/api/api/index.js.map +1 -0
  97. package/lib/api/api/indices.d.ts +173 -0
  98. package/lib/api/api/indices.js +1381 -0
  99. package/lib/api/api/indices.js.map +1 -0
  100. package/lib/api/api/info.d.ts +10 -0
  101. package/lib/{Serializer.d.ts → api/api/info.js} +21 -11
  102. package/lib/api/api/info.js.map +1 -0
  103. package/lib/api/api/ingest.d.ts +29 -0
  104. package/lib/api/api/ingest.js +183 -0
  105. package/lib/api/api/ingest.js.map +1 -0
  106. package/lib/api/api/knn_search.d.ts +10 -0
  107. package/lib/api/api/knn_search.js +53 -0
  108. package/lib/api/api/knn_search.js.map +1 -0
  109. package/lib/api/api/license.d.ts +32 -0
  110. package/lib/api/api/license.js +173 -0
  111. package/lib/api/api/license.js.map +1 -0
  112. package/lib/api/api/logstash.d.ts +20 -0
  113. package/lib/api/api/logstash.js +91 -0
  114. package/lib/api/api/logstash.js.map +1 -0
  115. package/lib/api/api/mget.d.ts +10 -0
  116. package/lib/api/api/mget.js +62 -0
  117. package/lib/api/api/mget.js.map +1 -0
  118. package/lib/api/api/migration.d.ts +20 -0
  119. package/lib/api/api/migration.js +93 -0
  120. package/lib/api/api/migration.js.map +1 -0
  121. package/lib/api/api/ml.d.ts +221 -0
  122. package/lib/api/api/ml.js +1818 -0
  123. package/lib/api/api/ml.js.map +1 -0
  124. package/lib/api/api/monitoring.d.ts +14 -0
  125. package/lib/api/api/monitoring.js +57 -0
  126. package/lib/api/api/monitoring.js.map +1 -0
  127. package/lib/api/api/msearch.d.ts +10 -0
  128. package/lib/api/api/msearch.js +54 -0
  129. package/lib/api/api/msearch.js.map +1 -0
  130. package/lib/api/api/msearch_template.d.ts +10 -0
  131. package/lib/api/api/msearch_template.js +54 -0
  132. package/lib/api/api/msearch_template.js.map +1 -0
  133. package/lib/api/api/mtermvectors.d.ts +10 -0
  134. package/lib/api/api/mtermvectors.js +62 -0
  135. package/lib/api/api/mtermvectors.js.map +1 -0
  136. package/lib/api/api/nodes.d.ts +32 -0
  137. package/lib/api/api/nodes.js +243 -0
  138. package/lib/api/api/nodes.js.map +1 -0
  139. package/lib/api/api/open_point_in_time.d.ts +10 -0
  140. package/lib/api/api/open_point_in_time.js +39 -0
  141. package/lib/api/api/open_point_in_time.js.map +1 -0
  142. package/lib/api/api/ping.d.ts +10 -0
  143. package/lib/api/api/ping.js +40 -0
  144. package/lib/api/api/ping.js.map +1 -0
  145. package/lib/api/api/put_script.d.ts +10 -0
  146. package/lib/api/api/put_script.js +61 -0
  147. package/lib/api/api/put_script.js.map +1 -0
  148. package/lib/api/api/rank_eval.d.ts +10 -0
  149. package/lib/api/api/rank_eval.js +61 -0
  150. package/lib/api/api/rank_eval.js.map +1 -0
  151. package/lib/api/api/reindex.d.ts +10 -0
  152. package/lib/api/api/reindex.js +54 -0
  153. package/lib/api/api/reindex.js.map +1 -0
  154. package/lib/api/api/reindex_rethrottle.d.ts +10 -0
  155. package/lib/api/api/reindex_rethrottle.js +39 -0
  156. package/lib/api/api/reindex_rethrottle.js.map +1 -0
  157. package/lib/api/api/render_search_template.d.ts +10 -0
  158. package/lib/api/api/render_search_template.js +62 -0
  159. package/lib/api/api/render_search_template.js.map +1 -0
  160. package/lib/api/api/rollup.d.ts +38 -0
  161. package/lib/api/api/rollup.js +239 -0
  162. package/lib/api/api/rollup.js.map +1 -0
  163. package/lib/api/api/scripts_painless_execute.d.ts +10 -0
  164. package/lib/api/api/scripts_painless_execute.js +54 -0
  165. package/lib/api/api/scripts_painless_execute.js.map +1 -0
  166. package/lib/api/api/scroll.d.ts +10 -0
  167. package/lib/api/api/scroll.js +53 -0
  168. package/lib/api/api/scroll.js.map +1 -0
  169. package/lib/api/api/search.d.ts +10 -0
  170. package/lib/api/api/search.js +68 -0
  171. package/lib/api/api/search.js.map +1 -0
  172. package/lib/api/api/search_mvt.d.ts +10 -0
  173. package/lib/api/api/search_mvt.js +53 -0
  174. package/lib/api/api/search_mvt.js.map +1 -0
  175. package/lib/api/api/search_shards.d.ts +10 -0
  176. package/lib/api/api/search_shards.js +48 -0
  177. package/lib/api/api/search_shards.js.map +1 -0
  178. package/lib/api/api/search_template.d.ts +10 -0
  179. package/lib/api/api/search_template.js +62 -0
  180. package/lib/api/api/search_template.js.map +1 -0
  181. package/lib/api/api/searchable_snapshots.d.ts +23 -0
  182. package/lib/api/api/searchable_snapshots.js +141 -0
  183. package/lib/api/api/searchable_snapshots.js.map +1 -0
  184. package/lib/api/api/security.d.ts +140 -0
  185. package/lib/api/api/security.js +998 -0
  186. package/lib/api/api/security.js.map +1 -0
  187. package/lib/api/api/shutdown.d.ts +20 -0
  188. package/lib/api/api/shutdown.js +93 -0
  189. package/lib/api/api/shutdown.js.map +1 -0
  190. package/lib/api/api/slm.d.ts +38 -0
  191. package/lib/api/api/slm.js +214 -0
  192. package/lib/api/api/slm.js.map +1 -0
  193. package/lib/api/api/snapshot.d.ts +47 -0
  194. package/lib/api/api/snapshot.js +315 -0
  195. package/lib/api/api/snapshot.js.map +1 -0
  196. package/lib/api/api/sql.d.ts +29 -0
  197. package/lib/api/api/sql.js +178 -0
  198. package/lib/api/api/sql.js.map +1 -0
  199. package/lib/api/api/ssl.d.ts +14 -0
  200. package/lib/api/api/ssl.js +51 -0
  201. package/lib/api/api/ssl.js.map +1 -0
  202. package/lib/api/api/tasks.d.ts +20 -0
  203. package/lib/api/api/tasks.js +94 -0
  204. package/lib/api/api/tasks.js.map +1 -0
  205. package/lib/api/api/terms_enum.d.ts +10 -0
  206. package/lib/api/api/terms_enum.js +53 -0
  207. package/lib/api/api/terms_enum.js.map +1 -0
  208. package/lib/api/api/termvectors.d.ts +10 -0
  209. package/lib/api/api/termvectors.js +61 -0
  210. package/lib/api/api/termvectors.js.map +1 -0
  211. package/lib/api/api/text_structure.d.ts +14 -0
  212. package/lib/api/api/text_structure.js +57 -0
  213. package/lib/api/api/text_structure.js.map +1 -0
  214. package/lib/api/api/transform.d.ts +38 -0
  215. package/lib/api/api/transform.js +246 -0
  216. package/lib/api/api/transform.js.map +1 -0
  217. package/lib/api/api/update.d.ts +10 -0
  218. package/lib/api/api/update.js +53 -0
  219. package/lib/api/api/update.js.map +1 -0
  220. package/lib/api/api/update_by_query.d.ts +10 -0
  221. package/lib/api/api/update_by_query.js +53 -0
  222. package/lib/api/api/update_by_query.js.map +1 -0
  223. package/lib/api/api/update_by_query_rethrottle.d.ts +10 -0
  224. package/lib/api/api/update_by_query_rethrottle.js +39 -0
  225. package/lib/api/api/update_by_query_rethrottle.js.map +1 -0
  226. package/lib/api/api/watcher.d.ts +44 -0
  227. package/lib/api/api/watcher.js +291 -0
  228. package/lib/api/api/watcher.js.map +1 -0
  229. package/lib/api/api/xpack.d.ts +17 -0
  230. package/lib/api/api/xpack.js +69 -0
  231. package/lib/api/api/xpack.js.map +1 -0
  232. package/lib/api/index.d.ts +225 -0
  233. package/lib/api/index.js +520 -0
  234. package/lib/api/index.js.map +1 -0
  235. package/lib/api/types.d.ts +13525 -0
  236. package/lib/{pool/index.js → api/types.js} +3 -12
  237. package/lib/api/types.js.map +1 -0
  238. package/lib/api/typesWithBodyKey.d.ts +13931 -0
  239. package/{index.mjs → lib/api/typesWithBodyKey.js} +3 -11
  240. package/lib/api/typesWithBodyKey.js.map +1 -0
  241. package/lib/client.d.ts +69 -0
  242. package/lib/client.js +282 -0
  243. package/lib/client.js.map +1 -0
  244. package/lib/helpers.d.ts +148 -0
  245. package/lib/helpers.js +769 -0
  246. package/lib/helpers.js.map +1 -0
  247. package/lib/sniffingTransport.d.ts +4 -0
  248. package/lib/sniffingTransport.js +56 -0
  249. package/lib/sniffingTransport.js.map +1 -0
  250. package/package.json +46 -59
  251. package/tsconfig.json +37 -0
  252. package/api/api/async_search.js +0 -141
  253. package/api/api/autoscaling.js +0 -147
  254. package/api/api/bulk.js +0 -70
  255. package/api/api/cat.js +0 -648
  256. package/api/api/ccr.js +0 -403
  257. package/api/api/clear_scroll.js +0 -55
  258. package/api/api/close_point_in_time.js +0 -50
  259. package/api/api/cluster.js +0 -420
  260. package/api/api/count.js +0 -64
  261. package/api/api/create.js +0 -69
  262. package/api/api/dangling_indices.js +0 -115
  263. package/api/api/delete.js +0 -65
  264. package/api/api/delete_by_query.js +0 -71
  265. package/api/api/delete_by_query_rethrottle.js +0 -60
  266. package/api/api/delete_script.js +0 -56
  267. package/api/api/enrich.js +0 -173
  268. package/api/api/eql.js +0 -150
  269. package/api/api/exists.js +0 -65
  270. package/api/api/exists_source.js +0 -74
  271. package/api/api/explain.js +0 -65
  272. package/api/api/features.js +0 -81
  273. package/api/api/field_caps.js +0 -55
  274. package/api/api/fleet.js +0 -65
  275. package/api/api/get.js +0 -65
  276. package/api/api/get_script.js +0 -56
  277. package/api/api/get_script_context.js +0 -50
  278. package/api/api/get_script_languages.js +0 -50
  279. package/api/api/get_source.js +0 -65
  280. package/api/api/graph.js +0 -72
  281. package/api/api/ilm.js +0 -317
  282. package/api/api/index.js +0 -71
  283. package/api/api/indices.js +0 -1753
  284. package/api/api/info.js +0 -50
  285. package/api/api/ingest.js +0 -200
  286. package/api/api/license.js +0 -188
  287. package/api/api/logstash.js +0 -125
  288. package/api/api/mget.js +0 -70
  289. package/api/api/migration.js +0 -60
  290. package/api/api/ml.js +0 -2010
  291. package/api/api/monitoring.js +0 -66
  292. package/api/api/msearch.js +0 -70
  293. package/api/api/msearch_template.js +0 -70
  294. package/api/api/mtermvectors.js +0 -64
  295. package/api/api/nodes.js +0 -268
  296. package/api/api/open_point_in_time.js +0 -56
  297. package/api/api/ping.js +0 -50
  298. package/api/api/put_script.js +0 -71
  299. package/api/api/rank_eval.js +0 -61
  300. package/api/api/reindex.js +0 -56
  301. package/api/api/reindex_rethrottle.js +0 -60
  302. package/api/api/render_search_template.js +0 -55
  303. package/api/api/rollup.js +0 -319
  304. package/api/api/scripts_painless_execute.js +0 -50
  305. package/api/api/scroll.js +0 -55
  306. package/api/api/search.js +0 -64
  307. package/api/api/search_mvt.js +0 -87
  308. package/api/api/search_shards.js +0 -55
  309. package/api/api/search_template.js +0 -70
  310. package/api/api/searchable_snapshots.js +0 -186
  311. package/api/api/security.js +0 -1261
  312. package/api/api/shutdown.js +0 -124
  313. package/api/api/slm.js +0 -256
  314. package/api/api/snapshot.js +0 -439
  315. package/api/api/sql.js +0 -203
  316. package/api/api/ssl.js +0 -55
  317. package/api/api/tasks.js +0 -108
  318. package/api/api/terms_enum.js +0 -56
  319. package/api/api/termvectors.js +0 -67
  320. package/api/api/text_structure.js +0 -65
  321. package/api/api/transform.js +0 -268
  322. package/api/api/update.js +0 -69
  323. package/api/api/update_by_query.js +0 -67
  324. package/api/api/update_by_query_rethrottle.js +0 -60
  325. package/api/api/watcher.js +0 -333
  326. package/api/api/xpack.js +0 -76
  327. package/api/index.js +0 -508
  328. package/api/new.d.ts +0 -1585
  329. package/api/requestParams.d.ts +0 -2920
  330. package/api/types.d.ts +0 -15420
  331. package/api/utils.js +0 -58
  332. package/lib/Connection.d.ts +0 -99
  333. package/lib/Connection.js +0 -392
  334. package/lib/Helpers.d.ts +0 -124
  335. package/lib/Helpers.js +0 -770
  336. package/lib/Serializer.js +0 -94
  337. package/lib/Transport.d.ts +0 -162
  338. package/lib/Transport.js +0 -689
  339. package/lib/errors.d.ts +0 -90
  340. package/lib/errors.js +0 -159
  341. package/lib/pool/BaseConnectionPool.js +0 -262
  342. package/lib/pool/CloudConnectionPool.js +0 -64
  343. package/lib/pool/ConnectionPool.js +0 -246
  344. package/lib/pool/index.d.ts +0 -220
@@ -0,0 +1,998 @@
1
+ "use strict";
2
+ /*
3
+ * Licensed to Elasticsearch B.V. under one or more contributor
4
+ * license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright
6
+ * ownership. Elasticsearch B.V. licenses this file to you under
7
+ * the Apache License, Version 2.0 (the "License"); you may
8
+ * not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ class Security {
22
+ constructor(transport) {
23
+ Object.defineProperty(this, "transport", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: void 0
28
+ });
29
+ this.transport = transport;
30
+ }
31
+ async authenticate(params, options) {
32
+ const acceptedPath = [];
33
+ const querystring = {};
34
+ const body = undefined;
35
+ params = params !== null && params !== void 0 ? params : {};
36
+ for (const key in params) {
37
+ if (acceptedPath.includes(key)) {
38
+ continue;
39
+ }
40
+ else if (key !== 'body') {
41
+ // @ts-expect-error
42
+ querystring[key] = params[key];
43
+ }
44
+ }
45
+ const method = 'GET';
46
+ const path = '/_security/_authenticate';
47
+ return await this.transport.request({ path, method, querystring, body }, options);
48
+ }
49
+ async changePassword(params, options) {
50
+ const acceptedPath = ['username'];
51
+ const acceptedBody = ['password'];
52
+ const querystring = {};
53
+ // @ts-expect-error
54
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
55
+ let body;
56
+ if (typeof userBody === 'string') {
57
+ body = userBody;
58
+ }
59
+ else {
60
+ body = userBody != null ? { ...userBody } : undefined;
61
+ }
62
+ params = params !== null && params !== void 0 ? params : {};
63
+ for (const key in params) {
64
+ if (acceptedBody.includes(key)) {
65
+ body = body !== null && body !== void 0 ? body : {};
66
+ // @ts-expect-error
67
+ body[key] = params[key];
68
+ }
69
+ else if (acceptedPath.includes(key)) {
70
+ continue;
71
+ }
72
+ else if (key !== 'body') {
73
+ // @ts-expect-error
74
+ querystring[key] = params[key];
75
+ }
76
+ }
77
+ let method = '';
78
+ let path = '';
79
+ if (params.username != null) {
80
+ method = 'PUT';
81
+ path = `/_security/user/${encodeURIComponent(params.username.toString())}/_password`;
82
+ }
83
+ else {
84
+ method = 'PUT';
85
+ path = '/_security/user/_password';
86
+ }
87
+ return await this.transport.request({ path, method, querystring, body }, options);
88
+ }
89
+ async clearApiKeyCache(params, options) {
90
+ const acceptedPath = ['ids'];
91
+ const querystring = {};
92
+ const body = undefined;
93
+ for (const key in params) {
94
+ if (acceptedPath.includes(key)) {
95
+ continue;
96
+ }
97
+ else if (key !== 'body') {
98
+ // @ts-expect-error
99
+ querystring[key] = params[key];
100
+ }
101
+ }
102
+ const method = 'POST';
103
+ const path = `/_security/api_key/${encodeURIComponent(params.ids.toString())}/_clear_cache`;
104
+ return await this.transport.request({ path, method, querystring, body }, options);
105
+ }
106
+ async clearCachedPrivileges(params, options) {
107
+ const acceptedPath = ['application'];
108
+ const querystring = {};
109
+ const body = undefined;
110
+ for (const key in params) {
111
+ if (acceptedPath.includes(key)) {
112
+ continue;
113
+ }
114
+ else if (key !== 'body') {
115
+ // @ts-expect-error
116
+ querystring[key] = params[key];
117
+ }
118
+ }
119
+ const method = 'POST';
120
+ const path = `/_security/privilege/${encodeURIComponent(params.application.toString())}/_clear_cache`;
121
+ return await this.transport.request({ path, method, querystring, body }, options);
122
+ }
123
+ async clearCachedRealms(params, options) {
124
+ const acceptedPath = ['realms'];
125
+ const querystring = {};
126
+ const body = undefined;
127
+ for (const key in params) {
128
+ if (acceptedPath.includes(key)) {
129
+ continue;
130
+ }
131
+ else if (key !== 'body') {
132
+ // @ts-expect-error
133
+ querystring[key] = params[key];
134
+ }
135
+ }
136
+ const method = 'POST';
137
+ const path = `/_security/realm/${encodeURIComponent(params.realms.toString())}/_clear_cache`;
138
+ return await this.transport.request({ path, method, querystring, body }, options);
139
+ }
140
+ async clearCachedRoles(params, options) {
141
+ const acceptedPath = ['name'];
142
+ const querystring = {};
143
+ const body = undefined;
144
+ for (const key in params) {
145
+ if (acceptedPath.includes(key)) {
146
+ continue;
147
+ }
148
+ else if (key !== 'body') {
149
+ // @ts-expect-error
150
+ querystring[key] = params[key];
151
+ }
152
+ }
153
+ const method = 'POST';
154
+ const path = `/_security/role/${encodeURIComponent(params.name.toString())}/_clear_cache`;
155
+ return await this.transport.request({ path, method, querystring, body }, options);
156
+ }
157
+ async clearCachedServiceTokens(params, options) {
158
+ const acceptedPath = ['namespace', 'service', 'name'];
159
+ const querystring = {};
160
+ const body = undefined;
161
+ for (const key in params) {
162
+ if (acceptedPath.includes(key)) {
163
+ continue;
164
+ }
165
+ else if (key !== 'body') {
166
+ // @ts-expect-error
167
+ querystring[key] = params[key];
168
+ }
169
+ }
170
+ const method = 'POST';
171
+ const path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token/${encodeURIComponent(params.name.toString())}/_clear_cache`;
172
+ return await this.transport.request({ path, method, querystring, body }, options);
173
+ }
174
+ async createApiKey(params, options) {
175
+ const acceptedPath = [];
176
+ const acceptedBody = ['expiration', 'name', 'role_descriptors', 'metadata'];
177
+ const querystring = {};
178
+ // @ts-expect-error
179
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
180
+ let body;
181
+ if (typeof userBody === 'string') {
182
+ body = userBody;
183
+ }
184
+ else {
185
+ body = userBody != null ? { ...userBody } : undefined;
186
+ }
187
+ params = params !== null && params !== void 0 ? params : {};
188
+ for (const key in params) {
189
+ if (acceptedBody.includes(key)) {
190
+ body = body !== null && body !== void 0 ? body : {};
191
+ // @ts-expect-error
192
+ body[key] = params[key];
193
+ }
194
+ else if (acceptedPath.includes(key)) {
195
+ continue;
196
+ }
197
+ else if (key !== 'body') {
198
+ // @ts-expect-error
199
+ querystring[key] = params[key];
200
+ }
201
+ }
202
+ const method = 'PUT';
203
+ const path = '/_security/api_key';
204
+ return await this.transport.request({ path, method, querystring, body }, options);
205
+ }
206
+ async createServiceToken(params, options) {
207
+ const acceptedPath = ['namespace', 'service', 'name'];
208
+ const querystring = {};
209
+ const body = undefined;
210
+ for (const key in params) {
211
+ if (acceptedPath.includes(key)) {
212
+ continue;
213
+ }
214
+ else if (key !== 'body') {
215
+ // @ts-expect-error
216
+ querystring[key] = params[key];
217
+ }
218
+ }
219
+ let method = '';
220
+ let path = '';
221
+ if (params.namespace != null && params.service != null && params.name != null) {
222
+ method = 'PUT';
223
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token/${encodeURIComponent(params.name.toString())}`;
224
+ }
225
+ else {
226
+ method = 'POST';
227
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token`;
228
+ }
229
+ return await this.transport.request({ path, method, querystring, body }, options);
230
+ }
231
+ async deletePrivileges(params, options) {
232
+ const acceptedPath = ['application', 'name'];
233
+ const querystring = {};
234
+ const body = undefined;
235
+ for (const key in params) {
236
+ if (acceptedPath.includes(key)) {
237
+ continue;
238
+ }
239
+ else if (key !== 'body') {
240
+ // @ts-expect-error
241
+ querystring[key] = params[key];
242
+ }
243
+ }
244
+ const method = 'DELETE';
245
+ const path = `/_security/privilege/${encodeURIComponent(params.application.toString())}/${encodeURIComponent(params.name.toString())}`;
246
+ return await this.transport.request({ path, method, querystring, body }, options);
247
+ }
248
+ async deleteRole(params, options) {
249
+ const acceptedPath = ['name'];
250
+ const querystring = {};
251
+ const body = undefined;
252
+ for (const key in params) {
253
+ if (acceptedPath.includes(key)) {
254
+ continue;
255
+ }
256
+ else if (key !== 'body') {
257
+ // @ts-expect-error
258
+ querystring[key] = params[key];
259
+ }
260
+ }
261
+ const method = 'DELETE';
262
+ const path = `/_security/role/${encodeURIComponent(params.name.toString())}`;
263
+ return await this.transport.request({ path, method, querystring, body }, options);
264
+ }
265
+ async deleteRoleMapping(params, options) {
266
+ const acceptedPath = ['name'];
267
+ const querystring = {};
268
+ const body = undefined;
269
+ for (const key in params) {
270
+ if (acceptedPath.includes(key)) {
271
+ continue;
272
+ }
273
+ else if (key !== 'body') {
274
+ // @ts-expect-error
275
+ querystring[key] = params[key];
276
+ }
277
+ }
278
+ const method = 'DELETE';
279
+ const path = `/_security/role_mapping/${encodeURIComponent(params.name.toString())}`;
280
+ return await this.transport.request({ path, method, querystring, body }, options);
281
+ }
282
+ async deleteServiceToken(params, options) {
283
+ const acceptedPath = ['namespace', 'service', 'name'];
284
+ const querystring = {};
285
+ const body = undefined;
286
+ for (const key in params) {
287
+ if (acceptedPath.includes(key)) {
288
+ continue;
289
+ }
290
+ else if (key !== 'body') {
291
+ // @ts-expect-error
292
+ querystring[key] = params[key];
293
+ }
294
+ }
295
+ const method = 'DELETE';
296
+ const path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token/${encodeURIComponent(params.name.toString())}`;
297
+ return await this.transport.request({ path, method, querystring, body }, options);
298
+ }
299
+ async deleteUser(params, options) {
300
+ const acceptedPath = ['username'];
301
+ const querystring = {};
302
+ const body = undefined;
303
+ for (const key in params) {
304
+ if (acceptedPath.includes(key)) {
305
+ continue;
306
+ }
307
+ else if (key !== 'body') {
308
+ // @ts-expect-error
309
+ querystring[key] = params[key];
310
+ }
311
+ }
312
+ const method = 'DELETE';
313
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}`;
314
+ return await this.transport.request({ path, method, querystring, body }, options);
315
+ }
316
+ async disableUser(params, options) {
317
+ const acceptedPath = ['username'];
318
+ const querystring = {};
319
+ const body = undefined;
320
+ for (const key in params) {
321
+ if (acceptedPath.includes(key)) {
322
+ continue;
323
+ }
324
+ else if (key !== 'body') {
325
+ // @ts-expect-error
326
+ querystring[key] = params[key];
327
+ }
328
+ }
329
+ const method = 'PUT';
330
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}/_disable`;
331
+ return await this.transport.request({ path, method, querystring, body }, options);
332
+ }
333
+ async enableUser(params, options) {
334
+ const acceptedPath = ['username'];
335
+ const querystring = {};
336
+ const body = undefined;
337
+ for (const key in params) {
338
+ if (acceptedPath.includes(key)) {
339
+ continue;
340
+ }
341
+ else if (key !== 'body') {
342
+ // @ts-expect-error
343
+ querystring[key] = params[key];
344
+ }
345
+ }
346
+ const method = 'PUT';
347
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}/_enable`;
348
+ return await this.transport.request({ path, method, querystring, body }, options);
349
+ }
350
+ async enrollKibana(params, options) {
351
+ const acceptedPath = [];
352
+ const querystring = {};
353
+ const body = undefined;
354
+ params = params !== null && params !== void 0 ? params : {};
355
+ for (const key in params) {
356
+ if (acceptedPath.includes(key)) {
357
+ continue;
358
+ }
359
+ else if (key !== 'body') {
360
+ querystring[key] = params[key];
361
+ }
362
+ }
363
+ const method = 'GET';
364
+ const path = '/_security/enroll/kibana';
365
+ return await this.transport.request({ path, method, querystring, body }, options);
366
+ }
367
+ async enrollNode(params, options) {
368
+ const acceptedPath = [];
369
+ const querystring = {};
370
+ const body = undefined;
371
+ params = params !== null && params !== void 0 ? params : {};
372
+ for (const key in params) {
373
+ if (acceptedPath.includes(key)) {
374
+ continue;
375
+ }
376
+ else if (key !== 'body') {
377
+ querystring[key] = params[key];
378
+ }
379
+ }
380
+ const method = 'GET';
381
+ const path = '/_security/enroll/node';
382
+ return await this.transport.request({ path, method, querystring, body }, options);
383
+ }
384
+ async getApiKey(params, options) {
385
+ const acceptedPath = [];
386
+ const querystring = {};
387
+ const body = undefined;
388
+ params = params !== null && params !== void 0 ? params : {};
389
+ for (const key in params) {
390
+ if (acceptedPath.includes(key)) {
391
+ continue;
392
+ }
393
+ else if (key !== 'body') {
394
+ // @ts-expect-error
395
+ querystring[key] = params[key];
396
+ }
397
+ }
398
+ const method = 'GET';
399
+ const path = '/_security/api_key';
400
+ return await this.transport.request({ path, method, querystring, body }, options);
401
+ }
402
+ async getBuiltinPrivileges(params, options) {
403
+ const acceptedPath = [];
404
+ const querystring = {};
405
+ const body = undefined;
406
+ params = params !== null && params !== void 0 ? params : {};
407
+ for (const key in params) {
408
+ if (acceptedPath.includes(key)) {
409
+ continue;
410
+ }
411
+ else if (key !== 'body') {
412
+ // @ts-expect-error
413
+ querystring[key] = params[key];
414
+ }
415
+ }
416
+ const method = 'GET';
417
+ const path = '/_security/privilege/_builtin';
418
+ return await this.transport.request({ path, method, querystring, body }, options);
419
+ }
420
+ async getPrivileges(params, options) {
421
+ const acceptedPath = ['application', 'name'];
422
+ const querystring = {};
423
+ const body = undefined;
424
+ params = params !== null && params !== void 0 ? params : {};
425
+ for (const key in params) {
426
+ if (acceptedPath.includes(key)) {
427
+ continue;
428
+ }
429
+ else if (key !== 'body') {
430
+ // @ts-expect-error
431
+ querystring[key] = params[key];
432
+ }
433
+ }
434
+ let method = '';
435
+ let path = '';
436
+ if (params.application != null && params.name != null) {
437
+ method = 'GET';
438
+ path = `/_security/privilege/${encodeURIComponent(params.application.toString())}/${encodeURIComponent(params.name.toString())}`;
439
+ }
440
+ else if (params.application != null) {
441
+ method = 'GET';
442
+ path = `/_security/privilege/${encodeURIComponent(params.application.toString())}`;
443
+ }
444
+ else {
445
+ method = 'GET';
446
+ path = '/_security/privilege';
447
+ }
448
+ return await this.transport.request({ path, method, querystring, body }, options);
449
+ }
450
+ async getRole(params, options) {
451
+ const acceptedPath = ['name'];
452
+ const querystring = {};
453
+ const body = undefined;
454
+ params = params !== null && params !== void 0 ? params : {};
455
+ for (const key in params) {
456
+ if (acceptedPath.includes(key)) {
457
+ continue;
458
+ }
459
+ else if (key !== 'body') {
460
+ // @ts-expect-error
461
+ querystring[key] = params[key];
462
+ }
463
+ }
464
+ let method = '';
465
+ let path = '';
466
+ if (params.name != null) {
467
+ method = 'GET';
468
+ path = `/_security/role/${encodeURIComponent(params.name.toString())}`;
469
+ }
470
+ else {
471
+ method = 'GET';
472
+ path = '/_security/role';
473
+ }
474
+ return await this.transport.request({ path, method, querystring, body }, options);
475
+ }
476
+ async getRoleMapping(params, options) {
477
+ const acceptedPath = ['name'];
478
+ const querystring = {};
479
+ const body = undefined;
480
+ params = params !== null && params !== void 0 ? params : {};
481
+ for (const key in params) {
482
+ if (acceptedPath.includes(key)) {
483
+ continue;
484
+ }
485
+ else if (key !== 'body') {
486
+ // @ts-expect-error
487
+ querystring[key] = params[key];
488
+ }
489
+ }
490
+ let method = '';
491
+ let path = '';
492
+ if (params.name != null) {
493
+ method = 'GET';
494
+ path = `/_security/role_mapping/${encodeURIComponent(params.name.toString())}`;
495
+ }
496
+ else {
497
+ method = 'GET';
498
+ path = '/_security/role_mapping';
499
+ }
500
+ return await this.transport.request({ path, method, querystring, body }, options);
501
+ }
502
+ async getServiceAccounts(params, options) {
503
+ const acceptedPath = ['namespace', 'service'];
504
+ const querystring = {};
505
+ const body = undefined;
506
+ params = params !== null && params !== void 0 ? params : {};
507
+ for (const key in params) {
508
+ if (acceptedPath.includes(key)) {
509
+ continue;
510
+ }
511
+ else if (key !== 'body') {
512
+ // @ts-expect-error
513
+ querystring[key] = params[key];
514
+ }
515
+ }
516
+ let method = '';
517
+ let path = '';
518
+ if (params.namespace != null && params.service != null) {
519
+ method = 'GET';
520
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}`;
521
+ }
522
+ else if (params.namespace != null) {
523
+ method = 'GET';
524
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}`;
525
+ }
526
+ else {
527
+ method = 'GET';
528
+ path = '/_security/service';
529
+ }
530
+ return await this.transport.request({ path, method, querystring, body }, options);
531
+ }
532
+ async getServiceCredentials(params, options) {
533
+ const acceptedPath = ['namespace', 'service'];
534
+ const querystring = {};
535
+ const body = undefined;
536
+ for (const key in params) {
537
+ if (acceptedPath.includes(key)) {
538
+ continue;
539
+ }
540
+ else if (key !== 'body') {
541
+ // @ts-expect-error
542
+ querystring[key] = params[key];
543
+ }
544
+ }
545
+ const method = 'GET';
546
+ const path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential`;
547
+ return await this.transport.request({ path, method, querystring, body }, options);
548
+ }
549
+ async getToken(params, options) {
550
+ const acceptedPath = [];
551
+ const acceptedBody = ['grant_type', 'scope', 'password', 'kerberos_ticket', 'refresh_token', 'username'];
552
+ const querystring = {};
553
+ // @ts-expect-error
554
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
555
+ let body;
556
+ if (typeof userBody === 'string') {
557
+ body = userBody;
558
+ }
559
+ else {
560
+ body = userBody != null ? { ...userBody } : undefined;
561
+ }
562
+ params = params !== null && params !== void 0 ? params : {};
563
+ for (const key in params) {
564
+ if (acceptedBody.includes(key)) {
565
+ body = body !== null && body !== void 0 ? body : {};
566
+ // @ts-expect-error
567
+ body[key] = params[key];
568
+ }
569
+ else if (acceptedPath.includes(key)) {
570
+ continue;
571
+ }
572
+ else if (key !== 'body') {
573
+ // @ts-expect-error
574
+ querystring[key] = params[key];
575
+ }
576
+ }
577
+ const method = 'POST';
578
+ const path = '/_security/oauth2/token';
579
+ return await this.transport.request({ path, method, querystring, body }, options);
580
+ }
581
+ async getUser(params, options) {
582
+ const acceptedPath = ['username'];
583
+ const querystring = {};
584
+ const body = undefined;
585
+ params = params !== null && params !== void 0 ? params : {};
586
+ for (const key in params) {
587
+ if (acceptedPath.includes(key)) {
588
+ continue;
589
+ }
590
+ else if (key !== 'body') {
591
+ // @ts-expect-error
592
+ querystring[key] = params[key];
593
+ }
594
+ }
595
+ let method = '';
596
+ let path = '';
597
+ if (params.username != null) {
598
+ method = 'GET';
599
+ path = `/_security/user/${encodeURIComponent(params.username.toString())}`;
600
+ }
601
+ else {
602
+ method = 'GET';
603
+ path = '/_security/user';
604
+ }
605
+ return await this.transport.request({ path, method, querystring, body }, options);
606
+ }
607
+ async getUserPrivileges(params, options) {
608
+ const acceptedPath = [];
609
+ const querystring = {};
610
+ const body = undefined;
611
+ params = params !== null && params !== void 0 ? params : {};
612
+ for (const key in params) {
613
+ if (acceptedPath.includes(key)) {
614
+ continue;
615
+ }
616
+ else if (key !== 'body') {
617
+ // @ts-expect-error
618
+ querystring[key] = params[key];
619
+ }
620
+ }
621
+ const method = 'GET';
622
+ const path = '/_security/user/_privileges';
623
+ return await this.transport.request({ path, method, querystring, body }, options);
624
+ }
625
+ async grantApiKey(params, options) {
626
+ const acceptedPath = [];
627
+ const acceptedBody = ['api_key', 'grant_type', 'access_token', 'username', 'password'];
628
+ const querystring = {};
629
+ // @ts-expect-error
630
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
631
+ let body;
632
+ if (typeof userBody === 'string') {
633
+ body = userBody;
634
+ }
635
+ else {
636
+ body = userBody != null ? { ...userBody } : undefined;
637
+ }
638
+ for (const key in params) {
639
+ if (acceptedBody.includes(key)) {
640
+ body = body !== null && body !== void 0 ? body : {};
641
+ // @ts-expect-error
642
+ body[key] = params[key];
643
+ }
644
+ else if (acceptedPath.includes(key)) {
645
+ continue;
646
+ }
647
+ else if (key !== 'body') {
648
+ // @ts-expect-error
649
+ querystring[key] = params[key];
650
+ }
651
+ }
652
+ const method = 'POST';
653
+ const path = '/_security/api_key/grant';
654
+ return await this.transport.request({ path, method, querystring, body }, options);
655
+ }
656
+ async hasPrivileges(params, options) {
657
+ const acceptedPath = ['user'];
658
+ const acceptedBody = ['application', 'cluster', 'index'];
659
+ const querystring = {};
660
+ // @ts-expect-error
661
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
662
+ let body;
663
+ if (typeof userBody === 'string') {
664
+ body = userBody;
665
+ }
666
+ else {
667
+ body = userBody != null ? { ...userBody } : undefined;
668
+ }
669
+ params = params !== null && params !== void 0 ? params : {};
670
+ for (const key in params) {
671
+ if (acceptedBody.includes(key)) {
672
+ body = body !== null && body !== void 0 ? body : {};
673
+ // @ts-expect-error
674
+ body[key] = params[key];
675
+ }
676
+ else if (acceptedPath.includes(key)) {
677
+ continue;
678
+ }
679
+ else if (key !== 'body') {
680
+ // @ts-expect-error
681
+ querystring[key] = params[key];
682
+ }
683
+ }
684
+ let method = '';
685
+ let path = '';
686
+ if (params.user != null) {
687
+ method = body != null ? 'POST' : 'GET';
688
+ path = `/_security/user/${encodeURIComponent(params.user.toString())}/_has_privileges`;
689
+ }
690
+ else {
691
+ method = body != null ? 'POST' : 'GET';
692
+ path = '/_security/user/_has_privileges';
693
+ }
694
+ return await this.transport.request({ path, method, querystring, body }, options);
695
+ }
696
+ async invalidateApiKey(params, options) {
697
+ const acceptedPath = [];
698
+ const acceptedBody = ['id', 'ids', 'name', 'owner', 'realm_name', 'username'];
699
+ const querystring = {};
700
+ // @ts-expect-error
701
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
702
+ let body;
703
+ if (typeof userBody === 'string') {
704
+ body = userBody;
705
+ }
706
+ else {
707
+ body = userBody != null ? { ...userBody } : undefined;
708
+ }
709
+ params = params !== null && params !== void 0 ? params : {};
710
+ for (const key in params) {
711
+ if (acceptedBody.includes(key)) {
712
+ body = body !== null && body !== void 0 ? body : {};
713
+ // @ts-expect-error
714
+ body[key] = params[key];
715
+ }
716
+ else if (acceptedPath.includes(key)) {
717
+ continue;
718
+ }
719
+ else if (key !== 'body') {
720
+ // @ts-expect-error
721
+ querystring[key] = params[key];
722
+ }
723
+ }
724
+ const method = 'DELETE';
725
+ const path = '/_security/api_key';
726
+ return await this.transport.request({ path, method, querystring, body }, options);
727
+ }
728
+ async invalidateToken(params, options) {
729
+ const acceptedPath = [];
730
+ const acceptedBody = ['token', 'refresh_token', 'realm_name', 'username'];
731
+ const querystring = {};
732
+ // @ts-expect-error
733
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
734
+ let body;
735
+ if (typeof userBody === 'string') {
736
+ body = userBody;
737
+ }
738
+ else {
739
+ body = userBody != null ? { ...userBody } : undefined;
740
+ }
741
+ params = params !== null && params !== void 0 ? params : {};
742
+ for (const key in params) {
743
+ if (acceptedBody.includes(key)) {
744
+ body = body !== null && body !== void 0 ? body : {};
745
+ // @ts-expect-error
746
+ body[key] = params[key];
747
+ }
748
+ else if (acceptedPath.includes(key)) {
749
+ continue;
750
+ }
751
+ else if (key !== 'body') {
752
+ // @ts-expect-error
753
+ querystring[key] = params[key];
754
+ }
755
+ }
756
+ const method = 'DELETE';
757
+ const path = '/_security/oauth2/token';
758
+ return await this.transport.request({ path, method, querystring, body }, options);
759
+ }
760
+ async putPrivileges(params, options) {
761
+ var _a;
762
+ const acceptedPath = [];
763
+ const acceptedBody = ['privileges'];
764
+ const querystring = {};
765
+ // @ts-expect-error
766
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
767
+ for (const key in params) {
768
+ if (acceptedBody.includes(key)) {
769
+ // @ts-expect-error
770
+ body = params[key];
771
+ }
772
+ else if (acceptedPath.includes(key)) {
773
+ continue;
774
+ }
775
+ else if (key !== 'body') {
776
+ // @ts-expect-error
777
+ querystring[key] = params[key];
778
+ }
779
+ }
780
+ const method = 'PUT';
781
+ const path = '/_security/privilege/';
782
+ return await this.transport.request({ path, method, querystring, body }, options);
783
+ }
784
+ async putRole(params, options) {
785
+ const acceptedPath = ['name'];
786
+ const acceptedBody = ['applications', 'cluster', 'global', 'indices', 'metadata', 'run_as', 'transient_metadata'];
787
+ const querystring = {};
788
+ // @ts-expect-error
789
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
790
+ let body;
791
+ if (typeof userBody === 'string') {
792
+ body = userBody;
793
+ }
794
+ else {
795
+ body = userBody != null ? { ...userBody } : undefined;
796
+ }
797
+ for (const key in params) {
798
+ if (acceptedBody.includes(key)) {
799
+ body = body !== null && body !== void 0 ? body : {};
800
+ // @ts-expect-error
801
+ body[key] = params[key];
802
+ }
803
+ else if (acceptedPath.includes(key)) {
804
+ continue;
805
+ }
806
+ else if (key !== 'body') {
807
+ // @ts-expect-error
808
+ querystring[key] = params[key];
809
+ }
810
+ }
811
+ const method = 'PUT';
812
+ const path = `/_security/role/${encodeURIComponent(params.name.toString())}`;
813
+ return await this.transport.request({ path, method, querystring, body }, options);
814
+ }
815
+ async putRoleMapping(params, options) {
816
+ const acceptedPath = ['name'];
817
+ const acceptedBody = ['enabled', 'metadata', 'roles', 'rules', 'run_as'];
818
+ const querystring = {};
819
+ // @ts-expect-error
820
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
821
+ let body;
822
+ if (typeof userBody === 'string') {
823
+ body = userBody;
824
+ }
825
+ else {
826
+ body = userBody != null ? { ...userBody } : undefined;
827
+ }
828
+ for (const key in params) {
829
+ if (acceptedBody.includes(key)) {
830
+ body = body !== null && body !== void 0 ? body : {};
831
+ // @ts-expect-error
832
+ body[key] = params[key];
833
+ }
834
+ else if (acceptedPath.includes(key)) {
835
+ continue;
836
+ }
837
+ else if (key !== 'body') {
838
+ // @ts-expect-error
839
+ querystring[key] = params[key];
840
+ }
841
+ }
842
+ const method = 'PUT';
843
+ const path = `/_security/role_mapping/${encodeURIComponent(params.name.toString())}`;
844
+ return await this.transport.request({ path, method, querystring, body }, options);
845
+ }
846
+ async putUser(params, options) {
847
+ const acceptedPath = [];
848
+ const acceptedBody = ['username', 'email', 'full_name', 'metadata', 'password', 'password_hash', 'roles', 'enabled'];
849
+ const querystring = {};
850
+ // @ts-expect-error
851
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
852
+ let body;
853
+ if (typeof userBody === 'string') {
854
+ body = userBody;
855
+ }
856
+ else {
857
+ body = userBody != null ? { ...userBody } : undefined;
858
+ }
859
+ for (const key in params) {
860
+ if (acceptedBody.includes(key)) {
861
+ body = body !== null && body !== void 0 ? body : {};
862
+ // @ts-expect-error
863
+ body[key] = params[key];
864
+ }
865
+ else if (acceptedPath.includes(key)) {
866
+ continue;
867
+ }
868
+ else if (key !== 'body') {
869
+ // @ts-expect-error
870
+ querystring[key] = params[key];
871
+ }
872
+ }
873
+ const method = 'PUT';
874
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}`;
875
+ return await this.transport.request({ path, method, querystring, body }, options);
876
+ }
877
+ async queryApiKeys(params, options) {
878
+ const acceptedPath = [];
879
+ const querystring = {};
880
+ const body = undefined;
881
+ params = params !== null && params !== void 0 ? params : {};
882
+ for (const key in params) {
883
+ if (acceptedPath.includes(key)) {
884
+ continue;
885
+ }
886
+ else if (key !== 'body') {
887
+ querystring[key] = params[key];
888
+ }
889
+ }
890
+ const method = body != null ? 'POST' : 'GET';
891
+ const path = '/_security/_query/api_key';
892
+ return await this.transport.request({ path, method, querystring, body }, options);
893
+ }
894
+ async samlAuthenticate(params, options) {
895
+ const acceptedPath = [];
896
+ const querystring = {};
897
+ const body = undefined;
898
+ params = params !== null && params !== void 0 ? params : {};
899
+ for (const key in params) {
900
+ if (acceptedPath.includes(key)) {
901
+ continue;
902
+ }
903
+ else if (key !== 'body') {
904
+ querystring[key] = params[key];
905
+ }
906
+ }
907
+ const method = 'POST';
908
+ const path = '/_security/saml/authenticate';
909
+ return await this.transport.request({ path, method, querystring, body }, options);
910
+ }
911
+ async samlCompleteLogout(params, options) {
912
+ const acceptedPath = [];
913
+ const querystring = {};
914
+ const body = undefined;
915
+ params = params !== null && params !== void 0 ? params : {};
916
+ for (const key in params) {
917
+ if (acceptedPath.includes(key)) {
918
+ continue;
919
+ }
920
+ else if (key !== 'body') {
921
+ querystring[key] = params[key];
922
+ }
923
+ }
924
+ const method = 'POST';
925
+ const path = '/_security/saml/complete_logout';
926
+ return await this.transport.request({ path, method, querystring, body }, options);
927
+ }
928
+ async samlInvalidate(params, options) {
929
+ const acceptedPath = [];
930
+ const querystring = {};
931
+ const body = undefined;
932
+ params = params !== null && params !== void 0 ? params : {};
933
+ for (const key in params) {
934
+ if (acceptedPath.includes(key)) {
935
+ continue;
936
+ }
937
+ else if (key !== 'body') {
938
+ querystring[key] = params[key];
939
+ }
940
+ }
941
+ const method = 'POST';
942
+ const path = '/_security/saml/invalidate';
943
+ return await this.transport.request({ path, method, querystring, body }, options);
944
+ }
945
+ async samlLogout(params, options) {
946
+ const acceptedPath = [];
947
+ const querystring = {};
948
+ const body = undefined;
949
+ params = params !== null && params !== void 0 ? params : {};
950
+ for (const key in params) {
951
+ if (acceptedPath.includes(key)) {
952
+ continue;
953
+ }
954
+ else if (key !== 'body') {
955
+ querystring[key] = params[key];
956
+ }
957
+ }
958
+ const method = 'POST';
959
+ const path = '/_security/saml/logout';
960
+ return await this.transport.request({ path, method, querystring, body }, options);
961
+ }
962
+ async samlPrepareAuthentication(params, options) {
963
+ const acceptedPath = [];
964
+ const querystring = {};
965
+ const body = undefined;
966
+ params = params !== null && params !== void 0 ? params : {};
967
+ for (const key in params) {
968
+ if (acceptedPath.includes(key)) {
969
+ continue;
970
+ }
971
+ else if (key !== 'body') {
972
+ querystring[key] = params[key];
973
+ }
974
+ }
975
+ const method = 'POST';
976
+ const path = '/_security/saml/prepare';
977
+ return await this.transport.request({ path, method, querystring, body }, options);
978
+ }
979
+ async samlServiceProviderMetadata(params, options) {
980
+ const acceptedPath = ['realm_name'];
981
+ const querystring = {};
982
+ const body = undefined;
983
+ params = params !== null && params !== void 0 ? params : {};
984
+ for (const key in params) {
985
+ if (acceptedPath.includes(key)) {
986
+ continue;
987
+ }
988
+ else if (key !== 'body') {
989
+ querystring[key] = params[key];
990
+ }
991
+ }
992
+ const method = 'GET';
993
+ const path = `/_security/saml/metadata/${encodeURIComponent(params.realm_name.toString())}`;
994
+ return await this.transport.request({ path, method, querystring, body }, options);
995
+ }
996
+ }
997
+ exports.default = Security;
998
+ //# sourceMappingURL=security.js.map