@opensearch-project/opensearch 1.0.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 (84) hide show
  1. package/.dockerignore +5 -0
  2. package/ADMINS.md +34 -0
  3. package/DEVELOPER_GUIDE.md +60 -0
  4. package/LICENSE.txt +201 -0
  5. package/MAINTAINERS.md +73 -0
  6. package/Makefile +27 -0
  7. package/NOTICE.txt +8 -0
  8. package/README.md +183 -0
  9. package/RELEASING.md +34 -0
  10. package/SECURITY.md +3 -0
  11. package/api/api/bulk.js +81 -0
  12. package/api/api/cat.js +525 -0
  13. package/api/api/clear_scroll.js +66 -0
  14. package/api/api/cluster.js +431 -0
  15. package/api/api/count.js +75 -0
  16. package/api/api/create.js +80 -0
  17. package/api/api/dangling_indices.js +126 -0
  18. package/api/api/delete.js +76 -0
  19. package/api/api/delete_by_query.js +82 -0
  20. package/api/api/delete_by_query_rethrottle.js +71 -0
  21. package/api/api/delete_script.js +67 -0
  22. package/api/api/exists.js +76 -0
  23. package/api/api/exists_source.js +85 -0
  24. package/api/api/explain.js +76 -0
  25. package/api/api/features.js +92 -0
  26. package/api/api/field_caps.js +66 -0
  27. package/api/api/get.js +76 -0
  28. package/api/api/get_script.js +67 -0
  29. package/api/api/get_script_context.js +61 -0
  30. package/api/api/get_script_languages.js +61 -0
  31. package/api/api/get_source.js +76 -0
  32. package/api/api/index.js +82 -0
  33. package/api/api/indices.js +1516 -0
  34. package/api/api/info.js +61 -0
  35. package/api/api/ingest.js +211 -0
  36. package/api/api/mget.js +81 -0
  37. package/api/api/msearch.js +81 -0
  38. package/api/api/msearch_template.js +81 -0
  39. package/api/api/mtermvectors.js +75 -0
  40. package/api/api/nodes.js +279 -0
  41. package/api/api/ping.js +61 -0
  42. package/api/api/put_script.js +82 -0
  43. package/api/api/rank_eval.js +72 -0
  44. package/api/api/reindex.js +67 -0
  45. package/api/api/reindex_rethrottle.js +71 -0
  46. package/api/api/render_search_template.js +66 -0
  47. package/api/api/scripts_painless_execute.js +61 -0
  48. package/api/api/scroll.js +66 -0
  49. package/api/api/search.js +75 -0
  50. package/api/api/search_shards.js +66 -0
  51. package/api/api/search_template.js +81 -0
  52. package/api/api/shutdown.js +135 -0
  53. package/api/api/snapshot.js +450 -0
  54. package/api/api/tasks.js +119 -0
  55. package/api/api/terms_enum.js +67 -0
  56. package/api/api/termvectors.js +78 -0
  57. package/api/api/update.js +80 -0
  58. package/api/api/update_by_query.js +78 -0
  59. package/api/api/update_by_query_rethrottle.js +71 -0
  60. package/api/index.js +254 -0
  61. package/api/new.d.ts +716 -0
  62. package/api/requestParams.d.ts +1583 -0
  63. package/api/types.d.ts +9481 -0
  64. package/api/utils.js +69 -0
  65. package/codecov.yml +14 -0
  66. package/index.d.ts +1210 -0
  67. package/index.js +338 -0
  68. package/index.mjs +40 -0
  69. package/lib/Connection.d.ts +107 -0
  70. package/lib/Connection.js +345 -0
  71. package/lib/Helpers.d.ts +135 -0
  72. package/lib/Helpers.js +779 -0
  73. package/lib/Serializer.d.ts +41 -0
  74. package/lib/Serializer.js +105 -0
  75. package/lib/Transport.d.ts +173 -0
  76. package/lib/Transport.js +646 -0
  77. package/lib/errors.d.ts +101 -0
  78. package/lib/errors.js +168 -0
  79. package/lib/pool/BaseConnectionPool.js +269 -0
  80. package/lib/pool/CloudConnectionPool.js +75 -0
  81. package/lib/pool/ConnectionPool.js +257 -0
  82. package/lib/pool/index.d.ts +215 -0
  83. package/lib/pool/index.js +41 -0
  84. package/package.json +102 -0
@@ -0,0 +1,450 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'index_details', 'include_repository', 'verbose', 'local', 'blob_count', 'concurrency', 'read_node_count', 'early_read_node_count', 'seed', 'rare_action_probability', 'max_blob_size', 'max_total_data_size', 'detailed', 'rarely_abort_writes']
38
+ const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable', indexDetails: 'index_details', includeRepository: 'include_repository', blobCount: 'blob_count', readNodeCount: 'read_node_count', earlyReadNodeCount: 'early_read_node_count', rareActionProbability: 'rare_action_probability', maxBlobSize: 'max_blob_size', maxTotalDataSize: 'max_total_data_size', rarelyAbortWrites: 'rarely_abort_writes' }
39
+
40
+ function SnapshotApi (transport, ConfigurationError) {
41
+ this.transport = transport
42
+ this[kConfigurationError] = ConfigurationError
43
+ }
44
+
45
+ SnapshotApi.prototype.cleanupRepository = function snapshotCleanupRepositoryApi (params, options, callback) {
46
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
47
+
48
+ // check required parameters
49
+ if (params.repository == null) {
50
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
51
+ return handleError(err, callback)
52
+ }
53
+
54
+ let { method, body, repository, ...querystring } = params
55
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
56
+
57
+ let path = ''
58
+ if (method == null) method = 'POST'
59
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + '_cleanup'
60
+
61
+ // build request object
62
+ const request = {
63
+ method,
64
+ path,
65
+ body: body || '',
66
+ querystring
67
+ }
68
+
69
+ return this.transport.request(request, options, callback)
70
+ }
71
+
72
+ SnapshotApi.prototype.clone = function snapshotCloneApi (params, options, callback) {
73
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
74
+
75
+ // check required parameters
76
+ if (params.repository == null) {
77
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
78
+ return handleError(err, callback)
79
+ }
80
+ if (params.snapshot == null) {
81
+ const err = new this[kConfigurationError]('Missing required parameter: snapshot')
82
+ return handleError(err, callback)
83
+ }
84
+ if (params.target_snapshot == null && params.targetSnapshot == null) {
85
+ const err = new this[kConfigurationError]('Missing required parameter: target_snapshot or targetSnapshot')
86
+ return handleError(err, callback)
87
+ }
88
+ if (params.body == null) {
89
+ const err = new this[kConfigurationError]('Missing required parameter: body')
90
+ return handleError(err, callback)
91
+ }
92
+
93
+ // check required url components
94
+ if ((params.target_snapshot != null || params.targetSnapshot != null) && (params.snapshot == null || params.repository == null)) {
95
+ const err = new this[kConfigurationError]('Missing required parameter of the url: snapshot, repository')
96
+ return handleError(err, callback)
97
+ } else if (params.snapshot != null && (params.repository == null)) {
98
+ const err = new this[kConfigurationError]('Missing required parameter of the url: repository')
99
+ return handleError(err, callback)
100
+ }
101
+
102
+ let { method, body, repository, snapshot, targetSnapshot, target_snapshot, ...querystring } = params
103
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
104
+
105
+ let path = ''
106
+ if (method == null) method = 'PUT'
107
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot) + '/' + '_clone' + '/' + encodeURIComponent(target_snapshot || targetSnapshot)
108
+
109
+ // build request object
110
+ const request = {
111
+ method,
112
+ path,
113
+ body: body || '',
114
+ querystring
115
+ }
116
+
117
+ return this.transport.request(request, options, callback)
118
+ }
119
+
120
+ SnapshotApi.prototype.create = function snapshotCreateApi (params, options, callback) {
121
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
122
+
123
+ // check required parameters
124
+ if (params.repository == null) {
125
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
126
+ return handleError(err, callback)
127
+ }
128
+ if (params.snapshot == null) {
129
+ const err = new this[kConfigurationError]('Missing required parameter: snapshot')
130
+ return handleError(err, callback)
131
+ }
132
+
133
+ // check required url components
134
+ if (params.snapshot != null && (params.repository == null)) {
135
+ const err = new this[kConfigurationError]('Missing required parameter of the url: repository')
136
+ return handleError(err, callback)
137
+ }
138
+
139
+ let { method, body, repository, snapshot, ...querystring } = params
140
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
141
+
142
+ let path = ''
143
+ if (method == null) method = 'PUT'
144
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot)
145
+
146
+ // build request object
147
+ const request = {
148
+ method,
149
+ path,
150
+ body: body || '',
151
+ querystring
152
+ }
153
+
154
+ return this.transport.request(request, options, callback)
155
+ }
156
+
157
+ SnapshotApi.prototype.createRepository = function snapshotCreateRepositoryApi (params, options, callback) {
158
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
159
+
160
+ // check required parameters
161
+ if (params.repository == null) {
162
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
163
+ return handleError(err, callback)
164
+ }
165
+ if (params.body == null) {
166
+ const err = new this[kConfigurationError]('Missing required parameter: body')
167
+ return handleError(err, callback)
168
+ }
169
+
170
+ let { method, body, repository, ...querystring } = params
171
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
172
+
173
+ let path = ''
174
+ if (method == null) method = 'PUT'
175
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository)
176
+
177
+ // build request object
178
+ const request = {
179
+ method,
180
+ path,
181
+ body: body || '',
182
+ querystring
183
+ }
184
+
185
+ return this.transport.request(request, options, callback)
186
+ }
187
+
188
+ SnapshotApi.prototype.delete = function snapshotDeleteApi (params, options, callback) {
189
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
190
+
191
+ // check required parameters
192
+ if (params.repository == null) {
193
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
194
+ return handleError(err, callback)
195
+ }
196
+ if (params.snapshot == null) {
197
+ const err = new this[kConfigurationError]('Missing required parameter: snapshot')
198
+ return handleError(err, callback)
199
+ }
200
+
201
+ // check required url components
202
+ if (params.snapshot != null && (params.repository == null)) {
203
+ const err = new this[kConfigurationError]('Missing required parameter of the url: repository')
204
+ return handleError(err, callback)
205
+ }
206
+
207
+ let { method, body, repository, snapshot, ...querystring } = params
208
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
209
+
210
+ let path = ''
211
+ if (method == null) method = 'DELETE'
212
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot)
213
+
214
+ // build request object
215
+ const request = {
216
+ method,
217
+ path,
218
+ body: body || '',
219
+ querystring
220
+ }
221
+
222
+ return this.transport.request(request, options, callback)
223
+ }
224
+
225
+ SnapshotApi.prototype.deleteRepository = function snapshotDeleteRepositoryApi (params, options, callback) {
226
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
227
+
228
+ // check required parameters
229
+ if (params.repository == null) {
230
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
231
+ return handleError(err, callback)
232
+ }
233
+
234
+ let { method, body, repository, ...querystring } = params
235
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
236
+
237
+ let path = ''
238
+ if (method == null) method = 'DELETE'
239
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository)
240
+
241
+ // build request object
242
+ const request = {
243
+ method,
244
+ path,
245
+ body: body || '',
246
+ querystring
247
+ }
248
+
249
+ return this.transport.request(request, options, callback)
250
+ }
251
+
252
+ SnapshotApi.prototype.get = function snapshotGetApi (params, options, callback) {
253
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
254
+
255
+ // check required parameters
256
+ if (params.repository == null) {
257
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
258
+ return handleError(err, callback)
259
+ }
260
+ if (params.snapshot == null) {
261
+ const err = new this[kConfigurationError]('Missing required parameter: snapshot')
262
+ return handleError(err, callback)
263
+ }
264
+
265
+ // check required url components
266
+ if (params.snapshot != null && (params.repository == null)) {
267
+ const err = new this[kConfigurationError]('Missing required parameter of the url: repository')
268
+ return handleError(err, callback)
269
+ }
270
+
271
+ let { method, body, repository, snapshot, ...querystring } = params
272
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
273
+
274
+ let path = ''
275
+ if (method == null) method = 'GET'
276
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot)
277
+
278
+ // build request object
279
+ const request = {
280
+ method,
281
+ path,
282
+ body: null,
283
+ querystring
284
+ }
285
+
286
+ return this.transport.request(request, options, callback)
287
+ }
288
+
289
+ SnapshotApi.prototype.getRepository = function snapshotGetRepositoryApi (params, options, callback) {
290
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
291
+
292
+ let { method, body, repository, ...querystring } = params
293
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
294
+
295
+ let path = ''
296
+ if ((repository) != null) {
297
+ if (method == null) method = 'GET'
298
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository)
299
+ } else {
300
+ if (method == null) method = 'GET'
301
+ path = '/' + '_snapshot'
302
+ }
303
+
304
+ // build request object
305
+ const request = {
306
+ method,
307
+ path,
308
+ body: null,
309
+ querystring
310
+ }
311
+
312
+ return this.transport.request(request, options, callback)
313
+ }
314
+
315
+ SnapshotApi.prototype.repositoryAnalyze = function snapshotRepositoryAnalyzeApi (params, options, callback) {
316
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
317
+
318
+ // check required parameters
319
+ if (params.repository == null) {
320
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
321
+ return handleError(err, callback)
322
+ }
323
+
324
+ let { method, body, repository, ...querystring } = params
325
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
326
+
327
+ let path = ''
328
+ if (method == null) method = 'POST'
329
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + '_analyze'
330
+
331
+ // build request object
332
+ const request = {
333
+ method,
334
+ path,
335
+ body: body || '',
336
+ querystring
337
+ }
338
+
339
+ return this.transport.request(request, options, callback)
340
+ }
341
+
342
+ SnapshotApi.prototype.restore = function snapshotRestoreApi (params, options, callback) {
343
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
344
+
345
+ // check required parameters
346
+ if (params.repository == null) {
347
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
348
+ return handleError(err, callback)
349
+ }
350
+ if (params.snapshot == null) {
351
+ const err = new this[kConfigurationError]('Missing required parameter: snapshot')
352
+ return handleError(err, callback)
353
+ }
354
+
355
+ // check required url components
356
+ if (params.snapshot != null && (params.repository == null)) {
357
+ const err = new this[kConfigurationError]('Missing required parameter of the url: repository')
358
+ return handleError(err, callback)
359
+ }
360
+
361
+ let { method, body, repository, snapshot, ...querystring } = params
362
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
363
+
364
+ let path = ''
365
+ if (method == null) method = 'POST'
366
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot) + '/' + '_restore'
367
+
368
+ // build request object
369
+ const request = {
370
+ method,
371
+ path,
372
+ body: body || '',
373
+ querystring
374
+ }
375
+
376
+ return this.transport.request(request, options, callback)
377
+ }
378
+
379
+ SnapshotApi.prototype.status = function snapshotStatusApi (params, options, callback) {
380
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
381
+
382
+ // check required url components
383
+ if (params.snapshot != null && (params.repository == null)) {
384
+ const err = new this[kConfigurationError]('Missing required parameter of the url: repository')
385
+ return handleError(err, callback)
386
+ }
387
+
388
+ let { method, body, repository, snapshot, ...querystring } = params
389
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
390
+
391
+ let path = ''
392
+ if ((repository) != null && (snapshot) != null) {
393
+ if (method == null) method = 'GET'
394
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot) + '/' + '_status'
395
+ } else if ((repository) != null) {
396
+ if (method == null) method = 'GET'
397
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + '_status'
398
+ } else {
399
+ if (method == null) method = 'GET'
400
+ path = '/' + '_snapshot' + '/' + '_status'
401
+ }
402
+
403
+ // build request object
404
+ const request = {
405
+ method,
406
+ path,
407
+ body: null,
408
+ querystring
409
+ }
410
+
411
+ return this.transport.request(request, options, callback)
412
+ }
413
+
414
+ SnapshotApi.prototype.verifyRepository = function snapshotVerifyRepositoryApi (params, options, callback) {
415
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
416
+
417
+ // check required parameters
418
+ if (params.repository == null) {
419
+ const err = new this[kConfigurationError]('Missing required parameter: repository')
420
+ return handleError(err, callback)
421
+ }
422
+
423
+ let { method, body, repository, ...querystring } = params
424
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
425
+
426
+ let path = ''
427
+ if (method == null) method = 'POST'
428
+ path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + '_verify'
429
+
430
+ // build request object
431
+ const request = {
432
+ method,
433
+ path,
434
+ body: body || '',
435
+ querystring
436
+ }
437
+
438
+ return this.transport.request(request, options, callback)
439
+ }
440
+
441
+ Object.defineProperties(SnapshotApi.prototype, {
442
+ cleanup_repository: { get () { return this.cleanupRepository } },
443
+ create_repository: { get () { return this.createRepository } },
444
+ delete_repository: { get () { return this.deleteRepository } },
445
+ get_repository: { get () { return this.getRepository } },
446
+ repository_analyze: { get () { return this.repositoryAnalyze } },
447
+ verify_repository: { get () { return this.verifyRepository } }
448
+ })
449
+
450
+ module.exports = SnapshotApi
@@ -0,0 +1,119 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['nodes', 'actions', 'parent_task_id', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'timeout', 'detailed', 'group_by']
38
+ const snakeCase = { parentTaskId: 'parent_task_id', waitForCompletion: 'wait_for_completion', errorTrace: 'error_trace', filterPath: 'filter_path', groupBy: 'group_by' }
39
+
40
+ function TasksApi (transport, ConfigurationError) {
41
+ this.transport = transport
42
+ this[kConfigurationError] = ConfigurationError
43
+ }
44
+
45
+ TasksApi.prototype.cancel = function tasksCancelApi (params, options, callback) {
46
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
47
+
48
+ let { method, body, taskId, task_id, ...querystring } = params
49
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
50
+
51
+ let path = ''
52
+ if ((task_id || taskId) != null) {
53
+ if (method == null) method = 'POST'
54
+ path = '/' + '_tasks' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_cancel'
55
+ } else {
56
+ if (method == null) method = 'POST'
57
+ path = '/' + '_tasks' + '/' + '_cancel'
58
+ }
59
+
60
+ // build request object
61
+ const request = {
62
+ method,
63
+ path,
64
+ body: body || '',
65
+ querystring
66
+ }
67
+
68
+ return this.transport.request(request, options, callback)
69
+ }
70
+
71
+ TasksApi.prototype.get = function tasksGetApi (params, options, callback) {
72
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
73
+
74
+ // check required parameters
75
+ if (params.task_id == null && params.taskId == null) {
76
+ const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId')
77
+ return handleError(err, callback)
78
+ }
79
+
80
+ let { method, body, taskId, task_id, ...querystring } = params
81
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
82
+
83
+ let path = ''
84
+ if (method == null) method = 'GET'
85
+ path = '/' + '_tasks' + '/' + encodeURIComponent(task_id || taskId)
86
+
87
+ // build request object
88
+ const request = {
89
+ method,
90
+ path,
91
+ body: null,
92
+ querystring
93
+ }
94
+
95
+ return this.transport.request(request, options, callback)
96
+ }
97
+
98
+ TasksApi.prototype.list = function tasksListApi (params, options, callback) {
99
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
100
+
101
+ let { method, body, ...querystring } = params
102
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
103
+
104
+ let path = ''
105
+ if (method == null) method = 'GET'
106
+ path = '/' + '_tasks'
107
+
108
+ // build request object
109
+ const request = {
110
+ method,
111
+ path,
112
+ body: null,
113
+ querystring
114
+ }
115
+
116
+ return this.transport.request(request, options, callback)
117
+ }
118
+
119
+ module.exports = TasksApi
@@ -0,0 +1,67 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function termsEnumApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.index == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: index')
46
+ return handleError(err, callback)
47
+ }
48
+
49
+ let { method, body, index, ...querystring } = params
50
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
51
+
52
+ let path = ''
53
+ if (method == null) method = body == null ? 'GET' : 'POST'
54
+ path = '/' + encodeURIComponent(index) + '/' + '_terms_enum'
55
+
56
+ // build request object
57
+ const request = {
58
+ method,
59
+ path,
60
+ body: body || '',
61
+ querystring
62
+ }
63
+
64
+ return this.transport.request(request, options, callback)
65
+ }
66
+
67
+ module.exports = termsEnumApi