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