@opensearch-project/opensearch 1.1.0 → 2.1.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 (94) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.json +31 -0
  3. package/.prettierrc.json +5 -0
  4. package/.whitesource +15 -0
  5. package/ADMINS.md +13 -31
  6. package/CHANGELOG.md +24 -0
  7. package/COMPATIBILITY.md +27 -0
  8. package/DEVELOPER_GUIDE.md +22 -5
  9. package/MAINTAINERS.md +15 -70
  10. package/Makefile +2 -12
  11. package/README.md +19 -123
  12. package/RELEASING.md +3 -3
  13. package/SECURITY.md +1 -1
  14. package/USER_GUIDE.md +197 -0
  15. package/api/api/bulk.js +54 -28
  16. package/api/api/cat.js +355 -266
  17. package/api/api/clear_scroll.js +18 -19
  18. package/api/api/cluster.js +367 -221
  19. package/api/api/count.js +56 -26
  20. package/api/api/create.js +51 -26
  21. package/api/api/dangling_indices.js +96 -53
  22. package/api/api/delete.js +50 -24
  23. package/api/api/delete_by_query.js +89 -27
  24. package/api/api/delete_by_query_rethrottle.js +34 -21
  25. package/api/api/delete_script.js +32 -19
  26. package/api/api/exists.js +56 -24
  27. package/api/api/exists_source.js +61 -29
  28. package/api/api/explain.js +61 -24
  29. package/api/api/features.js +57 -37
  30. package/api/api/field_caps.js +37 -20
  31. package/api/api/get.js +56 -24
  32. package/api/api/get_script.js +31 -19
  33. package/api/api/get_script_context.js +16 -17
  34. package/api/api/get_script_languages.js +16 -17
  35. package/api/api/get_source.js +56 -24
  36. package/api/api/index.js +61 -30
  37. package/api/api/indices.js +1069 -859
  38. package/api/api/info.js +16 -17
  39. package/api/api/ingest.js +133 -98
  40. package/api/api/mget.js +51 -28
  41. package/api/api/msearch.js +50 -28
  42. package/api/api/msearch_template.js +54 -28
  43. package/api/api/mtermvectors.js +49 -26
  44. package/api/api/nodes.js +282 -156
  45. package/api/api/ping.js +16 -17
  46. package/api/api/put_script.js +41 -27
  47. package/api/api/rank_eval.js +38 -22
  48. package/api/api/reindex.js +39 -19
  49. package/api/api/reindex_rethrottle.js +33 -21
  50. package/api/api/render_search_template.js +19 -20
  51. package/api/api/scripts_painless_execute.js +16 -17
  52. package/api/api/scroll.js +32 -19
  53. package/api/api/search.js +109 -26
  54. package/api/api/search_shards.js +37 -20
  55. package/api/api/search_template.js +65 -28
  56. package/api/api/shutdown.js +67 -56
  57. package/api/api/snapshot.js +348 -226
  58. package/api/api/tasks.js +66 -48
  59. package/api/api/terms_enum.js +18 -19
  60. package/api/api/termvectors.js +58 -28
  61. package/api/api/update.js +65 -26
  62. package/api/api/update_by_query.js +90 -25
  63. package/api/api/update_by_query_rethrottle.js +34 -21
  64. package/api/index.js +268 -181
  65. package/api/new.d.ts +2043 -531
  66. package/api/opensearch_dashboards.d.ts +240 -238
  67. package/api/requestParams.d.ts +302 -71
  68. package/api/types.d.ts +6205 -5721
  69. package/api/utils.js +23 -24
  70. package/codecov.yml +2 -2
  71. package/index.d.ts +5203 -1037
  72. package/index.js +154 -143
  73. package/index.mjs +10 -11
  74. package/jenkins/release.JenkinsFile +11 -0
  75. package/lib/Connection.d.ts +38 -28
  76. package/lib/Connection.js +166 -170
  77. package/lib/Helpers.d.ts +108 -68
  78. package/lib/Helpers.js +401 -378
  79. package/lib/Serializer.d.ts +3 -4
  80. package/lib/Serializer.js +40 -41
  81. package/lib/Transport.d.ts +39 -15
  82. package/lib/Transport.js +381 -337
  83. package/lib/aws/AwsSigv4Signer.js +167 -0
  84. package/lib/aws/errors.js +24 -0
  85. package/lib/aws/index.d.ts +39 -0
  86. package/lib/aws/index.js +19 -0
  87. package/lib/errors.d.ts +26 -9
  88. package/lib/errors.js +76 -73
  89. package/lib/pool/BaseConnectionPool.js +101 -99
  90. package/lib/pool/CloudConnectionPool.js +17 -18
  91. package/lib/pool/ConnectionPool.js +106 -107
  92. package/lib/pool/index.d.ts +9 -8
  93. package/lib/pool/index.js +7 -8
  94. package/package.json +37 -15
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,129 +27,208 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
30
+ 'use strict';
32
31
 
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
36
- const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
- const acceptedQuerystring = ['include_yes_decisions', 'include_disk_info', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'timeout', 'master_timeout', 'wait_for_removal', 'local', 'flat_settings', 'include_defaults', 'expand_wildcards', 'level', 'wait_for_active_shards', 'wait_for_nodes', 'wait_for_events', 'wait_for_no_relocating_shards', 'wait_for_no_initializing_shards', 'wait_for_status', 'node_ids', 'node_names', 'create', 'dry_run', 'explain', 'retry_failed', 'metric', 'wait_for_metadata_version', 'wait_for_timeout', 'ignore_unavailable', 'allow_no_indices']
38
- const snakeCase = { includeYesDecisions: 'include_yes_decisions', includeDiskInfo: 'include_disk_info', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', waitForRemoval: 'wait_for_removal', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', expandWildcards: 'expand_wildcards', waitForActiveShards: 'wait_for_active_shards', waitForNodes: 'wait_for_nodes', waitForEvents: 'wait_for_events', waitForNoRelocatingShards: 'wait_for_no_relocating_shards', waitForNoInitializingShards: 'wait_for_no_initializing_shards', waitForStatus: 'wait_for_status', nodeIds: 'node_ids', nodeNames: 'node_names', dryRun: 'dry_run', retryFailed: 'retry_failed', waitForMetadataVersion: 'wait_for_metadata_version', waitForTimeout: 'wait_for_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices' }
39
-
40
- function ClusterApi (transport, ConfigurationError) {
41
- this.transport = transport
42
- this[kConfigurationError] = ConfigurationError
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'include_yes_decisions',
38
+ 'include_disk_info',
39
+ 'pretty',
40
+ 'human',
41
+ 'error_trace',
42
+ 'source',
43
+ 'filter_path',
44
+ 'timeout',
45
+ 'cluster_manager_timeout',
46
+ 'master_timeout',
47
+ 'wait_for_removal',
48
+ 'local',
49
+ 'flat_settings',
50
+ 'include_defaults',
51
+ 'expand_wildcards',
52
+ 'level',
53
+ 'wait_for_active_shards',
54
+ 'wait_for_nodes',
55
+ 'wait_for_events',
56
+ 'wait_for_no_relocating_shards',
57
+ 'wait_for_no_initializing_shards',
58
+ 'wait_for_status',
59
+ 'node_ids',
60
+ 'node_names',
61
+ 'create',
62
+ 'dry_run',
63
+ 'explain',
64
+ 'retry_failed',
65
+ 'metric',
66
+ 'wait_for_metadata_version',
67
+ 'wait_for_timeout',
68
+ 'ignore_unavailable',
69
+ 'allow_no_indices',
70
+ ];
71
+ const snakeCase = {
72
+ includeYesDecisions: 'include_yes_decisions',
73
+ includeDiskInfo: 'include_disk_info',
74
+ errorTrace: 'error_trace',
75
+ filterPath: 'filter_path',
76
+ clusterManagerTimeout: 'cluster_manager_timeout',
77
+ masterTimeout: 'master_timeout',
78
+ waitForRemoval: 'wait_for_removal',
79
+ flatSettings: 'flat_settings',
80
+ includeDefaults: 'include_defaults',
81
+ expandWildcards: 'expand_wildcards',
82
+ waitForActiveShards: 'wait_for_active_shards',
83
+ waitForNodes: 'wait_for_nodes',
84
+ waitForEvents: 'wait_for_events',
85
+ waitForNoRelocatingShards: 'wait_for_no_relocating_shards',
86
+ waitForNoInitializingShards: 'wait_for_no_initializing_shards',
87
+ waitForStatus: 'wait_for_status',
88
+ nodeIds: 'node_ids',
89
+ nodeNames: 'node_names',
90
+ dryRun: 'dry_run',
91
+ retryFailed: 'retry_failed',
92
+ waitForMetadataVersion: 'wait_for_metadata_version',
93
+ waitForTimeout: 'wait_for_timeout',
94
+ ignoreUnavailable: 'ignore_unavailable',
95
+ allowNoIndices: 'allow_no_indices',
96
+ };
97
+
98
+ function ClusterApi(transport, ConfigurationError) {
99
+ this.transport = transport;
100
+ this[kConfigurationError] = ConfigurationError;
43
101
  }
44
102
 
45
- ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi (params, options, callback) {
46
- ;[params, options, callback] = normalizeArguments(params, options, callback)
103
+ ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi(
104
+ params,
105
+ options,
106
+ callback
107
+ ) {
108
+ [params, options, callback] = normalizeArguments(params, options, callback);
47
109
 
48
- let { method, body, ...querystring } = params
49
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
110
+ let { method, body, ...querystring } = params;
111
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
50
112
 
51
- let path = ''
52
- if (method == null) method = body == null ? 'GET' : 'POST'
53
- path = '/' + '_cluster' + '/' + 'allocation' + '/' + 'explain'
113
+ let path = '';
114
+ if (method == null) method = body == null ? 'GET' : 'POST';
115
+ path = '/' + '_cluster' + '/' + 'allocation' + '/' + 'explain';
54
116
 
55
117
  // build request object
56
118
  const request = {
57
119
  method,
58
120
  path,
59
121
  body: body || '',
60
- querystring
61
- }
122
+ querystring,
123
+ };
62
124
 
63
- return this.transport.request(request, options, callback)
64
- }
125
+ return this.transport.request(request, options, callback);
126
+ };
65
127
 
66
- ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTemplateApi (params, options, callback) {
67
- ;[params, options, callback] = normalizeArguments(params, options, callback)
128
+ ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTemplateApi(
129
+ params,
130
+ options,
131
+ callback
132
+ ) {
133
+ [params, options, callback] = normalizeArguments(params, options, callback);
68
134
 
69
135
  // check required parameters
70
136
  if (params.name == null) {
71
- const err = new this[kConfigurationError]('Missing required parameter: name')
72
- return handleError(err, callback)
137
+ const err = new this[kConfigurationError]('Missing required parameter: name');
138
+ return handleError(err, callback);
73
139
  }
74
140
 
75
- let { method, body, name, ...querystring } = params
76
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
141
+ let { method, body, name, ...querystring } = params;
142
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
77
143
 
78
- let path = ''
79
- if (method == null) method = 'DELETE'
80
- path = '/' + '_component_template' + '/' + encodeURIComponent(name)
144
+ let path = '';
145
+ if (method == null) method = 'DELETE';
146
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name);
81
147
 
82
148
  // build request object
83
149
  const request = {
84
150
  method,
85
151
  path,
86
152
  body: body || '',
87
- querystring
88
- }
153
+ querystring,
154
+ };
89
155
 
90
- return this.transport.request(request, options, callback)
91
- }
156
+ return this.transport.request(request, options, callback);
157
+ };
92
158
 
93
- ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVotingConfigExclusionsApi (params, options, callback) {
94
- ;[params, options, callback] = normalizeArguments(params, options, callback)
159
+ ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVotingConfigExclusionsApi(
160
+ params,
161
+ options,
162
+ callback
163
+ ) {
164
+ [params, options, callback] = normalizeArguments(params, options, callback);
95
165
 
96
- let { method, body, ...querystring } = params
97
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
166
+ let { method, body, ...querystring } = params;
167
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
98
168
 
99
- let path = ''
100
- if (method == null) method = 'DELETE'
101
- path = '/' + '_cluster' + '/' + 'voting_config_exclusions'
169
+ let path = '';
170
+ if (method == null) method = 'DELETE';
171
+ path = '/' + '_cluster' + '/' + 'voting_config_exclusions';
102
172
 
103
173
  // build request object
104
174
  const request = {
105
175
  method,
106
176
  path,
107
177
  body: body || '',
108
- querystring
109
- }
178
+ querystring,
179
+ };
110
180
 
111
- return this.transport.request(request, options, callback)
112
- }
181
+ return this.transport.request(request, options, callback);
182
+ };
113
183
 
114
- ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTemplateApi (params, options, callback) {
115
- ;[params, options, callback] = normalizeArguments(params, options, callback)
184
+ ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTemplateApi(
185
+ params,
186
+ options,
187
+ callback
188
+ ) {
189
+ [params, options, callback] = normalizeArguments(params, options, callback);
116
190
 
117
191
  // check required parameters
118
192
  if (params.name == null) {
119
- const err = new this[kConfigurationError]('Missing required parameter: name')
120
- return handleError(err, callback)
193
+ const err = new this[kConfigurationError]('Missing required parameter: name');
194
+ return handleError(err, callback);
121
195
  }
122
196
 
123
- let { method, body, name, ...querystring } = params
124
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
197
+ let { method, body, name, ...querystring } = params;
198
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
125
199
 
126
- let path = ''
127
- if (method == null) method = 'HEAD'
128
- path = '/' + '_component_template' + '/' + encodeURIComponent(name)
200
+ let path = '';
201
+ if (method == null) method = 'HEAD';
202
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name);
129
203
 
130
204
  // build request object
131
205
  const request = {
132
206
  method,
133
207
  path,
134
208
  body: null,
135
- querystring
136
- }
137
-
138
- return this.transport.request(request, options, callback)
139
- }
140
-
141
- ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplateApi (params, options, callback) {
142
- ;[params, options, callback] = normalizeArguments(params, options, callback)
143
-
144
- let { method, body, name, ...querystring } = params
145
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
146
-
147
- let path = ''
148
- if ((name) != null) {
149
- if (method == null) method = 'GET'
150
- path = '/' + '_component_template' + '/' + encodeURIComponent(name)
209
+ querystring,
210
+ };
211
+
212
+ return this.transport.request(request, options, callback);
213
+ };
214
+
215
+ ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplateApi(
216
+ params,
217
+ options,
218
+ callback
219
+ ) {
220
+ [params, options, callback] = normalizeArguments(params, options, callback);
221
+
222
+ let { method, body, name, ...querystring } = params;
223
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
224
+
225
+ let path = '';
226
+ if (name != null) {
227
+ if (method == null) method = 'GET';
228
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name);
151
229
  } else {
152
- if (method == null) method = 'GET'
153
- path = '/' + '_component_template'
230
+ if (method == null) method = 'GET';
231
+ path = '/' + '_component_template';
154
232
  }
155
233
 
156
234
  // build request object
@@ -158,46 +236,46 @@ ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplate
158
236
  method,
159
237
  path,
160
238
  body: null,
161
- querystring
162
- }
239
+ querystring,
240
+ };
163
241
 
164
- return this.transport.request(request, options, callback)
165
- }
242
+ return this.transport.request(request, options, callback);
243
+ };
166
244
 
167
- ClusterApi.prototype.getSettings = function clusterGetSettingsApi (params, options, callback) {
168
- ;[params, options, callback] = normalizeArguments(params, options, callback)
245
+ ClusterApi.prototype.getSettings = function clusterGetSettingsApi(params, options, callback) {
246
+ [params, options, callback] = normalizeArguments(params, options, callback);
169
247
 
170
- let { method, body, ...querystring } = params
171
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
248
+ let { method, body, ...querystring } = params;
249
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
172
250
 
173
- let path = ''
174
- if (method == null) method = 'GET'
175
- path = '/' + '_cluster' + '/' + 'settings'
251
+ let path = '';
252
+ if (method == null) method = 'GET';
253
+ path = '/' + '_cluster' + '/' + 'settings';
176
254
 
177
255
  // build request object
178
256
  const request = {
179
257
  method,
180
258
  path,
181
259
  body: null,
182
- querystring
183
- }
260
+ querystring,
261
+ };
184
262
 
185
- return this.transport.request(request, options, callback)
186
- }
263
+ return this.transport.request(request, options, callback);
264
+ };
187
265
 
188
- ClusterApi.prototype.health = function clusterHealthApi (params, options, callback) {
189
- ;[params, options, callback] = normalizeArguments(params, options, callback)
266
+ ClusterApi.prototype.health = function clusterHealthApi(params, options, callback) {
267
+ [params, options, callback] = normalizeArguments(params, options, callback);
190
268
 
191
- let { method, body, index, ...querystring } = params
192
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
269
+ let { method, body, index, ...querystring } = params;
270
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
193
271
 
194
- let path = ''
195
- if ((index) != null) {
196
- if (method == null) method = 'GET'
197
- path = '/' + '_cluster' + '/' + 'health' + '/' + encodeURIComponent(index)
272
+ let path = '';
273
+ if (index != null) {
274
+ if (method == null) method = 'GET';
275
+ path = '/' + '_cluster' + '/' + 'health' + '/' + encodeURIComponent(index);
198
276
  } else {
199
- if (method == null) method = 'GET'
200
- path = '/' + '_cluster' + '/' + 'health'
277
+ if (method == null) method = 'GET';
278
+ path = '/' + '_cluster' + '/' + 'health';
201
279
  }
202
280
 
203
281
  // build request object
@@ -205,176 +283,192 @@ ClusterApi.prototype.health = function clusterHealthApi (params, options, callba
205
283
  method,
206
284
  path,
207
285
  body: null,
208
- querystring
209
- }
286
+ querystring,
287
+ };
210
288
 
211
- return this.transport.request(request, options, callback)
212
- }
289
+ return this.transport.request(request, options, callback);
290
+ };
213
291
 
214
- ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi (params, options, callback) {
215
- ;[params, options, callback] = normalizeArguments(params, options, callback)
292
+ ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi(params, options, callback) {
293
+ [params, options, callback] = normalizeArguments(params, options, callback);
216
294
 
217
- let { method, body, ...querystring } = params
218
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
295
+ let { method, body, ...querystring } = params;
296
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
219
297
 
220
- let path = ''
221
- if (method == null) method = 'GET'
222
- path = '/' + '_cluster' + '/' + 'pending_tasks'
298
+ let path = '';
299
+ if (method == null) method = 'GET';
300
+ path = '/' + '_cluster' + '/' + 'pending_tasks';
223
301
 
224
302
  // build request object
225
303
  const request = {
226
304
  method,
227
305
  path,
228
306
  body: null,
229
- querystring
230
- }
307
+ querystring,
308
+ };
231
309
 
232
- return this.transport.request(request, options, callback)
233
- }
310
+ return this.transport.request(request, options, callback);
311
+ };
234
312
 
235
- ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConfigExclusionsApi (params, options, callback) {
236
- ;[params, options, callback] = normalizeArguments(params, options, callback)
313
+ ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConfigExclusionsApi(
314
+ params,
315
+ options,
316
+ callback
317
+ ) {
318
+ [params, options, callback] = normalizeArguments(params, options, callback);
237
319
 
238
- let { method, body, ...querystring } = params
239
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
320
+ let { method, body, ...querystring } = params;
321
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
240
322
 
241
- let path = ''
242
- if (method == null) method = 'POST'
243
- path = '/' + '_cluster' + '/' + 'voting_config_exclusions'
323
+ let path = '';
324
+ if (method == null) method = 'POST';
325
+ path = '/' + '_cluster' + '/' + 'voting_config_exclusions';
244
326
 
245
327
  // build request object
246
328
  const request = {
247
329
  method,
248
330
  path,
249
331
  body: body || '',
250
- querystring
251
- }
332
+ querystring,
333
+ };
252
334
 
253
- return this.transport.request(request, options, callback)
254
- }
335
+ return this.transport.request(request, options, callback);
336
+ };
255
337
 
256
- ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplateApi (params, options, callback) {
257
- ;[params, options, callback] = normalizeArguments(params, options, callback)
338
+ ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplateApi(
339
+ params,
340
+ options,
341
+ callback
342
+ ) {
343
+ [params, options, callback] = normalizeArguments(params, options, callback);
258
344
 
259
345
  // check required parameters
260
346
  if (params.name == null) {
261
- const err = new this[kConfigurationError]('Missing required parameter: name')
262
- return handleError(err, callback)
347
+ const err = new this[kConfigurationError]('Missing required parameter: name');
348
+ return handleError(err, callback);
263
349
  }
264
350
  if (params.body == null) {
265
- const err = new this[kConfigurationError]('Missing required parameter: body')
266
- return handleError(err, callback)
351
+ const err = new this[kConfigurationError]('Missing required parameter: body');
352
+ return handleError(err, callback);
267
353
  }
268
354
 
269
- let { method, body, name, ...querystring } = params
270
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
355
+ let { method, body, name, ...querystring } = params;
356
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
271
357
 
272
- let path = ''
273
- if (method == null) method = 'PUT'
274
- path = '/' + '_component_template' + '/' + encodeURIComponent(name)
358
+ let path = '';
359
+ if (method == null) method = 'PUT';
360
+ path = '/' + '_component_template' + '/' + encodeURIComponent(name);
275
361
 
276
362
  // build request object
277
363
  const request = {
278
364
  method,
279
365
  path,
280
366
  body: body || '',
281
- querystring
282
- }
367
+ querystring,
368
+ };
283
369
 
284
- return this.transport.request(request, options, callback)
285
- }
370
+ return this.transport.request(request, options, callback);
371
+ };
286
372
 
287
- ClusterApi.prototype.putSettings = function clusterPutSettingsApi (params, options, callback) {
288
- ;[params, options, callback] = normalizeArguments(params, options, callback)
373
+ ClusterApi.prototype.putSettings = function clusterPutSettingsApi(params, options, callback) {
374
+ [params, options, callback] = normalizeArguments(params, options, callback);
289
375
 
290
376
  // check required parameters
291
377
  if (params.body == null) {
292
- const err = new this[kConfigurationError]('Missing required parameter: body')
293
- return handleError(err, callback)
378
+ const err = new this[kConfigurationError]('Missing required parameter: body');
379
+ return handleError(err, callback);
294
380
  }
295
381
 
296
- let { method, body, ...querystring } = params
297
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
382
+ let { method, body, ...querystring } = params;
383
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
298
384
 
299
- let path = ''
300
- if (method == null) method = 'PUT'
301
- path = '/' + '_cluster' + '/' + 'settings'
385
+ let path = '';
386
+ if (method == null) method = 'PUT';
387
+ path = '/' + '_cluster' + '/' + 'settings';
302
388
 
303
389
  // build request object
304
390
  const request = {
305
391
  method,
306
392
  path,
307
393
  body: body || '',
308
- querystring
309
- }
394
+ querystring,
395
+ };
310
396
 
311
- return this.transport.request(request, options, callback)
312
- }
397
+ return this.transport.request(request, options, callback);
398
+ };
313
399
 
314
- ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi (params, options, callback) {
315
- ;[params, options, callback] = normalizeArguments(params, options, callback)
400
+ ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi(params, options, callback) {
401
+ [params, options, callback] = normalizeArguments(params, options, callback);
316
402
 
317
- let { method, body, ...querystring } = params
318
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
403
+ let { method, body, ...querystring } = params;
404
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
319
405
 
320
- let path = ''
321
- if (method == null) method = 'GET'
322
- path = '/' + '_remote' + '/' + 'info'
406
+ let path = '';
407
+ if (method == null) method = 'GET';
408
+ path = '/' + '_remote' + '/' + 'info';
323
409
 
324
410
  // build request object
325
411
  const request = {
326
412
  method,
327
413
  path,
328
414
  body: null,
329
- querystring
330
- }
415
+ querystring,
416
+ };
331
417
 
332
- return this.transport.request(request, options, callback)
333
- }
418
+ return this.transport.request(request, options, callback);
419
+ };
334
420
 
335
- ClusterApi.prototype.reroute = function clusterRerouteApi (params, options, callback) {
336
- ;[params, options, callback] = normalizeArguments(params, options, callback)
421
+ ClusterApi.prototype.reroute = function clusterRerouteApi(params, options, callback) {
422
+ [params, options, callback] = normalizeArguments(params, options, callback);
337
423
 
338
- let { method, body, ...querystring } = params
339
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
424
+ let { method, body, ...querystring } = params;
425
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
340
426
 
341
- let path = ''
342
- if (method == null) method = 'POST'
343
- path = '/' + '_cluster' + '/' + 'reroute'
427
+ let path = '';
428
+ if (method == null) method = 'POST';
429
+ path = '/' + '_cluster' + '/' + 'reroute';
344
430
 
345
431
  // build request object
346
432
  const request = {
347
433
  method,
348
434
  path,
349
435
  body: body || '',
350
- querystring
351
- }
436
+ querystring,
437
+ };
352
438
 
353
- return this.transport.request(request, options, callback)
354
- }
439
+ return this.transport.request(request, options, callback);
440
+ };
355
441
 
356
- ClusterApi.prototype.state = function clusterStateApi (params, options, callback) {
357
- ;[params, options, callback] = normalizeArguments(params, options, callback)
442
+ ClusterApi.prototype.state = function clusterStateApi(params, options, callback) {
443
+ [params, options, callback] = normalizeArguments(params, options, callback);
358
444
 
359
445
  // check required url components
360
- if (params.index != null && (params.metric == null)) {
361
- const err = new this[kConfigurationError]('Missing required parameter of the url: metric')
362
- return handleError(err, callback)
446
+ if (params.index != null && params.metric == null) {
447
+ const err = new this[kConfigurationError]('Missing required parameter of the url: metric');
448
+ return handleError(err, callback);
363
449
  }
364
450
 
365
- let { method, body, metric, index, ...querystring } = params
366
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
367
-
368
- let path = ''
369
- if ((metric) != null && (index) != null) {
370
- if (method == null) method = 'GET'
371
- path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric) + '/' + encodeURIComponent(index)
372
- } else if ((metric) != null) {
373
- if (method == null) method = 'GET'
374
- path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric)
451
+ let { method, body, metric, index, ...querystring } = params;
452
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
453
+
454
+ let path = '';
455
+ if (metric != null && index != null) {
456
+ if (method == null) method = 'GET';
457
+ path =
458
+ '/' +
459
+ '_cluster' +
460
+ '/' +
461
+ 'state' +
462
+ '/' +
463
+ encodeURIComponent(metric) +
464
+ '/' +
465
+ encodeURIComponent(index);
466
+ } else if (metric != null) {
467
+ if (method == null) method = 'GET';
468
+ path = '/' + '_cluster' + '/' + 'state' + '/' + encodeURIComponent(metric);
375
469
  } else {
376
- if (method == null) method = 'GET'
377
- path = '/' + '_cluster' + '/' + 'state'
470
+ if (method == null) method = 'GET';
471
+ path = '/' + '_cluster' + '/' + 'state';
378
472
  }
379
473
 
380
474
  // build request object
@@ -382,25 +476,33 @@ ClusterApi.prototype.state = function clusterStateApi (params, options, callback
382
476
  method,
383
477
  path,
384
478
  body: null,
385
- querystring
386
- }
479
+ querystring,
480
+ };
387
481
 
388
- return this.transport.request(request, options, callback)
389
- }
482
+ return this.transport.request(request, options, callback);
483
+ };
390
484
 
391
- ClusterApi.prototype.stats = function clusterStatsApi (params, options, callback) {
392
- ;[params, options, callback] = normalizeArguments(params, options, callback)
485
+ ClusterApi.prototype.stats = function clusterStatsApi(params, options, callback) {
486
+ [params, options, callback] = normalizeArguments(params, options, callback);
393
487
 
394
- let { method, body, nodeId, node_id, ...querystring } = params
395
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
488
+ let { method, body, nodeId, node_id, ...querystring } = params;
489
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
396
490
 
397
- let path = ''
491
+ let path = '';
398
492
  if ((node_id || nodeId) != null) {
399
- if (method == null) method = 'GET'
400
- path = '/' + '_cluster' + '/' + 'stats' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId)
493
+ if (method == null) method = 'GET';
494
+ path =
495
+ '/' +
496
+ '_cluster' +
497
+ '/' +
498
+ 'stats' +
499
+ '/' +
500
+ 'nodes' +
501
+ '/' +
502
+ encodeURIComponent(node_id || nodeId);
401
503
  } else {
402
- if (method == null) method = 'GET'
403
- path = '/' + '_cluster' + '/' + 'stats'
504
+ if (method == null) method = 'GET';
505
+ path = '/' + '_cluster' + '/' + 'stats';
404
506
  }
405
507
 
406
508
  // build request object
@@ -408,24 +510,68 @@ ClusterApi.prototype.stats = function clusterStatsApi (params, options, callback
408
510
  method,
409
511
  path,
410
512
  body: null,
411
- querystring
412
- }
513
+ querystring,
514
+ };
413
515
 
414
- return this.transport.request(request, options, callback)
415
- }
516
+ return this.transport.request(request, options, callback);
517
+ };
416
518
 
417
519
  Object.defineProperties(ClusterApi.prototype, {
418
- allocation_explain: { get () { return this.allocationExplain } },
419
- delete_component_template: { get () { return this.deleteComponentTemplate } },
420
- delete_voting_config_exclusions: { get () { return this.deleteVotingConfigExclusions } },
421
- exists_component_template: { get () { return this.existsComponentTemplate } },
422
- get_component_template: { get () { return this.getComponentTemplate } },
423
- get_settings: { get () { return this.getSettings } },
424
- pending_tasks: { get () { return this.pendingTasks } },
425
- post_voting_config_exclusions: { get () { return this.postVotingConfigExclusions } },
426
- put_component_template: { get () { return this.putComponentTemplate } },
427
- put_settings: { get () { return this.putSettings } },
428
- remote_info: { get () { return this.remoteInfo } }
429
- })
430
-
431
- module.exports = ClusterApi
520
+ allocation_explain: {
521
+ get() {
522
+ return this.allocationExplain;
523
+ },
524
+ },
525
+ delete_component_template: {
526
+ get() {
527
+ return this.deleteComponentTemplate;
528
+ },
529
+ },
530
+ delete_voting_config_exclusions: {
531
+ get() {
532
+ return this.deleteVotingConfigExclusions;
533
+ },
534
+ },
535
+ exists_component_template: {
536
+ get() {
537
+ return this.existsComponentTemplate;
538
+ },
539
+ },
540
+ get_component_template: {
541
+ get() {
542
+ return this.getComponentTemplate;
543
+ },
544
+ },
545
+ get_settings: {
546
+ get() {
547
+ return this.getSettings;
548
+ },
549
+ },
550
+ pending_tasks: {
551
+ get() {
552
+ return this.pendingTasks;
553
+ },
554
+ },
555
+ post_voting_config_exclusions: {
556
+ get() {
557
+ return this.postVotingConfigExclusions;
558
+ },
559
+ },
560
+ put_component_template: {
561
+ get() {
562
+ return this.putComponentTemplate;
563
+ },
564
+ },
565
+ put_settings: {
566
+ get() {
567
+ return this.putSettings;
568
+ },
569
+ },
570
+ remote_info: {
571
+ get() {
572
+ return this.remoteInfo;
573
+ },
574
+ },
575
+ });
576
+
577
+ module.exports = ClusterApi;