@retter/elasticsearch 8.4.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 (256) hide show
  1. package/.dockerignore +5 -0
  2. package/CHANGELOG.md +3 -0
  3. package/LICENSE +202 -0
  4. package/NOTICE.txt +2 -0
  5. package/README.md +186 -0
  6. package/codecov.yml +14 -0
  7. package/index.d.ts +27 -0
  8. package/index.js +55 -0
  9. package/lib/api/api/async_search.d.ts +23 -0
  10. package/lib/api/api/async_search.js +131 -0
  11. package/lib/api/api/async_search.js.map +1 -0
  12. package/lib/api/api/autoscaling.d.ts +23 -0
  13. package/lib/api/api/autoscaling.js +109 -0
  14. package/lib/api/api/autoscaling.js.map +1 -0
  15. package/lib/api/api/bulk.d.ts +10 -0
  16. package/lib/api/api/bulk.js +54 -0
  17. package/lib/api/api/bulk.js.map +1 -0
  18. package/lib/api/api/cat.d.ts +89 -0
  19. package/lib/api/api/cat.js +637 -0
  20. package/lib/api/api/cat.js.map +1 -0
  21. package/lib/api/api/ccr.d.ts +50 -0
  22. package/lib/api/api/ccr.js +320 -0
  23. package/lib/api/api/ccr.js.map +1 -0
  24. package/lib/api/api/clear_scroll.d.ts +10 -0
  25. package/lib/api/api/clear_scroll.js +54 -0
  26. package/lib/api/api/clear_scroll.js.map +1 -0
  27. package/lib/api/api/close_point_in_time.d.ts +10 -0
  28. package/lib/api/api/close_point_in_time.js +53 -0
  29. package/lib/api/api/close_point_in_time.js.map +1 -0
  30. package/lib/api/api/cluster.d.ts +56 -0
  31. package/lib/api/api/cluster.js +392 -0
  32. package/lib/api/api/cluster.js.map +1 -0
  33. package/lib/api/api/count.d.ts +10 -0
  34. package/lib/api/api/count.js +62 -0
  35. package/lib/api/api/count.js.map +1 -0
  36. package/lib/api/api/create.d.ts +10 -0
  37. package/lib/api/api/create.js +46 -0
  38. package/lib/api/api/create.js.map +1 -0
  39. package/lib/api/api/dangling_indices.d.ts +20 -0
  40. package/lib/api/api/dangling_indices.js +85 -0
  41. package/lib/api/api/dangling_indices.js.map +1 -0
  42. package/lib/api/api/delete.d.ts +10 -0
  43. package/lib/api/api/delete.js +39 -0
  44. package/lib/api/api/delete.js.map +1 -0
  45. package/lib/api/api/delete_by_query.d.ts +10 -0
  46. package/lib/api/api/delete_by_query.js +53 -0
  47. package/lib/api/api/delete_by_query.js.map +1 -0
  48. package/lib/api/api/delete_by_query_rethrottle.d.ts +10 -0
  49. package/lib/api/api/delete_by_query_rethrottle.js +39 -0
  50. package/lib/api/api/delete_by_query_rethrottle.js.map +1 -0
  51. package/lib/api/api/delete_script.d.ts +10 -0
  52. package/lib/api/api/delete_script.js +39 -0
  53. package/lib/api/api/delete_script.js.map +1 -0
  54. package/lib/api/api/enrich.d.ts +26 -0
  55. package/lib/api/api/enrich.js +142 -0
  56. package/lib/api/api/enrich.js.map +1 -0
  57. package/lib/api/api/eql.d.ts +23 -0
  58. package/lib/api/api/eql.js +115 -0
  59. package/lib/api/api/eql.js.map +1 -0
  60. package/lib/api/api/exists.d.ts +10 -0
  61. package/lib/api/api/exists.js +39 -0
  62. package/lib/api/api/exists.js.map +1 -0
  63. package/lib/api/api/exists_source.d.ts +10 -0
  64. package/lib/api/api/exists_source.js +39 -0
  65. package/lib/api/api/exists_source.js.map +1 -0
  66. package/lib/api/api/explain.d.ts +10 -0
  67. package/lib/api/api/explain.js +53 -0
  68. package/lib/api/api/explain.js.map +1 -0
  69. package/lib/api/api/features.d.ts +17 -0
  70. package/lib/api/api/features.js +69 -0
  71. package/lib/api/api/features.js.map +1 -0
  72. package/lib/api/api/field_caps.d.ts +10 -0
  73. package/lib/api/api/field_caps.js +61 -0
  74. package/lib/api/api/field_caps.js.map +1 -0
  75. package/lib/api/api/fleet.d.ts +20 -0
  76. package/lib/api/api/fleet.js +113 -0
  77. package/lib/api/api/fleet.js.map +1 -0
  78. package/lib/api/api/get.d.ts +10 -0
  79. package/lib/api/api/get.js +39 -0
  80. package/lib/api/api/get.js.map +1 -0
  81. package/lib/api/api/get_script.d.ts +10 -0
  82. package/lib/api/api/get_script.js +39 -0
  83. package/lib/api/api/get_script.js.map +1 -0
  84. package/lib/api/api/get_script_context.d.ts +10 -0
  85. package/lib/api/api/get_script_context.js +40 -0
  86. package/lib/api/api/get_script_context.js.map +1 -0
  87. package/lib/api/api/get_script_languages.d.ts +10 -0
  88. package/lib/api/api/get_script_languages.js +40 -0
  89. package/lib/api/api/get_script_languages.js.map +1 -0
  90. package/lib/api/api/get_source.d.ts +10 -0
  91. package/lib/api/api/get_source.js +39 -0
  92. package/lib/api/api/get_source.js.map +1 -0
  93. package/lib/api/api/graph.d.ts +14 -0
  94. package/lib/api/api/graph.js +64 -0
  95. package/lib/api/api/graph.js.map +1 -0
  96. package/lib/api/api/ilm.d.ts +44 -0
  97. package/lib/api/api/ilm.js +275 -0
  98. package/lib/api/api/ilm.js.map +1 -0
  99. package/lib/api/api/index.d.ts +10 -0
  100. package/lib/api/api/index.js +54 -0
  101. package/lib/api/api/index.js.map +1 -0
  102. package/lib/api/api/indices.d.ts +170 -0
  103. package/lib/api/api/indices.js +1378 -0
  104. package/lib/api/api/indices.js.map +1 -0
  105. package/lib/api/api/info.d.ts +10 -0
  106. package/lib/api/api/info.js +40 -0
  107. package/lib/api/api/info.js.map +1 -0
  108. package/lib/api/api/ingest.d.ts +29 -0
  109. package/lib/api/api/ingest.js +183 -0
  110. package/lib/api/api/ingest.js.map +1 -0
  111. package/lib/api/api/knn_search.d.ts +10 -0
  112. package/lib/api/api/knn_search.js +53 -0
  113. package/lib/api/api/knn_search.js.map +1 -0
  114. package/lib/api/api/license.d.ts +32 -0
  115. package/lib/api/api/license.js +172 -0
  116. package/lib/api/api/license.js.map +1 -0
  117. package/lib/api/api/logstash.d.ts +20 -0
  118. package/lib/api/api/logstash.js +91 -0
  119. package/lib/api/api/logstash.js.map +1 -0
  120. package/lib/api/api/mget.d.ts +10 -0
  121. package/lib/api/api/mget.js +62 -0
  122. package/lib/api/api/mget.js.map +1 -0
  123. package/lib/api/api/migration.d.ts +20 -0
  124. package/lib/api/api/migration.js +95 -0
  125. package/lib/api/api/migration.js.map +1 -0
  126. package/lib/api/api/ml.d.ts +224 -0
  127. package/lib/api/api/ml.js +1929 -0
  128. package/lib/api/api/ml.js.map +1 -0
  129. package/lib/api/api/monitoring.d.ts +14 -0
  130. package/lib/api/api/monitoring.js +57 -0
  131. package/lib/api/api/monitoring.js.map +1 -0
  132. package/lib/api/api/msearch.d.ts +10 -0
  133. package/lib/api/api/msearch.js +54 -0
  134. package/lib/api/api/msearch.js.map +1 -0
  135. package/lib/api/api/msearch_template.d.ts +10 -0
  136. package/lib/api/api/msearch_template.js +54 -0
  137. package/lib/api/api/msearch_template.js.map +1 -0
  138. package/lib/api/api/mtermvectors.d.ts +10 -0
  139. package/lib/api/api/mtermvectors.js +62 -0
  140. package/lib/api/api/mtermvectors.js.map +1 -0
  141. package/lib/api/api/nodes.d.ts +32 -0
  142. package/lib/api/api/nodes.js +243 -0
  143. package/lib/api/api/nodes.js.map +1 -0
  144. package/lib/api/api/open_point_in_time.d.ts +10 -0
  145. package/lib/api/api/open_point_in_time.js +39 -0
  146. package/lib/api/api/open_point_in_time.js.map +1 -0
  147. package/lib/api/api/ping.d.ts +10 -0
  148. package/lib/api/api/ping.js +40 -0
  149. package/lib/api/api/ping.js.map +1 -0
  150. package/lib/api/api/put_script.d.ts +10 -0
  151. package/lib/api/api/put_script.js +61 -0
  152. package/lib/api/api/put_script.js.map +1 -0
  153. package/lib/api/api/rank_eval.d.ts +10 -0
  154. package/lib/api/api/rank_eval.js +61 -0
  155. package/lib/api/api/rank_eval.js.map +1 -0
  156. package/lib/api/api/reindex.d.ts +10 -0
  157. package/lib/api/api/reindex.js +53 -0
  158. package/lib/api/api/reindex.js.map +1 -0
  159. package/lib/api/api/reindex_rethrottle.d.ts +10 -0
  160. package/lib/api/api/reindex_rethrottle.js +39 -0
  161. package/lib/api/api/reindex_rethrottle.js.map +1 -0
  162. package/lib/api/api/render_search_template.d.ts +10 -0
  163. package/lib/api/api/render_search_template.js +62 -0
  164. package/lib/api/api/render_search_template.js.map +1 -0
  165. package/lib/api/api/rollup.d.ts +38 -0
  166. package/lib/api/api/rollup.js +239 -0
  167. package/lib/api/api/rollup.js.map +1 -0
  168. package/lib/api/api/scripts_painless_execute.d.ts +10 -0
  169. package/lib/api/api/scripts_painless_execute.js +54 -0
  170. package/lib/api/api/scripts_painless_execute.js.map +1 -0
  171. package/lib/api/api/scroll.d.ts +10 -0
  172. package/lib/api/api/scroll.js +53 -0
  173. package/lib/api/api/scroll.js.map +1 -0
  174. package/lib/api/api/search.d.ts +10 -0
  175. package/lib/api/api/search.js +69 -0
  176. package/lib/api/api/search.js.map +1 -0
  177. package/lib/api/api/search_mvt.d.ts +10 -0
  178. package/lib/api/api/search_mvt.js +53 -0
  179. package/lib/api/api/search_mvt.js.map +1 -0
  180. package/lib/api/api/search_shards.d.ts +10 -0
  181. package/lib/api/api/search_shards.js +48 -0
  182. package/lib/api/api/search_shards.js.map +1 -0
  183. package/lib/api/api/search_template.d.ts +10 -0
  184. package/lib/api/api/search_template.js +62 -0
  185. package/lib/api/api/search_template.js.map +1 -0
  186. package/lib/api/api/searchable_snapshots.d.ts +23 -0
  187. package/lib/api/api/searchable_snapshots.js +142 -0
  188. package/lib/api/api/searchable_snapshots.js.map +1 -0
  189. package/lib/api/api/security.d.ts +173 -0
  190. package/lib/api/api/security.js +1344 -0
  191. package/lib/api/api/security.js.map +1 -0
  192. package/lib/api/api/shutdown.d.ts +20 -0
  193. package/lib/api/api/shutdown.js +107 -0
  194. package/lib/api/api/shutdown.js.map +1 -0
  195. package/lib/api/api/slm.d.ts +38 -0
  196. package/lib/api/api/slm.js +214 -0
  197. package/lib/api/api/slm.js.map +1 -0
  198. package/lib/api/api/snapshot.d.ts +47 -0
  199. package/lib/api/api/snapshot.js +315 -0
  200. package/lib/api/api/snapshot.js.map +1 -0
  201. package/lib/api/api/sql.d.ts +29 -0
  202. package/lib/api/api/sql.js +178 -0
  203. package/lib/api/api/sql.js.map +1 -0
  204. package/lib/api/api/ssl.d.ts +14 -0
  205. package/lib/api/api/ssl.js +51 -0
  206. package/lib/api/api/ssl.js.map +1 -0
  207. package/lib/api/api/tasks.d.ts +20 -0
  208. package/lib/api/api/tasks.js +94 -0
  209. package/lib/api/api/tasks.js.map +1 -0
  210. package/lib/api/api/terms_enum.d.ts +10 -0
  211. package/lib/api/api/terms_enum.js +53 -0
  212. package/lib/api/api/terms_enum.js.map +1 -0
  213. package/lib/api/api/termvectors.d.ts +10 -0
  214. package/lib/api/api/termvectors.js +61 -0
  215. package/lib/api/api/termvectors.js.map +1 -0
  216. package/lib/api/api/text_structure.d.ts +14 -0
  217. package/lib/api/api/text_structure.js +57 -0
  218. package/lib/api/api/text_structure.js.map +1 -0
  219. package/lib/api/api/transform.d.ts +41 -0
  220. package/lib/api/api/transform.js +264 -0
  221. package/lib/api/api/transform.js.map +1 -0
  222. package/lib/api/api/update.d.ts +10 -0
  223. package/lib/api/api/update.js +53 -0
  224. package/lib/api/api/update.js.map +1 -0
  225. package/lib/api/api/update_by_query.d.ts +10 -0
  226. package/lib/api/api/update_by_query.js +53 -0
  227. package/lib/api/api/update_by_query.js.map +1 -0
  228. package/lib/api/api/update_by_query_rethrottle.d.ts +10 -0
  229. package/lib/api/api/update_by_query_rethrottle.js +39 -0
  230. package/lib/api/api/update_by_query_rethrottle.js.map +1 -0
  231. package/lib/api/api/watcher.d.ts +44 -0
  232. package/lib/api/api/watcher.js +291 -0
  233. package/lib/api/api/watcher.js.map +1 -0
  234. package/lib/api/api/xpack.d.ts +17 -0
  235. package/lib/api/api/xpack.js +69 -0
  236. package/lib/api/api/xpack.js.map +1 -0
  237. package/lib/api/index.d.ts +225 -0
  238. package/lib/api/index.js +520 -0
  239. package/lib/api/index.js.map +1 -0
  240. package/lib/api/types.d.ts +15306 -0
  241. package/lib/api/types.js +21 -0
  242. package/lib/api/types.js.map +1 -0
  243. package/lib/api/typesWithBodyKey.d.ts +15718 -0
  244. package/lib/api/typesWithBodyKey.js +21 -0
  245. package/lib/api/typesWithBodyKey.js.map +1 -0
  246. package/lib/client.d.ts +70 -0
  247. package/lib/client.js +287 -0
  248. package/lib/client.js.map +1 -0
  249. package/lib/helpers.d.ts +149 -0
  250. package/lib/helpers.js +776 -0
  251. package/lib/helpers.js.map +1 -0
  252. package/lib/sniffingTransport.d.ts +4 -0
  253. package/lib/sniffingTransport.js +56 -0
  254. package/lib/sniffingTransport.js.map +1 -0
  255. package/package.json +93 -0
  256. package/tsconfig.json +37 -0
@@ -0,0 +1,1344 @@
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 activateUserProfile(params, options) {
32
+ const acceptedPath = [];
33
+ const acceptedBody = ['access_token', 'grant_type', 'password', 'username'];
34
+ const querystring = {};
35
+ // @ts-expect-error
36
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
37
+ let body;
38
+ if (typeof userBody === 'string') {
39
+ body = userBody;
40
+ }
41
+ else {
42
+ body = userBody != null ? { ...userBody } : undefined;
43
+ }
44
+ for (const key in params) {
45
+ if (acceptedBody.includes(key)) {
46
+ body = body !== null && body !== void 0 ? body : {};
47
+ // @ts-expect-error
48
+ body[key] = params[key];
49
+ }
50
+ else if (acceptedPath.includes(key)) {
51
+ continue;
52
+ }
53
+ else if (key !== 'body') {
54
+ // @ts-expect-error
55
+ querystring[key] = params[key];
56
+ }
57
+ }
58
+ const method = 'POST';
59
+ const path = '/_security/profile/_activate';
60
+ return await this.transport.request({ path, method, querystring, body }, options);
61
+ }
62
+ async authenticate(params, options) {
63
+ const acceptedPath = [];
64
+ const querystring = {};
65
+ const body = undefined;
66
+ params = params !== null && params !== void 0 ? params : {};
67
+ for (const key in params) {
68
+ if (acceptedPath.includes(key)) {
69
+ continue;
70
+ }
71
+ else if (key !== 'body') {
72
+ // @ts-expect-error
73
+ querystring[key] = params[key];
74
+ }
75
+ }
76
+ const method = 'GET';
77
+ const path = '/_security/_authenticate';
78
+ return await this.transport.request({ path, method, querystring, body }, options);
79
+ }
80
+ async changePassword(params, options) {
81
+ const acceptedPath = ['username'];
82
+ const acceptedBody = ['password', 'password_hash'];
83
+ const querystring = {};
84
+ // @ts-expect-error
85
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
86
+ let body;
87
+ if (typeof userBody === 'string') {
88
+ body = userBody;
89
+ }
90
+ else {
91
+ body = userBody != null ? { ...userBody } : undefined;
92
+ }
93
+ params = params !== null && params !== void 0 ? params : {};
94
+ for (const key in params) {
95
+ if (acceptedBody.includes(key)) {
96
+ body = body !== null && body !== void 0 ? body : {};
97
+ // @ts-expect-error
98
+ body[key] = params[key];
99
+ }
100
+ else if (acceptedPath.includes(key)) {
101
+ continue;
102
+ }
103
+ else if (key !== 'body') {
104
+ // @ts-expect-error
105
+ querystring[key] = params[key];
106
+ }
107
+ }
108
+ let method = '';
109
+ let path = '';
110
+ if (params.username != null) {
111
+ method = 'PUT';
112
+ path = `/_security/user/${encodeURIComponent(params.username.toString())}/_password`;
113
+ }
114
+ else {
115
+ method = 'PUT';
116
+ path = '/_security/user/_password';
117
+ }
118
+ return await this.transport.request({ path, method, querystring, body }, options);
119
+ }
120
+ async clearApiKeyCache(params, options) {
121
+ const acceptedPath = ['ids'];
122
+ const querystring = {};
123
+ const body = undefined;
124
+ for (const key in params) {
125
+ if (acceptedPath.includes(key)) {
126
+ continue;
127
+ }
128
+ else if (key !== 'body') {
129
+ // @ts-expect-error
130
+ querystring[key] = params[key];
131
+ }
132
+ }
133
+ const method = 'POST';
134
+ const path = `/_security/api_key/${encodeURIComponent(params.ids.toString())}/_clear_cache`;
135
+ return await this.transport.request({ path, method, querystring, body }, options);
136
+ }
137
+ async clearCachedPrivileges(params, options) {
138
+ const acceptedPath = ['application'];
139
+ const querystring = {};
140
+ const body = undefined;
141
+ for (const key in params) {
142
+ if (acceptedPath.includes(key)) {
143
+ continue;
144
+ }
145
+ else if (key !== 'body') {
146
+ // @ts-expect-error
147
+ querystring[key] = params[key];
148
+ }
149
+ }
150
+ const method = 'POST';
151
+ const path = `/_security/privilege/${encodeURIComponent(params.application.toString())}/_clear_cache`;
152
+ return await this.transport.request({ path, method, querystring, body }, options);
153
+ }
154
+ async clearCachedRealms(params, options) {
155
+ const acceptedPath = ['realms'];
156
+ const querystring = {};
157
+ const body = undefined;
158
+ for (const key in params) {
159
+ if (acceptedPath.includes(key)) {
160
+ continue;
161
+ }
162
+ else if (key !== 'body') {
163
+ // @ts-expect-error
164
+ querystring[key] = params[key];
165
+ }
166
+ }
167
+ const method = 'POST';
168
+ const path = `/_security/realm/${encodeURIComponent(params.realms.toString())}/_clear_cache`;
169
+ return await this.transport.request({ path, method, querystring, body }, options);
170
+ }
171
+ async clearCachedRoles(params, options) {
172
+ const acceptedPath = ['name'];
173
+ const querystring = {};
174
+ const body = undefined;
175
+ for (const key in params) {
176
+ if (acceptedPath.includes(key)) {
177
+ continue;
178
+ }
179
+ else if (key !== 'body') {
180
+ // @ts-expect-error
181
+ querystring[key] = params[key];
182
+ }
183
+ }
184
+ const method = 'POST';
185
+ const path = `/_security/role/${encodeURIComponent(params.name.toString())}/_clear_cache`;
186
+ return await this.transport.request({ path, method, querystring, body }, options);
187
+ }
188
+ async clearCachedServiceTokens(params, options) {
189
+ const acceptedPath = ['namespace', 'service', 'name'];
190
+ const querystring = {};
191
+ const body = undefined;
192
+ for (const key in params) {
193
+ if (acceptedPath.includes(key)) {
194
+ continue;
195
+ }
196
+ else if (key !== 'body') {
197
+ // @ts-expect-error
198
+ querystring[key] = params[key];
199
+ }
200
+ }
201
+ const method = 'POST';
202
+ const path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token/${encodeURIComponent(params.name.toString())}/_clear_cache`;
203
+ return await this.transport.request({ path, method, querystring, body }, options);
204
+ }
205
+ async createApiKey(params, options) {
206
+ const acceptedPath = [];
207
+ const acceptedBody = ['expiration', 'name', 'role_descriptors', 'metadata'];
208
+ const querystring = {};
209
+ // @ts-expect-error
210
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
211
+ let body;
212
+ if (typeof userBody === 'string') {
213
+ body = userBody;
214
+ }
215
+ else {
216
+ body = userBody != null ? { ...userBody } : undefined;
217
+ }
218
+ params = params !== null && params !== void 0 ? params : {};
219
+ for (const key in params) {
220
+ if (acceptedBody.includes(key)) {
221
+ body = body !== null && body !== void 0 ? body : {};
222
+ // @ts-expect-error
223
+ body[key] = params[key];
224
+ }
225
+ else if (acceptedPath.includes(key)) {
226
+ continue;
227
+ }
228
+ else if (key !== 'body') {
229
+ // @ts-expect-error
230
+ querystring[key] = params[key];
231
+ }
232
+ }
233
+ const method = 'PUT';
234
+ const path = '/_security/api_key';
235
+ return await this.transport.request({ path, method, querystring, body }, options);
236
+ }
237
+ async createServiceToken(params, options) {
238
+ const acceptedPath = ['namespace', 'service', 'name'];
239
+ const querystring = {};
240
+ const body = undefined;
241
+ for (const key in params) {
242
+ if (acceptedPath.includes(key)) {
243
+ continue;
244
+ }
245
+ else if (key !== 'body') {
246
+ // @ts-expect-error
247
+ querystring[key] = params[key];
248
+ }
249
+ }
250
+ let method = '';
251
+ let path = '';
252
+ if (params.namespace != null && params.service != null && params.name != null) {
253
+ method = 'PUT';
254
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token/${encodeURIComponent(params.name.toString())}`;
255
+ }
256
+ else {
257
+ method = 'POST';
258
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token`;
259
+ }
260
+ return await this.transport.request({ path, method, querystring, body }, options);
261
+ }
262
+ async deletePrivileges(params, options) {
263
+ const acceptedPath = ['application', 'name'];
264
+ const querystring = {};
265
+ const body = undefined;
266
+ for (const key in params) {
267
+ if (acceptedPath.includes(key)) {
268
+ continue;
269
+ }
270
+ else if (key !== 'body') {
271
+ // @ts-expect-error
272
+ querystring[key] = params[key];
273
+ }
274
+ }
275
+ const method = 'DELETE';
276
+ const path = `/_security/privilege/${encodeURIComponent(params.application.toString())}/${encodeURIComponent(params.name.toString())}`;
277
+ return await this.transport.request({ path, method, querystring, body }, options);
278
+ }
279
+ async deleteRole(params, options) {
280
+ const acceptedPath = ['name'];
281
+ const querystring = {};
282
+ const body = undefined;
283
+ for (const key in params) {
284
+ if (acceptedPath.includes(key)) {
285
+ continue;
286
+ }
287
+ else if (key !== 'body') {
288
+ // @ts-expect-error
289
+ querystring[key] = params[key];
290
+ }
291
+ }
292
+ const method = 'DELETE';
293
+ const path = `/_security/role/${encodeURIComponent(params.name.toString())}`;
294
+ return await this.transport.request({ path, method, querystring, body }, options);
295
+ }
296
+ async deleteRoleMapping(params, options) {
297
+ const acceptedPath = ['name'];
298
+ const querystring = {};
299
+ const body = undefined;
300
+ for (const key in params) {
301
+ if (acceptedPath.includes(key)) {
302
+ continue;
303
+ }
304
+ else if (key !== 'body') {
305
+ // @ts-expect-error
306
+ querystring[key] = params[key];
307
+ }
308
+ }
309
+ const method = 'DELETE';
310
+ const path = `/_security/role_mapping/${encodeURIComponent(params.name.toString())}`;
311
+ return await this.transport.request({ path, method, querystring, body }, options);
312
+ }
313
+ async deleteServiceToken(params, options) {
314
+ const acceptedPath = ['namespace', 'service', 'name'];
315
+ const querystring = {};
316
+ const body = undefined;
317
+ for (const key in params) {
318
+ if (acceptedPath.includes(key)) {
319
+ continue;
320
+ }
321
+ else if (key !== 'body') {
322
+ // @ts-expect-error
323
+ querystring[key] = params[key];
324
+ }
325
+ }
326
+ const method = 'DELETE';
327
+ const path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token/${encodeURIComponent(params.name.toString())}`;
328
+ return await this.transport.request({ path, method, querystring, body }, options);
329
+ }
330
+ async deleteUser(params, options) {
331
+ const acceptedPath = ['username'];
332
+ const querystring = {};
333
+ const body = undefined;
334
+ for (const key in params) {
335
+ if (acceptedPath.includes(key)) {
336
+ continue;
337
+ }
338
+ else if (key !== 'body') {
339
+ // @ts-expect-error
340
+ querystring[key] = params[key];
341
+ }
342
+ }
343
+ const method = 'DELETE';
344
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}`;
345
+ return await this.transport.request({ path, method, querystring, body }, options);
346
+ }
347
+ async disableUser(params, options) {
348
+ const acceptedPath = ['username'];
349
+ const querystring = {};
350
+ const body = undefined;
351
+ for (const key in params) {
352
+ if (acceptedPath.includes(key)) {
353
+ continue;
354
+ }
355
+ else if (key !== 'body') {
356
+ // @ts-expect-error
357
+ querystring[key] = params[key];
358
+ }
359
+ }
360
+ const method = 'PUT';
361
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}/_disable`;
362
+ return await this.transport.request({ path, method, querystring, body }, options);
363
+ }
364
+ async disableUserProfile(params, options) {
365
+ const acceptedPath = ['uid'];
366
+ const querystring = {};
367
+ const body = undefined;
368
+ for (const key in params) {
369
+ if (acceptedPath.includes(key)) {
370
+ continue;
371
+ }
372
+ else if (key !== 'body') {
373
+ // @ts-expect-error
374
+ querystring[key] = params[key];
375
+ }
376
+ }
377
+ const method = 'PUT';
378
+ const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}/_disable`;
379
+ return await this.transport.request({ path, method, querystring, body }, options);
380
+ }
381
+ async enableUser(params, options) {
382
+ const acceptedPath = ['username'];
383
+ const querystring = {};
384
+ const body = undefined;
385
+ for (const key in params) {
386
+ if (acceptedPath.includes(key)) {
387
+ continue;
388
+ }
389
+ else if (key !== 'body') {
390
+ // @ts-expect-error
391
+ querystring[key] = params[key];
392
+ }
393
+ }
394
+ const method = 'PUT';
395
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}/_enable`;
396
+ return await this.transport.request({ path, method, querystring, body }, options);
397
+ }
398
+ async enableUserProfile(params, options) {
399
+ const acceptedPath = ['uid'];
400
+ const querystring = {};
401
+ const body = undefined;
402
+ for (const key in params) {
403
+ if (acceptedPath.includes(key)) {
404
+ continue;
405
+ }
406
+ else if (key !== 'body') {
407
+ // @ts-expect-error
408
+ querystring[key] = params[key];
409
+ }
410
+ }
411
+ const method = 'PUT';
412
+ const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}/_enable`;
413
+ return await this.transport.request({ path, method, querystring, body }, options);
414
+ }
415
+ async enrollKibana(params, options) {
416
+ const acceptedPath = [];
417
+ const querystring = {};
418
+ const body = undefined;
419
+ params = params !== null && params !== void 0 ? params : {};
420
+ for (const key in params) {
421
+ if (acceptedPath.includes(key)) {
422
+ continue;
423
+ }
424
+ else if (key !== 'body') {
425
+ // @ts-expect-error
426
+ querystring[key] = params[key];
427
+ }
428
+ }
429
+ const method = 'GET';
430
+ const path = '/_security/enroll/kibana';
431
+ return await this.transport.request({ path, method, querystring, body }, options);
432
+ }
433
+ async enrollNode(params, options) {
434
+ const acceptedPath = [];
435
+ const querystring = {};
436
+ const body = undefined;
437
+ params = params !== null && params !== void 0 ? params : {};
438
+ for (const key in params) {
439
+ if (acceptedPath.includes(key)) {
440
+ continue;
441
+ }
442
+ else if (key !== 'body') {
443
+ // @ts-expect-error
444
+ querystring[key] = params[key];
445
+ }
446
+ }
447
+ const method = 'GET';
448
+ const path = '/_security/enroll/node';
449
+ return await this.transport.request({ path, method, querystring, body }, options);
450
+ }
451
+ async getApiKey(params, options) {
452
+ const acceptedPath = [];
453
+ const querystring = {};
454
+ const body = undefined;
455
+ params = params !== null && params !== void 0 ? params : {};
456
+ for (const key in params) {
457
+ if (acceptedPath.includes(key)) {
458
+ continue;
459
+ }
460
+ else if (key !== 'body') {
461
+ // @ts-expect-error
462
+ querystring[key] = params[key];
463
+ }
464
+ }
465
+ const method = 'GET';
466
+ const path = '/_security/api_key';
467
+ return await this.transport.request({ path, method, querystring, body }, options);
468
+ }
469
+ async getBuiltinPrivileges(params, options) {
470
+ const acceptedPath = [];
471
+ const querystring = {};
472
+ const body = undefined;
473
+ params = params !== null && params !== void 0 ? params : {};
474
+ for (const key in params) {
475
+ if (acceptedPath.includes(key)) {
476
+ continue;
477
+ }
478
+ else if (key !== 'body') {
479
+ // @ts-expect-error
480
+ querystring[key] = params[key];
481
+ }
482
+ }
483
+ const method = 'GET';
484
+ const path = '/_security/privilege/_builtin';
485
+ return await this.transport.request({ path, method, querystring, body }, options);
486
+ }
487
+ async getPrivileges(params, options) {
488
+ const acceptedPath = ['application', 'name'];
489
+ const querystring = {};
490
+ const body = undefined;
491
+ params = params !== null && params !== void 0 ? params : {};
492
+ for (const key in params) {
493
+ if (acceptedPath.includes(key)) {
494
+ continue;
495
+ }
496
+ else if (key !== 'body') {
497
+ // @ts-expect-error
498
+ querystring[key] = params[key];
499
+ }
500
+ }
501
+ let method = '';
502
+ let path = '';
503
+ if (params.application != null && params.name != null) {
504
+ method = 'GET';
505
+ path = `/_security/privilege/${encodeURIComponent(params.application.toString())}/${encodeURIComponent(params.name.toString())}`;
506
+ }
507
+ else if (params.application != null) {
508
+ method = 'GET';
509
+ path = `/_security/privilege/${encodeURIComponent(params.application.toString())}`;
510
+ }
511
+ else {
512
+ method = 'GET';
513
+ path = '/_security/privilege';
514
+ }
515
+ return await this.transport.request({ path, method, querystring, body }, options);
516
+ }
517
+ async getRole(params, options) {
518
+ const acceptedPath = ['name'];
519
+ const querystring = {};
520
+ const body = undefined;
521
+ params = params !== null && params !== void 0 ? params : {};
522
+ for (const key in params) {
523
+ if (acceptedPath.includes(key)) {
524
+ continue;
525
+ }
526
+ else if (key !== 'body') {
527
+ // @ts-expect-error
528
+ querystring[key] = params[key];
529
+ }
530
+ }
531
+ let method = '';
532
+ let path = '';
533
+ if (params.name != null) {
534
+ method = 'GET';
535
+ path = `/_security/role/${encodeURIComponent(params.name.toString())}`;
536
+ }
537
+ else {
538
+ method = 'GET';
539
+ path = '/_security/role';
540
+ }
541
+ return await this.transport.request({ path, method, querystring, body }, options);
542
+ }
543
+ async getRoleMapping(params, options) {
544
+ const acceptedPath = ['name'];
545
+ const querystring = {};
546
+ const body = undefined;
547
+ params = params !== null && params !== void 0 ? params : {};
548
+ for (const key in params) {
549
+ if (acceptedPath.includes(key)) {
550
+ continue;
551
+ }
552
+ else if (key !== 'body') {
553
+ // @ts-expect-error
554
+ querystring[key] = params[key];
555
+ }
556
+ }
557
+ let method = '';
558
+ let path = '';
559
+ if (params.name != null) {
560
+ method = 'GET';
561
+ path = `/_security/role_mapping/${encodeURIComponent(params.name.toString())}`;
562
+ }
563
+ else {
564
+ method = 'GET';
565
+ path = '/_security/role_mapping';
566
+ }
567
+ return await this.transport.request({ path, method, querystring, body }, options);
568
+ }
569
+ async getServiceAccounts(params, options) {
570
+ const acceptedPath = ['namespace', 'service'];
571
+ const querystring = {};
572
+ const body = undefined;
573
+ params = params !== null && params !== void 0 ? params : {};
574
+ for (const key in params) {
575
+ if (acceptedPath.includes(key)) {
576
+ continue;
577
+ }
578
+ else if (key !== 'body') {
579
+ // @ts-expect-error
580
+ querystring[key] = params[key];
581
+ }
582
+ }
583
+ let method = '';
584
+ let path = '';
585
+ if (params.namespace != null && params.service != null) {
586
+ method = 'GET';
587
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}`;
588
+ }
589
+ else if (params.namespace != null) {
590
+ method = 'GET';
591
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}`;
592
+ }
593
+ else {
594
+ method = 'GET';
595
+ path = '/_security/service';
596
+ }
597
+ return await this.transport.request({ path, method, querystring, body }, options);
598
+ }
599
+ async getServiceCredentials(params, options) {
600
+ const acceptedPath = ['namespace', 'service'];
601
+ const querystring = {};
602
+ const body = undefined;
603
+ for (const key in params) {
604
+ if (acceptedPath.includes(key)) {
605
+ continue;
606
+ }
607
+ else if (key !== 'body') {
608
+ // @ts-expect-error
609
+ querystring[key] = params[key];
610
+ }
611
+ }
612
+ const method = 'GET';
613
+ const path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential`;
614
+ return await this.transport.request({ path, method, querystring, body }, options);
615
+ }
616
+ async getToken(params, options) {
617
+ const acceptedPath = [];
618
+ const acceptedBody = ['grant_type', 'scope', 'password', 'kerberos_ticket', 'refresh_token', 'username'];
619
+ const querystring = {};
620
+ // @ts-expect-error
621
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
622
+ let body;
623
+ if (typeof userBody === 'string') {
624
+ body = userBody;
625
+ }
626
+ else {
627
+ body = userBody != null ? { ...userBody } : undefined;
628
+ }
629
+ params = params !== null && params !== void 0 ? params : {};
630
+ for (const key in params) {
631
+ if (acceptedBody.includes(key)) {
632
+ body = body !== null && body !== void 0 ? body : {};
633
+ // @ts-expect-error
634
+ body[key] = params[key];
635
+ }
636
+ else if (acceptedPath.includes(key)) {
637
+ continue;
638
+ }
639
+ else if (key !== 'body') {
640
+ // @ts-expect-error
641
+ querystring[key] = params[key];
642
+ }
643
+ }
644
+ const method = 'POST';
645
+ const path = '/_security/oauth2/token';
646
+ return await this.transport.request({ path, method, querystring, body }, options);
647
+ }
648
+ async getUser(params, options) {
649
+ const acceptedPath = ['username'];
650
+ const querystring = {};
651
+ const body = undefined;
652
+ params = params !== null && params !== void 0 ? params : {};
653
+ for (const key in params) {
654
+ if (acceptedPath.includes(key)) {
655
+ continue;
656
+ }
657
+ else if (key !== 'body') {
658
+ // @ts-expect-error
659
+ querystring[key] = params[key];
660
+ }
661
+ }
662
+ let method = '';
663
+ let path = '';
664
+ if (params.username != null) {
665
+ method = 'GET';
666
+ path = `/_security/user/${encodeURIComponent(params.username.toString())}`;
667
+ }
668
+ else {
669
+ method = 'GET';
670
+ path = '/_security/user';
671
+ }
672
+ return await this.transport.request({ path, method, querystring, body }, options);
673
+ }
674
+ async getUserPrivileges(params, options) {
675
+ const acceptedPath = [];
676
+ const querystring = {};
677
+ const body = undefined;
678
+ params = params !== null && params !== void 0 ? params : {};
679
+ for (const key in params) {
680
+ if (acceptedPath.includes(key)) {
681
+ continue;
682
+ }
683
+ else if (key !== 'body') {
684
+ // @ts-expect-error
685
+ querystring[key] = params[key];
686
+ }
687
+ }
688
+ const method = 'GET';
689
+ const path = '/_security/user/_privileges';
690
+ return await this.transport.request({ path, method, querystring, body }, options);
691
+ }
692
+ async getUserProfile(params, options) {
693
+ const acceptedPath = ['uid'];
694
+ const querystring = {};
695
+ const body = undefined;
696
+ for (const key in params) {
697
+ if (acceptedPath.includes(key)) {
698
+ continue;
699
+ }
700
+ else if (key !== 'body') {
701
+ // @ts-expect-error
702
+ querystring[key] = params[key];
703
+ }
704
+ }
705
+ const method = 'GET';
706
+ const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}`;
707
+ return await this.transport.request({ path, method, querystring, body }, options);
708
+ }
709
+ async grantApiKey(params, options) {
710
+ const acceptedPath = [];
711
+ const acceptedBody = ['api_key', 'grant_type', 'access_token', 'username', 'password'];
712
+ const querystring = {};
713
+ // @ts-expect-error
714
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
715
+ let body;
716
+ if (typeof userBody === 'string') {
717
+ body = userBody;
718
+ }
719
+ else {
720
+ body = userBody != null ? { ...userBody } : undefined;
721
+ }
722
+ for (const key in params) {
723
+ if (acceptedBody.includes(key)) {
724
+ body = body !== null && body !== void 0 ? body : {};
725
+ // @ts-expect-error
726
+ body[key] = params[key];
727
+ }
728
+ else if (acceptedPath.includes(key)) {
729
+ continue;
730
+ }
731
+ else if (key !== 'body') {
732
+ // @ts-expect-error
733
+ querystring[key] = params[key];
734
+ }
735
+ }
736
+ const method = 'POST';
737
+ const path = '/_security/api_key/grant';
738
+ return await this.transport.request({ path, method, querystring, body }, options);
739
+ }
740
+ async hasPrivileges(params, options) {
741
+ const acceptedPath = ['user'];
742
+ const acceptedBody = ['application', 'cluster', 'index'];
743
+ const querystring = {};
744
+ // @ts-expect-error
745
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
746
+ let body;
747
+ if (typeof userBody === 'string') {
748
+ body = userBody;
749
+ }
750
+ else {
751
+ body = userBody != null ? { ...userBody } : undefined;
752
+ }
753
+ params = params !== null && params !== void 0 ? params : {};
754
+ for (const key in params) {
755
+ if (acceptedBody.includes(key)) {
756
+ body = body !== null && body !== void 0 ? body : {};
757
+ // @ts-expect-error
758
+ body[key] = params[key];
759
+ }
760
+ else if (acceptedPath.includes(key)) {
761
+ continue;
762
+ }
763
+ else if (key !== 'body') {
764
+ // @ts-expect-error
765
+ querystring[key] = params[key];
766
+ }
767
+ }
768
+ let method = '';
769
+ let path = '';
770
+ if (params.user != null) {
771
+ method = body != null ? 'POST' : 'GET';
772
+ path = `/_security/user/${encodeURIComponent(params.user.toString())}/_has_privileges`;
773
+ }
774
+ else {
775
+ method = body != null ? 'POST' : 'GET';
776
+ path = '/_security/user/_has_privileges';
777
+ }
778
+ return await this.transport.request({ path, method, querystring, body }, options);
779
+ }
780
+ async hasPrivilegesUserProfile(params, options) {
781
+ const acceptedPath = [];
782
+ const acceptedBody = ['uids', 'privileges'];
783
+ const querystring = {};
784
+ // @ts-expect-error
785
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
786
+ let body;
787
+ if (typeof userBody === 'string') {
788
+ body = userBody;
789
+ }
790
+ else {
791
+ body = userBody != null ? { ...userBody } : undefined;
792
+ }
793
+ for (const key in params) {
794
+ if (acceptedBody.includes(key)) {
795
+ body = body !== null && body !== void 0 ? body : {};
796
+ // @ts-expect-error
797
+ body[key] = params[key];
798
+ }
799
+ else if (acceptedPath.includes(key)) {
800
+ continue;
801
+ }
802
+ else if (key !== 'body') {
803
+ // @ts-expect-error
804
+ querystring[key] = params[key];
805
+ }
806
+ }
807
+ const method = body != null ? 'POST' : 'GET';
808
+ const path = '/_security/profile/_has_privileges';
809
+ return await this.transport.request({ path, method, querystring, body }, options);
810
+ }
811
+ async invalidateApiKey(params, options) {
812
+ const acceptedPath = [];
813
+ const acceptedBody = ['id', 'ids', 'name', 'owner', 'realm_name', 'username'];
814
+ const querystring = {};
815
+ // @ts-expect-error
816
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
817
+ let body;
818
+ if (typeof userBody === 'string') {
819
+ body = userBody;
820
+ }
821
+ else {
822
+ body = userBody != null ? { ...userBody } : undefined;
823
+ }
824
+ params = params !== null && params !== void 0 ? params : {};
825
+ for (const key in params) {
826
+ if (acceptedBody.includes(key)) {
827
+ body = body !== null && body !== void 0 ? body : {};
828
+ // @ts-expect-error
829
+ body[key] = params[key];
830
+ }
831
+ else if (acceptedPath.includes(key)) {
832
+ continue;
833
+ }
834
+ else if (key !== 'body') {
835
+ // @ts-expect-error
836
+ querystring[key] = params[key];
837
+ }
838
+ }
839
+ const method = 'DELETE';
840
+ const path = '/_security/api_key';
841
+ return await this.transport.request({ path, method, querystring, body }, options);
842
+ }
843
+ async invalidateToken(params, options) {
844
+ const acceptedPath = [];
845
+ const acceptedBody = ['token', 'refresh_token', 'realm_name', 'username'];
846
+ const querystring = {};
847
+ // @ts-expect-error
848
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
849
+ let body;
850
+ if (typeof userBody === 'string') {
851
+ body = userBody;
852
+ }
853
+ else {
854
+ body = userBody != null ? { ...userBody } : undefined;
855
+ }
856
+ params = params !== null && params !== void 0 ? params : {};
857
+ for (const key in params) {
858
+ if (acceptedBody.includes(key)) {
859
+ body = body !== null && body !== void 0 ? body : {};
860
+ // @ts-expect-error
861
+ body[key] = params[key];
862
+ }
863
+ else if (acceptedPath.includes(key)) {
864
+ continue;
865
+ }
866
+ else if (key !== 'body') {
867
+ // @ts-expect-error
868
+ querystring[key] = params[key];
869
+ }
870
+ }
871
+ const method = 'DELETE';
872
+ const path = '/_security/oauth2/token';
873
+ return await this.transport.request({ path, method, querystring, body }, options);
874
+ }
875
+ async oidcAuthenticate(params, options) {
876
+ const acceptedPath = [];
877
+ const querystring = {};
878
+ const body = undefined;
879
+ params = params !== null && params !== void 0 ? params : {};
880
+ for (const key in params) {
881
+ if (acceptedPath.includes(key)) {
882
+ continue;
883
+ }
884
+ else if (key !== 'body') {
885
+ querystring[key] = params[key];
886
+ }
887
+ }
888
+ const method = 'POST';
889
+ const path = '/_security/oidc/authenticate';
890
+ return await this.transport.request({ path, method, querystring, body }, options);
891
+ }
892
+ async oidcLogout(params, options) {
893
+ const acceptedPath = [];
894
+ const querystring = {};
895
+ const body = undefined;
896
+ params = params !== null && params !== void 0 ? params : {};
897
+ for (const key in params) {
898
+ if (acceptedPath.includes(key)) {
899
+ continue;
900
+ }
901
+ else if (key !== 'body') {
902
+ querystring[key] = params[key];
903
+ }
904
+ }
905
+ const method = 'POST';
906
+ const path = '/_security/oidc/logout';
907
+ return await this.transport.request({ path, method, querystring, body }, options);
908
+ }
909
+ async oidcPrepareAuthentication(params, options) {
910
+ const acceptedPath = [];
911
+ const querystring = {};
912
+ const body = undefined;
913
+ params = params !== null && params !== void 0 ? params : {};
914
+ for (const key in params) {
915
+ if (acceptedPath.includes(key)) {
916
+ continue;
917
+ }
918
+ else if (key !== 'body') {
919
+ querystring[key] = params[key];
920
+ }
921
+ }
922
+ const method = 'POST';
923
+ const path = '/_security/oidc/prepare';
924
+ return await this.transport.request({ path, method, querystring, body }, options);
925
+ }
926
+ async putPrivileges(params, options) {
927
+ var _a;
928
+ const acceptedPath = [];
929
+ const acceptedBody = ['privileges'];
930
+ const querystring = {};
931
+ // @ts-expect-error
932
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
933
+ for (const key in params) {
934
+ if (acceptedBody.includes(key)) {
935
+ // @ts-expect-error
936
+ body = params[key];
937
+ }
938
+ else if (acceptedPath.includes(key)) {
939
+ continue;
940
+ }
941
+ else if (key !== 'body') {
942
+ // @ts-expect-error
943
+ querystring[key] = params[key];
944
+ }
945
+ }
946
+ const method = 'PUT';
947
+ const path = '/_security/privilege/';
948
+ return await this.transport.request({ path, method, querystring, body }, options);
949
+ }
950
+ async putRole(params, options) {
951
+ const acceptedPath = ['name'];
952
+ const acceptedBody = ['applications', 'cluster', 'global', 'indices', 'metadata', 'run_as', 'transient_metadata'];
953
+ const querystring = {};
954
+ // @ts-expect-error
955
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
956
+ let body;
957
+ if (typeof userBody === 'string') {
958
+ body = userBody;
959
+ }
960
+ else {
961
+ body = userBody != null ? { ...userBody } : undefined;
962
+ }
963
+ for (const key in params) {
964
+ if (acceptedBody.includes(key)) {
965
+ body = body !== null && body !== void 0 ? body : {};
966
+ // @ts-expect-error
967
+ body[key] = params[key];
968
+ }
969
+ else if (acceptedPath.includes(key)) {
970
+ continue;
971
+ }
972
+ else if (key !== 'body') {
973
+ // @ts-expect-error
974
+ querystring[key] = params[key];
975
+ }
976
+ }
977
+ const method = 'PUT';
978
+ const path = `/_security/role/${encodeURIComponent(params.name.toString())}`;
979
+ return await this.transport.request({ path, method, querystring, body }, options);
980
+ }
981
+ async putRoleMapping(params, options) {
982
+ const acceptedPath = ['name'];
983
+ const acceptedBody = ['enabled', 'metadata', 'roles', 'rules', 'run_as'];
984
+ const querystring = {};
985
+ // @ts-expect-error
986
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
987
+ let body;
988
+ if (typeof userBody === 'string') {
989
+ body = userBody;
990
+ }
991
+ else {
992
+ body = userBody != null ? { ...userBody } : undefined;
993
+ }
994
+ for (const key in params) {
995
+ if (acceptedBody.includes(key)) {
996
+ body = body !== null && body !== void 0 ? body : {};
997
+ // @ts-expect-error
998
+ body[key] = params[key];
999
+ }
1000
+ else if (acceptedPath.includes(key)) {
1001
+ continue;
1002
+ }
1003
+ else if (key !== 'body') {
1004
+ // @ts-expect-error
1005
+ querystring[key] = params[key];
1006
+ }
1007
+ }
1008
+ const method = 'PUT';
1009
+ const path = `/_security/role_mapping/${encodeURIComponent(params.name.toString())}`;
1010
+ return await this.transport.request({ path, method, querystring, body }, options);
1011
+ }
1012
+ async putUser(params, options) {
1013
+ const acceptedPath = [];
1014
+ const acceptedBody = ['username', 'email', 'full_name', 'metadata', 'password', 'password_hash', 'roles', 'enabled'];
1015
+ const querystring = {};
1016
+ // @ts-expect-error
1017
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1018
+ let body;
1019
+ if (typeof userBody === 'string') {
1020
+ body = userBody;
1021
+ }
1022
+ else {
1023
+ body = userBody != null ? { ...userBody } : undefined;
1024
+ }
1025
+ for (const key in params) {
1026
+ if (acceptedBody.includes(key)) {
1027
+ body = body !== null && body !== void 0 ? body : {};
1028
+ // @ts-expect-error
1029
+ body[key] = params[key];
1030
+ }
1031
+ else if (acceptedPath.includes(key)) {
1032
+ continue;
1033
+ }
1034
+ else if (key !== 'body') {
1035
+ // @ts-expect-error
1036
+ querystring[key] = params[key];
1037
+ }
1038
+ }
1039
+ const method = 'PUT';
1040
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}`;
1041
+ return await this.transport.request({ path, method, querystring, body }, options);
1042
+ }
1043
+ async queryApiKeys(params, options) {
1044
+ const acceptedPath = [];
1045
+ const acceptedBody = ['query', 'from', 'sort', 'size', 'search_after'];
1046
+ const querystring = {};
1047
+ // @ts-expect-error
1048
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1049
+ let body;
1050
+ if (typeof userBody === 'string') {
1051
+ body = userBody;
1052
+ }
1053
+ else {
1054
+ body = userBody != null ? { ...userBody } : undefined;
1055
+ }
1056
+ params = params !== null && params !== void 0 ? params : {};
1057
+ for (const key in params) {
1058
+ if (acceptedBody.includes(key)) {
1059
+ body = body !== null && body !== void 0 ? body : {};
1060
+ // @ts-expect-error
1061
+ body[key] = params[key];
1062
+ }
1063
+ else if (acceptedPath.includes(key)) {
1064
+ continue;
1065
+ }
1066
+ else if (key !== 'body') {
1067
+ // @ts-expect-error
1068
+ querystring[key] = params[key];
1069
+ }
1070
+ }
1071
+ const method = body != null ? 'POST' : 'GET';
1072
+ const path = '/_security/_query/api_key';
1073
+ return await this.transport.request({ path, method, querystring, body }, options);
1074
+ }
1075
+ async samlAuthenticate(params, options) {
1076
+ const acceptedPath = [];
1077
+ const acceptedBody = ['content', 'ids', 'realm'];
1078
+ const querystring = {};
1079
+ // @ts-expect-error
1080
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1081
+ let body;
1082
+ if (typeof userBody === 'string') {
1083
+ body = userBody;
1084
+ }
1085
+ else {
1086
+ body = userBody != null ? { ...userBody } : undefined;
1087
+ }
1088
+ for (const key in params) {
1089
+ if (acceptedBody.includes(key)) {
1090
+ body = body !== null && body !== void 0 ? body : {};
1091
+ // @ts-expect-error
1092
+ body[key] = params[key];
1093
+ }
1094
+ else if (acceptedPath.includes(key)) {
1095
+ continue;
1096
+ }
1097
+ else if (key !== 'body') {
1098
+ // @ts-expect-error
1099
+ querystring[key] = params[key];
1100
+ }
1101
+ }
1102
+ const method = 'POST';
1103
+ const path = '/_security/saml/authenticate';
1104
+ return await this.transport.request({ path, method, querystring, body }, options);
1105
+ }
1106
+ async samlCompleteLogout(params, options) {
1107
+ const acceptedPath = [];
1108
+ const acceptedBody = ['realm', 'ids', 'query_string', 'content'];
1109
+ const querystring = {};
1110
+ // @ts-expect-error
1111
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1112
+ let body;
1113
+ if (typeof userBody === 'string') {
1114
+ body = userBody;
1115
+ }
1116
+ else {
1117
+ body = userBody != null ? { ...userBody } : undefined;
1118
+ }
1119
+ for (const key in params) {
1120
+ if (acceptedBody.includes(key)) {
1121
+ body = body !== null && body !== void 0 ? body : {};
1122
+ // @ts-expect-error
1123
+ body[key] = params[key];
1124
+ }
1125
+ else if (acceptedPath.includes(key)) {
1126
+ continue;
1127
+ }
1128
+ else if (key !== 'body') {
1129
+ // @ts-expect-error
1130
+ querystring[key] = params[key];
1131
+ }
1132
+ }
1133
+ const method = 'POST';
1134
+ const path = '/_security/saml/complete_logout';
1135
+ return await this.transport.request({ path, method, querystring, body }, options);
1136
+ }
1137
+ async samlInvalidate(params, options) {
1138
+ const acceptedPath = [];
1139
+ const acceptedBody = ['acs', 'query_string', 'realm'];
1140
+ const querystring = {};
1141
+ // @ts-expect-error
1142
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1143
+ let body;
1144
+ if (typeof userBody === 'string') {
1145
+ body = userBody;
1146
+ }
1147
+ else {
1148
+ body = userBody != null ? { ...userBody } : undefined;
1149
+ }
1150
+ for (const key in params) {
1151
+ if (acceptedBody.includes(key)) {
1152
+ body = body !== null && body !== void 0 ? body : {};
1153
+ // @ts-expect-error
1154
+ body[key] = params[key];
1155
+ }
1156
+ else if (acceptedPath.includes(key)) {
1157
+ continue;
1158
+ }
1159
+ else if (key !== 'body') {
1160
+ // @ts-expect-error
1161
+ querystring[key] = params[key];
1162
+ }
1163
+ }
1164
+ const method = 'POST';
1165
+ const path = '/_security/saml/invalidate';
1166
+ return await this.transport.request({ path, method, querystring, body }, options);
1167
+ }
1168
+ async samlLogout(params, options) {
1169
+ const acceptedPath = [];
1170
+ const acceptedBody = ['token', 'refresh_token'];
1171
+ const querystring = {};
1172
+ // @ts-expect-error
1173
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1174
+ let body;
1175
+ if (typeof userBody === 'string') {
1176
+ body = userBody;
1177
+ }
1178
+ else {
1179
+ body = userBody != null ? { ...userBody } : undefined;
1180
+ }
1181
+ for (const key in params) {
1182
+ if (acceptedBody.includes(key)) {
1183
+ body = body !== null && body !== void 0 ? body : {};
1184
+ // @ts-expect-error
1185
+ body[key] = params[key];
1186
+ }
1187
+ else if (acceptedPath.includes(key)) {
1188
+ continue;
1189
+ }
1190
+ else if (key !== 'body') {
1191
+ // @ts-expect-error
1192
+ querystring[key] = params[key];
1193
+ }
1194
+ }
1195
+ const method = 'POST';
1196
+ const path = '/_security/saml/logout';
1197
+ return await this.transport.request({ path, method, querystring, body }, options);
1198
+ }
1199
+ async samlPrepareAuthentication(params, options) {
1200
+ const acceptedPath = [];
1201
+ const acceptedBody = ['acs', 'realm', 'relay_state'];
1202
+ const querystring = {};
1203
+ // @ts-expect-error
1204
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1205
+ let body;
1206
+ if (typeof userBody === 'string') {
1207
+ body = userBody;
1208
+ }
1209
+ else {
1210
+ body = userBody != null ? { ...userBody } : undefined;
1211
+ }
1212
+ params = params !== null && params !== void 0 ? params : {};
1213
+ for (const key in params) {
1214
+ if (acceptedBody.includes(key)) {
1215
+ body = body !== null && body !== void 0 ? body : {};
1216
+ // @ts-expect-error
1217
+ body[key] = params[key];
1218
+ }
1219
+ else if (acceptedPath.includes(key)) {
1220
+ continue;
1221
+ }
1222
+ else if (key !== 'body') {
1223
+ // @ts-expect-error
1224
+ querystring[key] = params[key];
1225
+ }
1226
+ }
1227
+ const method = 'POST';
1228
+ const path = '/_security/saml/prepare';
1229
+ return await this.transport.request({ path, method, querystring, body }, options);
1230
+ }
1231
+ async samlServiceProviderMetadata(params, options) {
1232
+ const acceptedPath = ['realm_name'];
1233
+ const querystring = {};
1234
+ const body = undefined;
1235
+ for (const key in params) {
1236
+ if (acceptedPath.includes(key)) {
1237
+ continue;
1238
+ }
1239
+ else if (key !== 'body') {
1240
+ // @ts-expect-error
1241
+ querystring[key] = params[key];
1242
+ }
1243
+ }
1244
+ const method = 'GET';
1245
+ const path = `/_security/saml/metadata/${encodeURIComponent(params.realm_name.toString())}`;
1246
+ return await this.transport.request({ path, method, querystring, body }, options);
1247
+ }
1248
+ async suggestUserProfiles(params, options) {
1249
+ const acceptedPath = [];
1250
+ const acceptedBody = ['name', 'size', 'data', 'hint'];
1251
+ const querystring = {};
1252
+ // @ts-expect-error
1253
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1254
+ let body;
1255
+ if (typeof userBody === 'string') {
1256
+ body = userBody;
1257
+ }
1258
+ else {
1259
+ body = userBody != null ? { ...userBody } : undefined;
1260
+ }
1261
+ params = params !== null && params !== void 0 ? params : {};
1262
+ for (const key in params) {
1263
+ if (acceptedBody.includes(key)) {
1264
+ body = body !== null && body !== void 0 ? body : {};
1265
+ // @ts-expect-error
1266
+ body[key] = params[key];
1267
+ }
1268
+ else if (acceptedPath.includes(key)) {
1269
+ continue;
1270
+ }
1271
+ else if (key !== 'body') {
1272
+ // @ts-expect-error
1273
+ querystring[key] = params[key];
1274
+ }
1275
+ }
1276
+ const method = body != null ? 'POST' : 'GET';
1277
+ const path = '/_security/profile/_suggest';
1278
+ return await this.transport.request({ path, method, querystring, body }, options);
1279
+ }
1280
+ async updateApiKey(params, options) {
1281
+ const acceptedPath = ['id'];
1282
+ const acceptedBody = ['role_descriptors', 'metadata'];
1283
+ const querystring = {};
1284
+ // @ts-expect-error
1285
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1286
+ let body;
1287
+ if (typeof userBody === 'string') {
1288
+ body = userBody;
1289
+ }
1290
+ else {
1291
+ body = userBody != null ? { ...userBody } : undefined;
1292
+ }
1293
+ for (const key in params) {
1294
+ if (acceptedBody.includes(key)) {
1295
+ body = body !== null && body !== void 0 ? body : {};
1296
+ // @ts-expect-error
1297
+ body[key] = params[key];
1298
+ }
1299
+ else if (acceptedPath.includes(key)) {
1300
+ continue;
1301
+ }
1302
+ else if (key !== 'body') {
1303
+ // @ts-expect-error
1304
+ querystring[key] = params[key];
1305
+ }
1306
+ }
1307
+ const method = 'PUT';
1308
+ const path = `/_security/api_key/${encodeURIComponent(params.id.toString())}`;
1309
+ return await this.transport.request({ path, method, querystring, body }, options);
1310
+ }
1311
+ async updateUserProfileData(params, options) {
1312
+ const acceptedPath = ['uid'];
1313
+ const acceptedBody = ['labels', 'data'];
1314
+ const querystring = {};
1315
+ // @ts-expect-error
1316
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1317
+ let body;
1318
+ if (typeof userBody === 'string') {
1319
+ body = userBody;
1320
+ }
1321
+ else {
1322
+ body = userBody != null ? { ...userBody } : undefined;
1323
+ }
1324
+ for (const key in params) {
1325
+ if (acceptedBody.includes(key)) {
1326
+ body = body !== null && body !== void 0 ? body : {};
1327
+ // @ts-expect-error
1328
+ body[key] = params[key];
1329
+ }
1330
+ else if (acceptedPath.includes(key)) {
1331
+ continue;
1332
+ }
1333
+ else if (key !== 'body') {
1334
+ // @ts-expect-error
1335
+ querystring[key] = params[key];
1336
+ }
1337
+ }
1338
+ const method = 'PUT';
1339
+ const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}/_data`;
1340
+ return await this.transport.request({ path, method, querystring, body }, options);
1341
+ }
1342
+ }
1343
+ exports.default = Security;
1344
+ //# sourceMappingURL=security.js.map