@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
package/api/api/ml.js ADDED
@@ -0,0 +1,2010 @@
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 = ['allow_no_match', 'allow_no_jobs', 'force', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'requests_per_second', 'allow_no_forecasts', 'wait_for_completion', 'lines_to_sample', 'line_merge_size_limit', 'charset', 'format', 'has_header_row', 'column_names', 'delimiter', 'quote', 'should_trim_fields', 'grok_pattern', 'timestamp_field', 'timestamp_format', 'explain', 'calc_interim', 'start', 'end', 'advance_time', 'skip_time', 'duration', 'expires_in', 'max_model_memory', 'expand', 'exclude_interim', 'from', 'size', 'anomaly_score', 'sort', 'desc', 'job_id', 'partition_field_value', 'exclude_generated', 'verbose', 'allow_no_datafeeds', 'influencer_score', 'top_n', 'bucket_span', 'overall_score', 'record_score', 'include', 'include_model_definition', 'decompress_definition', 'tags', 'reset_start', 'reset_end', 'ignore_unavailable', 'allow_no_indices', 'ignore_throttled', 'expand_wildcards', 'reassign', 'delete_intervening_results', 'enabled']
27
+ const snakeCase = { allowNoMatch: 'allow_no_match', allowNoJobs: 'allow_no_jobs', errorTrace: 'error_trace', filterPath: 'filter_path', requestsPerSecond: 'requests_per_second', allowNoForecasts: 'allow_no_forecasts', waitForCompletion: 'wait_for_completion', linesToSample: 'lines_to_sample', lineMergeSizeLimit: 'line_merge_size_limit', hasHeaderRow: 'has_header_row', columnNames: 'column_names', shouldTrimFields: 'should_trim_fields', grokPattern: 'grok_pattern', timestampField: 'timestamp_field', timestampFormat: 'timestamp_format', calcInterim: 'calc_interim', advanceTime: 'advance_time', skipTime: 'skip_time', expiresIn: 'expires_in', maxModelMemory: 'max_model_memory', excludeInterim: 'exclude_interim', anomalyScore: 'anomaly_score', jobId: 'job_id', partitionFieldValue: 'partition_field_value', excludeGenerated: 'exclude_generated', allowNoDatafeeds: 'allow_no_datafeeds', influencerScore: 'influencer_score', topN: 'top_n', bucketSpan: 'bucket_span', overallScore: 'overall_score', recordScore: 'record_score', includeModelDefinition: 'include_model_definition', decompressDefinition: 'decompress_definition', resetStart: 'reset_start', resetEnd: 'reset_end', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', ignoreThrottled: 'ignore_throttled', expandWildcards: 'expand_wildcards', deleteInterveningResults: 'delete_intervening_results' }
28
+
29
+ function MlApi (transport, ConfigurationError) {
30
+ this.transport = transport
31
+ this[kConfigurationError] = ConfigurationError
32
+ }
33
+
34
+ MlApi.prototype.closeJob = function mlCloseJobApi (params, options, callback) {
35
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
36
+
37
+ // check required parameters
38
+ if (params.job_id == null && params.jobId == null) {
39
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
40
+ return handleError(err, callback)
41
+ }
42
+
43
+ let { method, body, jobId, job_id, ...querystring } = params
44
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45
+
46
+ let path = ''
47
+ if (method == null) method = 'POST'
48
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_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
+ MlApi.prototype.deleteCalendar = function mlDeleteCalendarApi (params, options, callback) {
62
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
63
+
64
+ // check required parameters
65
+ if (params.calendar_id == null && params.calendarId == null) {
66
+ const err = new this[kConfigurationError]('Missing required parameter: calendar_id or calendarId')
67
+ return handleError(err, callback)
68
+ }
69
+
70
+ let { method, body, calendarId, calendar_id, ...querystring } = params
71
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
72
+
73
+ let path = ''
74
+ if (method == null) method = 'DELETE'
75
+ path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId)
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
+ MlApi.prototype.deleteCalendarEvent = function mlDeleteCalendarEventApi (params, options, callback) {
89
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
90
+
91
+ // check required parameters
92
+ if (params.calendar_id == null && params.calendarId == null) {
93
+ const err = new this[kConfigurationError]('Missing required parameter: calendar_id or calendarId')
94
+ return handleError(err, callback)
95
+ }
96
+ if (params.event_id == null && params.eventId == null) {
97
+ const err = new this[kConfigurationError]('Missing required parameter: event_id or eventId')
98
+ return handleError(err, callback)
99
+ }
100
+
101
+ // check required url components
102
+ if ((params.event_id != null || params.eventId != null) && ((params.calendar_id == null && params.calendarId == null))) {
103
+ const err = new this[kConfigurationError]('Missing required parameter of the url: calendar_id')
104
+ return handleError(err, callback)
105
+ }
106
+
107
+ let { method, body, calendarId, calendar_id, eventId, event_id, ...querystring } = params
108
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
109
+
110
+ let path = ''
111
+ if (method == null) method = 'DELETE'
112
+ path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events' + '/' + encodeURIComponent(event_id || eventId)
113
+
114
+ // build request object
115
+ const request = {
116
+ method,
117
+ path,
118
+ body: body || '',
119
+ querystring
120
+ }
121
+
122
+ return this.transport.request(request, options, callback)
123
+ }
124
+
125
+ MlApi.prototype.deleteCalendarJob = function mlDeleteCalendarJobApi (params, options, callback) {
126
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
127
+
128
+ // check required parameters
129
+ if (params.calendar_id == null && params.calendarId == null) {
130
+ const err = new this[kConfigurationError]('Missing required parameter: calendar_id or calendarId')
131
+ return handleError(err, callback)
132
+ }
133
+ if (params.job_id == null && params.jobId == null) {
134
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
135
+ return handleError(err, callback)
136
+ }
137
+
138
+ // check required url components
139
+ if ((params.job_id != null || params.jobId != null) && ((params.calendar_id == null && params.calendarId == null))) {
140
+ const err = new this[kConfigurationError]('Missing required parameter of the url: calendar_id')
141
+ return handleError(err, callback)
142
+ }
143
+
144
+ let { method, body, calendarId, calendar_id, jobId, job_id, ...querystring } = params
145
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
146
+
147
+ let path = ''
148
+ if (method == null) method = 'DELETE'
149
+ path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId)
150
+
151
+ // build request object
152
+ const request = {
153
+ method,
154
+ path,
155
+ body: body || '',
156
+ querystring
157
+ }
158
+
159
+ return this.transport.request(request, options, callback)
160
+ }
161
+
162
+ MlApi.prototype.deleteDataFrameAnalytics = function mlDeleteDataFrameAnalyticsApi (params, options, callback) {
163
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
164
+
165
+ // check required parameters
166
+ if (params.id == null) {
167
+ const err = new this[kConfigurationError]('Missing required parameter: id')
168
+ return handleError(err, callback)
169
+ }
170
+
171
+ let { method, body, id, ...querystring } = params
172
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
173
+
174
+ let path = ''
175
+ if (method == null) method = 'DELETE'
176
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id)
177
+
178
+ // build request object
179
+ const request = {
180
+ method,
181
+ path,
182
+ body: body || '',
183
+ querystring
184
+ }
185
+
186
+ return this.transport.request(request, options, callback)
187
+ }
188
+
189
+ MlApi.prototype.deleteDatafeed = function mlDeleteDatafeedApi (params, options, callback) {
190
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
191
+
192
+ // check required parameters
193
+ if (params.datafeed_id == null && params.datafeedId == null) {
194
+ const err = new this[kConfigurationError]('Missing required parameter: datafeed_id or datafeedId')
195
+ return handleError(err, callback)
196
+ }
197
+
198
+ let { method, body, datafeedId, datafeed_id, ...querystring } = params
199
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
200
+
201
+ let path = ''
202
+ if (method == null) method = 'DELETE'
203
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId)
204
+
205
+ // build request object
206
+ const request = {
207
+ method,
208
+ path,
209
+ body: body || '',
210
+ querystring
211
+ }
212
+
213
+ return this.transport.request(request, options, callback)
214
+ }
215
+
216
+ MlApi.prototype.deleteExpiredData = function mlDeleteExpiredDataApi (params, options, callback) {
217
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
218
+
219
+ let { method, body, jobId, job_id, ...querystring } = params
220
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
221
+
222
+ let path = ''
223
+ if ((job_id || jobId) != null) {
224
+ if (method == null) method = 'DELETE'
225
+ path = '/' + '_ml' + '/' + '_delete_expired_data' + '/' + encodeURIComponent(job_id || jobId)
226
+ } else {
227
+ if (method == null) method = 'DELETE'
228
+ path = '/' + '_ml' + '/' + '_delete_expired_data'
229
+ }
230
+
231
+ // build request object
232
+ const request = {
233
+ method,
234
+ path,
235
+ body: body || '',
236
+ querystring
237
+ }
238
+
239
+ return this.transport.request(request, options, callback)
240
+ }
241
+
242
+ MlApi.prototype.deleteFilter = function mlDeleteFilterApi (params, options, callback) {
243
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
244
+
245
+ // check required parameters
246
+ if (params.filter_id == null && params.filterId == null) {
247
+ const err = new this[kConfigurationError]('Missing required parameter: filter_id or filterId')
248
+ return handleError(err, callback)
249
+ }
250
+
251
+ let { method, body, filterId, filter_id, ...querystring } = params
252
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
253
+
254
+ let path = ''
255
+ if (method == null) method = 'DELETE'
256
+ path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId)
257
+
258
+ // build request object
259
+ const request = {
260
+ method,
261
+ path,
262
+ body: body || '',
263
+ querystring
264
+ }
265
+
266
+ return this.transport.request(request, options, callback)
267
+ }
268
+
269
+ MlApi.prototype.deleteForecast = function mlDeleteForecastApi (params, options, callback) {
270
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
271
+
272
+ // check required parameters
273
+ if (params.job_id == null && params.jobId == null) {
274
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
275
+ return handleError(err, callback)
276
+ }
277
+
278
+ // check required url components
279
+ if ((params.forecast_id != null || params.forecastId != null) && ((params.job_id == null && params.jobId == null))) {
280
+ const err = new this[kConfigurationError]('Missing required parameter of the url: job_id')
281
+ return handleError(err, callback)
282
+ }
283
+
284
+ let { method, body, jobId, job_id, forecastId, forecast_id, ...querystring } = params
285
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
286
+
287
+ let path = ''
288
+ if ((job_id || jobId) != null && (forecast_id || forecastId) != null) {
289
+ if (method == null) method = 'DELETE'
290
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast' + '/' + encodeURIComponent(forecast_id || forecastId)
291
+ } else {
292
+ if (method == null) method = 'DELETE'
293
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast'
294
+ }
295
+
296
+ // build request object
297
+ const request = {
298
+ method,
299
+ path,
300
+ body: body || '',
301
+ querystring
302
+ }
303
+
304
+ return this.transport.request(request, options, callback)
305
+ }
306
+
307
+ MlApi.prototype.deleteJob = function mlDeleteJobApi (params, options, callback) {
308
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
309
+
310
+ // check required parameters
311
+ if (params.job_id == null && params.jobId == null) {
312
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
313
+ return handleError(err, callback)
314
+ }
315
+
316
+ let { method, body, jobId, job_id, ...querystring } = params
317
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
318
+
319
+ let path = ''
320
+ if (method == null) method = 'DELETE'
321
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
322
+
323
+ // build request object
324
+ const request = {
325
+ method,
326
+ path,
327
+ body: body || '',
328
+ querystring
329
+ }
330
+
331
+ return this.transport.request(request, options, callback)
332
+ }
333
+
334
+ MlApi.prototype.deleteModelSnapshot = function mlDeleteModelSnapshotApi (params, options, callback) {
335
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
336
+
337
+ // check required parameters
338
+ if (params.job_id == null && params.jobId == null) {
339
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
340
+ return handleError(err, callback)
341
+ }
342
+ if (params.snapshot_id == null && params.snapshotId == null) {
343
+ const err = new this[kConfigurationError]('Missing required parameter: snapshot_id or snapshotId')
344
+ return handleError(err, callback)
345
+ }
346
+
347
+ // check required url components
348
+ if ((params.snapshot_id != null || params.snapshotId != null) && ((params.job_id == null && params.jobId == null))) {
349
+ const err = new this[kConfigurationError]('Missing required parameter of the url: job_id')
350
+ return handleError(err, callback)
351
+ }
352
+
353
+ let { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params
354
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
355
+
356
+ let path = ''
357
+ if (method == null) method = 'DELETE'
358
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId)
359
+
360
+ // build request object
361
+ const request = {
362
+ method,
363
+ path,
364
+ body: body || '',
365
+ querystring
366
+ }
367
+
368
+ return this.transport.request(request, options, callback)
369
+ }
370
+
371
+ MlApi.prototype.deleteTrainedModel = function mlDeleteTrainedModelApi (params, options, callback) {
372
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
373
+
374
+ // check required parameters
375
+ if (params.model_id == null && params.modelId == null) {
376
+ const err = new this[kConfigurationError]('Missing required parameter: model_id or modelId')
377
+ return handleError(err, callback)
378
+ }
379
+
380
+ let { method, body, modelId, model_id, ...querystring } = params
381
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
382
+
383
+ let path = ''
384
+ if (method == null) method = 'DELETE'
385
+ path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId)
386
+
387
+ // build request object
388
+ const request = {
389
+ method,
390
+ path,
391
+ body: body || '',
392
+ querystring
393
+ }
394
+
395
+ return this.transport.request(request, options, callback)
396
+ }
397
+
398
+ MlApi.prototype.deleteTrainedModelAlias = function mlDeleteTrainedModelAliasApi (params, options, callback) {
399
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
400
+
401
+ // check required parameters
402
+ if (params.model_alias == null && params.modelAlias == null) {
403
+ const err = new this[kConfigurationError]('Missing required parameter: model_alias or modelAlias')
404
+ return handleError(err, callback)
405
+ }
406
+ if (params.model_id == null && params.modelId == null) {
407
+ const err = new this[kConfigurationError]('Missing required parameter: model_id or modelId')
408
+ return handleError(err, callback)
409
+ }
410
+
411
+ // check required url components
412
+ if ((params.model_alias != null || params.modelAlias != null) && ((params.model_id == null && params.modelId == null))) {
413
+ const err = new this[kConfigurationError]('Missing required parameter of the url: model_id')
414
+ return handleError(err, callback)
415
+ }
416
+
417
+ let { method, body, modelAlias, model_alias, modelId, model_id, ...querystring } = params
418
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
419
+
420
+ let path = ''
421
+ if (method == null) method = 'DELETE'
422
+ path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId) + '/' + 'model_aliases' + '/' + encodeURIComponent(model_alias || modelAlias)
423
+
424
+ // build request object
425
+ const request = {
426
+ method,
427
+ path,
428
+ body: body || '',
429
+ querystring
430
+ }
431
+
432
+ return this.transport.request(request, options, callback)
433
+ }
434
+
435
+ MlApi.prototype.estimateModelMemory = function mlEstimateModelMemoryApi (params, options, callback) {
436
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
437
+
438
+ // check required parameters
439
+ if (params.body == null) {
440
+ const err = new this[kConfigurationError]('Missing required parameter: body')
441
+ return handleError(err, callback)
442
+ }
443
+
444
+ let { method, body, ...querystring } = params
445
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
446
+
447
+ let path = ''
448
+ if (method == null) method = 'POST'
449
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_estimate_model_memory'
450
+
451
+ // build request object
452
+ const request = {
453
+ method,
454
+ path,
455
+ body: body || '',
456
+ querystring
457
+ }
458
+
459
+ return this.transport.request(request, options, callback)
460
+ }
461
+
462
+ MlApi.prototype.evaluateDataFrame = function mlEvaluateDataFrameApi (params, options, callback) {
463
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
464
+
465
+ // check required parameters
466
+ if (params.body == null) {
467
+ const err = new this[kConfigurationError]('Missing required parameter: body')
468
+ return handleError(err, callback)
469
+ }
470
+
471
+ let { method, body, ...querystring } = params
472
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
473
+
474
+ let path = ''
475
+ if (method == null) method = 'POST'
476
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + '_evaluate'
477
+
478
+ // build request object
479
+ const request = {
480
+ method,
481
+ path,
482
+ body: body || '',
483
+ querystring
484
+ }
485
+
486
+ return this.transport.request(request, options, callback)
487
+ }
488
+
489
+ MlApi.prototype.explainDataFrameAnalytics = function mlExplainDataFrameAnalyticsApi (params, options, callback) {
490
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
491
+
492
+ let { method, body, id, ...querystring } = params
493
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
494
+
495
+ let path = ''
496
+ if ((id) != null) {
497
+ if (method == null) method = body == null ? 'GET' : 'POST'
498
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_explain'
499
+ } else {
500
+ if (method == null) method = body == null ? 'GET' : 'POST'
501
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_explain'
502
+ }
503
+
504
+ // build request object
505
+ const request = {
506
+ method,
507
+ path,
508
+ body: body || '',
509
+ querystring
510
+ }
511
+
512
+ return this.transport.request(request, options, callback)
513
+ }
514
+
515
+ MlApi.prototype.findFileStructure = function mlFindFileStructureApi (params, options, callback) {
516
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
517
+
518
+ // check required parameters
519
+ if (params.body == null) {
520
+ const err = new this[kConfigurationError]('Missing required parameter: body')
521
+ return handleError(err, callback)
522
+ }
523
+
524
+ let { method, body, ...querystring } = params
525
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
526
+
527
+ let path = ''
528
+ if (method == null) method = 'POST'
529
+ path = '/' + '_ml' + '/' + 'find_file_structure'
530
+
531
+ // build request object
532
+ const request = {
533
+ method,
534
+ path,
535
+ bulkBody: body,
536
+ querystring
537
+ }
538
+
539
+ return this.transport.request(request, options, callback)
540
+ }
541
+
542
+ MlApi.prototype.flushJob = function mlFlushJobApi (params, options, callback) {
543
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
544
+
545
+ // check required parameters
546
+ if (params.job_id == null && params.jobId == null) {
547
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
548
+ return handleError(err, callback)
549
+ }
550
+
551
+ let { method, body, jobId, job_id, ...querystring } = params
552
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
553
+
554
+ let path = ''
555
+ if (method == null) method = 'POST'
556
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_flush'
557
+
558
+ // build request object
559
+ const request = {
560
+ method,
561
+ path,
562
+ body: body || '',
563
+ querystring
564
+ }
565
+
566
+ return this.transport.request(request, options, callback)
567
+ }
568
+
569
+ MlApi.prototype.forecast = function mlForecastApi (params, options, callback) {
570
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
571
+
572
+ // check required parameters
573
+ if (params.job_id == null && params.jobId == null) {
574
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
575
+ return handleError(err, callback)
576
+ }
577
+
578
+ let { method, body, jobId, job_id, ...querystring } = params
579
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
580
+
581
+ let path = ''
582
+ if (method == null) method = 'POST'
583
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_forecast'
584
+
585
+ // build request object
586
+ const request = {
587
+ method,
588
+ path,
589
+ body: body || '',
590
+ querystring
591
+ }
592
+
593
+ return this.transport.request(request, options, callback)
594
+ }
595
+
596
+ MlApi.prototype.getBuckets = function mlGetBucketsApi (params, options, callback) {
597
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
598
+
599
+ // check required parameters
600
+ if (params.job_id == null && params.jobId == null) {
601
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
602
+ return handleError(err, callback)
603
+ }
604
+
605
+ // check required url components
606
+ if (params.timestamp != null && ((params.job_id == null && params.jobId == null))) {
607
+ const err = new this[kConfigurationError]('Missing required parameter of the url: job_id')
608
+ return handleError(err, callback)
609
+ }
610
+
611
+ let { method, body, jobId, job_id, timestamp, ...querystring } = params
612
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
613
+
614
+ let path = ''
615
+ if ((job_id || jobId) != null && (timestamp) != null) {
616
+ if (method == null) method = body == null ? 'GET' : 'POST'
617
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets' + '/' + encodeURIComponent(timestamp)
618
+ } else {
619
+ if (method == null) method = body == null ? 'GET' : 'POST'
620
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'buckets'
621
+ }
622
+
623
+ // build request object
624
+ const request = {
625
+ method,
626
+ path,
627
+ body: body || '',
628
+ querystring
629
+ }
630
+
631
+ return this.transport.request(request, options, callback)
632
+ }
633
+
634
+ MlApi.prototype.getCalendarEvents = function mlGetCalendarEventsApi (params, options, callback) {
635
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
636
+
637
+ // check required parameters
638
+ if (params.calendar_id == null && params.calendarId == null) {
639
+ const err = new this[kConfigurationError]('Missing required parameter: calendar_id or calendarId')
640
+ return handleError(err, callback)
641
+ }
642
+
643
+ let { method, body, calendarId, calendar_id, ...querystring } = params
644
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
645
+
646
+ let path = ''
647
+ if (method == null) method = 'GET'
648
+ path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events'
649
+
650
+ // build request object
651
+ const request = {
652
+ method,
653
+ path,
654
+ body: null,
655
+ querystring
656
+ }
657
+
658
+ return this.transport.request(request, options, callback)
659
+ }
660
+
661
+ MlApi.prototype.getCalendars = function mlGetCalendarsApi (params, options, callback) {
662
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
663
+
664
+ let { method, body, calendarId, calendar_id, ...querystring } = params
665
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
666
+
667
+ let path = ''
668
+ if ((calendar_id || calendarId) != null) {
669
+ if (method == null) method = body == null ? 'GET' : 'POST'
670
+ path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId)
671
+ } else {
672
+ if (method == null) method = body == null ? 'GET' : 'POST'
673
+ path = '/' + '_ml' + '/' + 'calendars'
674
+ }
675
+
676
+ // build request object
677
+ const request = {
678
+ method,
679
+ path,
680
+ body: body || '',
681
+ querystring
682
+ }
683
+
684
+ return this.transport.request(request, options, callback)
685
+ }
686
+
687
+ MlApi.prototype.getCategories = function mlGetCategoriesApi (params, options, callback) {
688
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
689
+
690
+ // check required parameters
691
+ if (params.job_id == null && params.jobId == null) {
692
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
693
+ return handleError(err, callback)
694
+ }
695
+
696
+ // check required url components
697
+ if ((params.category_id != null || params.categoryId != null) && ((params.job_id == null && params.jobId == null))) {
698
+ const err = new this[kConfigurationError]('Missing required parameter of the url: job_id')
699
+ return handleError(err, callback)
700
+ }
701
+
702
+ let { method, body, jobId, job_id, categoryId, category_id, ...querystring } = params
703
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
704
+
705
+ let path = ''
706
+ if ((job_id || jobId) != null && (category_id || categoryId) != null) {
707
+ if (method == null) method = body == null ? 'GET' : 'POST'
708
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories' + '/' + encodeURIComponent(category_id || categoryId)
709
+ } else {
710
+ if (method == null) method = body == null ? 'GET' : 'POST'
711
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'categories'
712
+ }
713
+
714
+ // build request object
715
+ const request = {
716
+ method,
717
+ path,
718
+ body: body || '',
719
+ querystring
720
+ }
721
+
722
+ return this.transport.request(request, options, callback)
723
+ }
724
+
725
+ MlApi.prototype.getDataFrameAnalytics = function mlGetDataFrameAnalyticsApi (params, options, callback) {
726
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
727
+
728
+ let { method, body, id, ...querystring } = params
729
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
730
+
731
+ let path = ''
732
+ if ((id) != null) {
733
+ if (method == null) method = 'GET'
734
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id)
735
+ } else {
736
+ if (method == null) method = 'GET'
737
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics'
738
+ }
739
+
740
+ // build request object
741
+ const request = {
742
+ method,
743
+ path,
744
+ body: null,
745
+ querystring
746
+ }
747
+
748
+ return this.transport.request(request, options, callback)
749
+ }
750
+
751
+ MlApi.prototype.getDataFrameAnalyticsStats = function mlGetDataFrameAnalyticsStatsApi (params, options, callback) {
752
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
753
+
754
+ let { method, body, id, ...querystring } = params
755
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
756
+
757
+ let path = ''
758
+ if ((id) != null) {
759
+ if (method == null) method = 'GET'
760
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_stats'
761
+ } else {
762
+ if (method == null) method = 'GET'
763
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_stats'
764
+ }
765
+
766
+ // build request object
767
+ const request = {
768
+ method,
769
+ path,
770
+ body: null,
771
+ querystring
772
+ }
773
+
774
+ return this.transport.request(request, options, callback)
775
+ }
776
+
777
+ MlApi.prototype.getDatafeedStats = function mlGetDatafeedStatsApi (params, options, callback) {
778
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
779
+
780
+ let { method, body, datafeedId, datafeed_id, ...querystring } = params
781
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
782
+
783
+ let path = ''
784
+ if ((datafeed_id || datafeedId) != null) {
785
+ if (method == null) method = 'GET'
786
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stats'
787
+ } else {
788
+ if (method == null) method = 'GET'
789
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + '_stats'
790
+ }
791
+
792
+ // build request object
793
+ const request = {
794
+ method,
795
+ path,
796
+ body: null,
797
+ querystring
798
+ }
799
+
800
+ return this.transport.request(request, options, callback)
801
+ }
802
+
803
+ MlApi.prototype.getDatafeeds = function mlGetDatafeedsApi (params, options, callback) {
804
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
805
+
806
+ let { method, body, datafeedId, datafeed_id, ...querystring } = params
807
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
808
+
809
+ let path = ''
810
+ if ((datafeed_id || datafeedId) != null) {
811
+ if (method == null) method = 'GET'
812
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId)
813
+ } else {
814
+ if (method == null) method = 'GET'
815
+ path = '/' + '_ml' + '/' + 'datafeeds'
816
+ }
817
+
818
+ // build request object
819
+ const request = {
820
+ method,
821
+ path,
822
+ body: null,
823
+ querystring
824
+ }
825
+
826
+ return this.transport.request(request, options, callback)
827
+ }
828
+
829
+ MlApi.prototype.getFilters = function mlGetFiltersApi (params, options, callback) {
830
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
831
+
832
+ let { method, body, filterId, filter_id, ...querystring } = params
833
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
834
+
835
+ let path = ''
836
+ if ((filter_id || filterId) != null) {
837
+ if (method == null) method = 'GET'
838
+ path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId)
839
+ } else {
840
+ if (method == null) method = 'GET'
841
+ path = '/' + '_ml' + '/' + 'filters'
842
+ }
843
+
844
+ // build request object
845
+ const request = {
846
+ method,
847
+ path,
848
+ body: null,
849
+ querystring
850
+ }
851
+
852
+ return this.transport.request(request, options, callback)
853
+ }
854
+
855
+ MlApi.prototype.getInfluencers = function mlGetInfluencersApi (params, options, callback) {
856
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
857
+
858
+ // check required parameters
859
+ if (params.job_id == null && params.jobId == null) {
860
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
861
+ return handleError(err, callback)
862
+ }
863
+
864
+ let { method, body, jobId, job_id, ...querystring } = params
865
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
866
+
867
+ let path = ''
868
+ if (method == null) method = body == null ? 'GET' : 'POST'
869
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'influencers'
870
+
871
+ // build request object
872
+ const request = {
873
+ method,
874
+ path,
875
+ body: body || '',
876
+ querystring
877
+ }
878
+
879
+ return this.transport.request(request, options, callback)
880
+ }
881
+
882
+ MlApi.prototype.getJobStats = function mlGetJobStatsApi (params, options, callback) {
883
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
884
+
885
+ let { method, body, jobId, job_id, ...querystring } = params
886
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
887
+
888
+ let path = ''
889
+ if ((job_id || jobId) != null) {
890
+ if (method == null) method = 'GET'
891
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_stats'
892
+ } else {
893
+ if (method == null) method = 'GET'
894
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_stats'
895
+ }
896
+
897
+ // build request object
898
+ const request = {
899
+ method,
900
+ path,
901
+ body: null,
902
+ querystring
903
+ }
904
+
905
+ return this.transport.request(request, options, callback)
906
+ }
907
+
908
+ MlApi.prototype.getJobs = function mlGetJobsApi (params, options, callback) {
909
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
910
+
911
+ let { method, body, jobId, job_id, ...querystring } = params
912
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
913
+
914
+ let path = ''
915
+ if ((job_id || jobId) != null) {
916
+ if (method == null) method = 'GET'
917
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
918
+ } else {
919
+ if (method == null) method = 'GET'
920
+ path = '/' + '_ml' + '/' + 'anomaly_detectors'
921
+ }
922
+
923
+ // build request object
924
+ const request = {
925
+ method,
926
+ path,
927
+ body: null,
928
+ querystring
929
+ }
930
+
931
+ return this.transport.request(request, options, callback)
932
+ }
933
+
934
+ MlApi.prototype.getModelSnapshots = function mlGetModelSnapshotsApi (params, options, callback) {
935
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
936
+
937
+ // check required parameters
938
+ if (params.job_id == null && params.jobId == null) {
939
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
940
+ return handleError(err, callback)
941
+ }
942
+
943
+ // check required url components
944
+ if ((params.snapshot_id != null || params.snapshotId != null) && ((params.job_id == null && params.jobId == null))) {
945
+ const err = new this[kConfigurationError]('Missing required parameter of the url: job_id')
946
+ return handleError(err, callback)
947
+ }
948
+
949
+ let { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params
950
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
951
+
952
+ let path = ''
953
+ if ((job_id || jobId) != null && (snapshot_id || snapshotId) != null) {
954
+ if (method == null) method = body == null ? 'GET' : 'POST'
955
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId)
956
+ } else {
957
+ if (method == null) method = body == null ? 'GET' : 'POST'
958
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots'
959
+ }
960
+
961
+ // build request object
962
+ const request = {
963
+ method,
964
+ path,
965
+ body: body || '',
966
+ querystring
967
+ }
968
+
969
+ return this.transport.request(request, options, callback)
970
+ }
971
+
972
+ MlApi.prototype.getOverallBuckets = function mlGetOverallBucketsApi (params, options, callback) {
973
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
974
+
975
+ // check required parameters
976
+ if (params.job_id == null && params.jobId == null) {
977
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
978
+ return handleError(err, callback)
979
+ }
980
+
981
+ let { method, body, jobId, job_id, ...querystring } = params
982
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
983
+
984
+ let path = ''
985
+ if (method == null) method = body == null ? 'GET' : 'POST'
986
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'overall_buckets'
987
+
988
+ // build request object
989
+ const request = {
990
+ method,
991
+ path,
992
+ body: body || '',
993
+ querystring
994
+ }
995
+
996
+ return this.transport.request(request, options, callback)
997
+ }
998
+
999
+ MlApi.prototype.getRecords = function mlGetRecordsApi (params, options, callback) {
1000
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1001
+
1002
+ // check required parameters
1003
+ if (params.job_id == null && params.jobId == null) {
1004
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1005
+ return handleError(err, callback)
1006
+ }
1007
+
1008
+ let { method, body, jobId, job_id, ...querystring } = params
1009
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1010
+
1011
+ let path = ''
1012
+ if (method == null) method = body == null ? 'GET' : 'POST'
1013
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'results' + '/' + 'records'
1014
+
1015
+ // build request object
1016
+ const request = {
1017
+ method,
1018
+ path,
1019
+ body: body || '',
1020
+ querystring
1021
+ }
1022
+
1023
+ return this.transport.request(request, options, callback)
1024
+ }
1025
+
1026
+ MlApi.prototype.getTrainedModels = function mlGetTrainedModelsApi (params, options, callback) {
1027
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1028
+
1029
+ let { method, body, modelId, model_id, ...querystring } = params
1030
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1031
+
1032
+ let path = ''
1033
+ if ((model_id || modelId) != null) {
1034
+ if (method == null) method = 'GET'
1035
+ path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId)
1036
+ } else {
1037
+ if (method == null) method = 'GET'
1038
+ path = '/' + '_ml' + '/' + 'trained_models'
1039
+ }
1040
+
1041
+ // build request object
1042
+ const request = {
1043
+ method,
1044
+ path,
1045
+ body: null,
1046
+ querystring
1047
+ }
1048
+
1049
+ return this.transport.request(request, options, callback)
1050
+ }
1051
+
1052
+ MlApi.prototype.getTrainedModelsStats = function mlGetTrainedModelsStatsApi (params, options, callback) {
1053
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1054
+
1055
+ let { method, body, modelId, model_id, ...querystring } = params
1056
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1057
+
1058
+ let path = ''
1059
+ if ((model_id || modelId) != null) {
1060
+ if (method == null) method = 'GET'
1061
+ path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId) + '/' + '_stats'
1062
+ } else {
1063
+ if (method == null) method = 'GET'
1064
+ path = '/' + '_ml' + '/' + 'trained_models' + '/' + '_stats'
1065
+ }
1066
+
1067
+ // build request object
1068
+ const request = {
1069
+ method,
1070
+ path,
1071
+ body: null,
1072
+ querystring
1073
+ }
1074
+
1075
+ return this.transport.request(request, options, callback)
1076
+ }
1077
+
1078
+ MlApi.prototype.info = function mlInfoApi (params, options, callback) {
1079
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1080
+
1081
+ let { method, body, ...querystring } = params
1082
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1083
+
1084
+ let path = ''
1085
+ if (method == null) method = 'GET'
1086
+ path = '/' + '_ml' + '/' + 'info'
1087
+
1088
+ // build request object
1089
+ const request = {
1090
+ method,
1091
+ path,
1092
+ body: null,
1093
+ querystring
1094
+ }
1095
+
1096
+ return this.transport.request(request, options, callback)
1097
+ }
1098
+
1099
+ MlApi.prototype.openJob = function mlOpenJobApi (params, options, callback) {
1100
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1101
+
1102
+ // check required parameters
1103
+ if (params.job_id == null && params.jobId == null) {
1104
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1105
+ return handleError(err, callback)
1106
+ }
1107
+
1108
+ let { method, body, jobId, job_id, ...querystring } = params
1109
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1110
+
1111
+ let path = ''
1112
+ if (method == null) method = 'POST'
1113
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_open'
1114
+
1115
+ // build request object
1116
+ const request = {
1117
+ method,
1118
+ path,
1119
+ body: body || '',
1120
+ querystring
1121
+ }
1122
+
1123
+ return this.transport.request(request, options, callback)
1124
+ }
1125
+
1126
+ MlApi.prototype.postCalendarEvents = function mlPostCalendarEventsApi (params, options, callback) {
1127
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1128
+
1129
+ // check required parameters
1130
+ if (params.calendar_id == null && params.calendarId == null) {
1131
+ const err = new this[kConfigurationError]('Missing required parameter: calendar_id or calendarId')
1132
+ return handleError(err, callback)
1133
+ }
1134
+ if (params.body == null) {
1135
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1136
+ return handleError(err, callback)
1137
+ }
1138
+
1139
+ let { method, body, calendarId, calendar_id, ...querystring } = params
1140
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1141
+
1142
+ let path = ''
1143
+ if (method == null) method = 'POST'
1144
+ path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'events'
1145
+
1146
+ // build request object
1147
+ const request = {
1148
+ method,
1149
+ path,
1150
+ body: body || '',
1151
+ querystring
1152
+ }
1153
+
1154
+ return this.transport.request(request, options, callback)
1155
+ }
1156
+
1157
+ MlApi.prototype.postData = function mlPostDataApi (params, options, callback) {
1158
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1159
+
1160
+ // check required parameters
1161
+ if (params.job_id == null && params.jobId == null) {
1162
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1163
+ return handleError(err, callback)
1164
+ }
1165
+ if (params.body == null) {
1166
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1167
+ return handleError(err, callback)
1168
+ }
1169
+
1170
+ let { method, body, jobId, job_id, ...querystring } = params
1171
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1172
+
1173
+ let path = ''
1174
+ if (method == null) method = 'POST'
1175
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_data'
1176
+
1177
+ // build request object
1178
+ const request = {
1179
+ method,
1180
+ path,
1181
+ bulkBody: body,
1182
+ querystring
1183
+ }
1184
+
1185
+ return this.transport.request(request, options, callback)
1186
+ }
1187
+
1188
+ MlApi.prototype.previewDataFrameAnalytics = function mlPreviewDataFrameAnalyticsApi (params, options, callback) {
1189
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1190
+
1191
+ let { method, body, id, ...querystring } = params
1192
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1193
+
1194
+ let path = ''
1195
+ if ((id) != null) {
1196
+ if (method == null) method = body == null ? 'GET' : 'POST'
1197
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_preview'
1198
+ } else {
1199
+ if (method == null) method = body == null ? 'GET' : 'POST'
1200
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_preview'
1201
+ }
1202
+
1203
+ // build request object
1204
+ const request = {
1205
+ method,
1206
+ path,
1207
+ body: body || '',
1208
+ querystring
1209
+ }
1210
+
1211
+ return this.transport.request(request, options, callback)
1212
+ }
1213
+
1214
+ MlApi.prototype.previewDatafeed = function mlPreviewDatafeedApi (params, options, callback) {
1215
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1216
+
1217
+ let { method, body, datafeedId, datafeed_id, ...querystring } = params
1218
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1219
+
1220
+ let path = ''
1221
+ if ((datafeed_id || datafeedId) != null) {
1222
+ if (method == null) method = body == null ? 'GET' : 'POST'
1223
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_preview'
1224
+ } else {
1225
+ if (method == null) method = body == null ? 'GET' : 'POST'
1226
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + '_preview'
1227
+ }
1228
+
1229
+ // build request object
1230
+ const request = {
1231
+ method,
1232
+ path,
1233
+ body: body || '',
1234
+ querystring
1235
+ }
1236
+
1237
+ return this.transport.request(request, options, callback)
1238
+ }
1239
+
1240
+ MlApi.prototype.putCalendar = function mlPutCalendarApi (params, options, callback) {
1241
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1242
+
1243
+ // check required parameters
1244
+ if (params.calendar_id == null && params.calendarId == null) {
1245
+ const err = new this[kConfigurationError]('Missing required parameter: calendar_id or calendarId')
1246
+ return handleError(err, callback)
1247
+ }
1248
+
1249
+ let { method, body, calendarId, calendar_id, ...querystring } = params
1250
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1251
+
1252
+ let path = ''
1253
+ if (method == null) method = 'PUT'
1254
+ path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId)
1255
+
1256
+ // build request object
1257
+ const request = {
1258
+ method,
1259
+ path,
1260
+ body: body || '',
1261
+ querystring
1262
+ }
1263
+
1264
+ return this.transport.request(request, options, callback)
1265
+ }
1266
+
1267
+ MlApi.prototype.putCalendarJob = function mlPutCalendarJobApi (params, options, callback) {
1268
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1269
+
1270
+ // check required parameters
1271
+ if (params.calendar_id == null && params.calendarId == null) {
1272
+ const err = new this[kConfigurationError]('Missing required parameter: calendar_id or calendarId')
1273
+ return handleError(err, callback)
1274
+ }
1275
+ if (params.job_id == null && params.jobId == null) {
1276
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1277
+ return handleError(err, callback)
1278
+ }
1279
+
1280
+ // check required url components
1281
+ if ((params.job_id != null || params.jobId != null) && ((params.calendar_id == null && params.calendarId == null))) {
1282
+ const err = new this[kConfigurationError]('Missing required parameter of the url: calendar_id')
1283
+ return handleError(err, callback)
1284
+ }
1285
+
1286
+ let { method, body, calendarId, calendar_id, jobId, job_id, ...querystring } = params
1287
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1288
+
1289
+ let path = ''
1290
+ if (method == null) method = 'PUT'
1291
+ path = '/' + '_ml' + '/' + 'calendars' + '/' + encodeURIComponent(calendar_id || calendarId) + '/' + 'jobs' + '/' + encodeURIComponent(job_id || jobId)
1292
+
1293
+ // build request object
1294
+ const request = {
1295
+ method,
1296
+ path,
1297
+ body: body || '',
1298
+ querystring
1299
+ }
1300
+
1301
+ return this.transport.request(request, options, callback)
1302
+ }
1303
+
1304
+ MlApi.prototype.putDataFrameAnalytics = function mlPutDataFrameAnalyticsApi (params, options, callback) {
1305
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1306
+
1307
+ // check required parameters
1308
+ if (params.id == null) {
1309
+ const err = new this[kConfigurationError]('Missing required parameter: id')
1310
+ return handleError(err, callback)
1311
+ }
1312
+ if (params.body == null) {
1313
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1314
+ return handleError(err, callback)
1315
+ }
1316
+
1317
+ let { method, body, id, ...querystring } = params
1318
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1319
+
1320
+ let path = ''
1321
+ if (method == null) method = 'PUT'
1322
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id)
1323
+
1324
+ // build request object
1325
+ const request = {
1326
+ method,
1327
+ path,
1328
+ body: body || '',
1329
+ querystring
1330
+ }
1331
+
1332
+ return this.transport.request(request, options, callback)
1333
+ }
1334
+
1335
+ MlApi.prototype.putDatafeed = function mlPutDatafeedApi (params, options, callback) {
1336
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1337
+
1338
+ // check required parameters
1339
+ if (params.datafeed_id == null && params.datafeedId == null) {
1340
+ const err = new this[kConfigurationError]('Missing required parameter: datafeed_id or datafeedId')
1341
+ return handleError(err, callback)
1342
+ }
1343
+ if (params.body == null) {
1344
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1345
+ return handleError(err, callback)
1346
+ }
1347
+
1348
+ let { method, body, datafeedId, datafeed_id, ...querystring } = params
1349
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1350
+
1351
+ let path = ''
1352
+ if (method == null) method = 'PUT'
1353
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId)
1354
+
1355
+ // build request object
1356
+ const request = {
1357
+ method,
1358
+ path,
1359
+ body: body || '',
1360
+ querystring
1361
+ }
1362
+
1363
+ return this.transport.request(request, options, callback)
1364
+ }
1365
+
1366
+ MlApi.prototype.putFilter = function mlPutFilterApi (params, options, callback) {
1367
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1368
+
1369
+ // check required parameters
1370
+ if (params.filter_id == null && params.filterId == null) {
1371
+ const err = new this[kConfigurationError]('Missing required parameter: filter_id or filterId')
1372
+ return handleError(err, callback)
1373
+ }
1374
+ if (params.body == null) {
1375
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1376
+ return handleError(err, callback)
1377
+ }
1378
+
1379
+ let { method, body, filterId, filter_id, ...querystring } = params
1380
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1381
+
1382
+ let path = ''
1383
+ if (method == null) method = 'PUT'
1384
+ path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId)
1385
+
1386
+ // build request object
1387
+ const request = {
1388
+ method,
1389
+ path,
1390
+ body: body || '',
1391
+ querystring
1392
+ }
1393
+
1394
+ return this.transport.request(request, options, callback)
1395
+ }
1396
+
1397
+ MlApi.prototype.putJob = function mlPutJobApi (params, options, callback) {
1398
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1399
+
1400
+ // check required parameters
1401
+ if (params.job_id == null && params.jobId == null) {
1402
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1403
+ return handleError(err, callback)
1404
+ }
1405
+ if (params.body == null) {
1406
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1407
+ return handleError(err, callback)
1408
+ }
1409
+
1410
+ let { method, body, jobId, job_id, ...querystring } = params
1411
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1412
+
1413
+ let path = ''
1414
+ if (method == null) method = 'PUT'
1415
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
1416
+
1417
+ // build request object
1418
+ const request = {
1419
+ method,
1420
+ path,
1421
+ body: body || '',
1422
+ querystring
1423
+ }
1424
+
1425
+ return this.transport.request(request, options, callback)
1426
+ }
1427
+
1428
+ MlApi.prototype.putTrainedModel = function mlPutTrainedModelApi (params, options, callback) {
1429
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1430
+
1431
+ // check required parameters
1432
+ if (params.model_id == null && params.modelId == null) {
1433
+ const err = new this[kConfigurationError]('Missing required parameter: model_id or modelId')
1434
+ return handleError(err, callback)
1435
+ }
1436
+ if (params.body == null) {
1437
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1438
+ return handleError(err, callback)
1439
+ }
1440
+
1441
+ let { method, body, modelId, model_id, ...querystring } = params
1442
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1443
+
1444
+ let path = ''
1445
+ if (method == null) method = 'PUT'
1446
+ path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId)
1447
+
1448
+ // build request object
1449
+ const request = {
1450
+ method,
1451
+ path,
1452
+ body: body || '',
1453
+ querystring
1454
+ }
1455
+
1456
+ return this.transport.request(request, options, callback)
1457
+ }
1458
+
1459
+ MlApi.prototype.putTrainedModelAlias = function mlPutTrainedModelAliasApi (params, options, callback) {
1460
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1461
+
1462
+ // check required parameters
1463
+ if (params.model_alias == null && params.modelAlias == null) {
1464
+ const err = new this[kConfigurationError]('Missing required parameter: model_alias or modelAlias')
1465
+ return handleError(err, callback)
1466
+ }
1467
+ if (params.model_id == null && params.modelId == null) {
1468
+ const err = new this[kConfigurationError]('Missing required parameter: model_id or modelId')
1469
+ return handleError(err, callback)
1470
+ }
1471
+
1472
+ // check required url components
1473
+ if ((params.model_alias != null || params.modelAlias != null) && ((params.model_id == null && params.modelId == null))) {
1474
+ const err = new this[kConfigurationError]('Missing required parameter of the url: model_id')
1475
+ return handleError(err, callback)
1476
+ }
1477
+
1478
+ let { method, body, modelAlias, model_alias, modelId, model_id, ...querystring } = params
1479
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1480
+
1481
+ let path = ''
1482
+ if (method == null) method = 'PUT'
1483
+ path = '/' + '_ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId) + '/' + 'model_aliases' + '/' + encodeURIComponent(model_alias || modelAlias)
1484
+
1485
+ // build request object
1486
+ const request = {
1487
+ method,
1488
+ path,
1489
+ body: body || '',
1490
+ querystring
1491
+ }
1492
+
1493
+ return this.transport.request(request, options, callback)
1494
+ }
1495
+
1496
+ MlApi.prototype.resetJob = function mlResetJobApi (params, options, callback) {
1497
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1498
+
1499
+ // check required parameters
1500
+ if (params.job_id == null && params.jobId == null) {
1501
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1502
+ return handleError(err, callback)
1503
+ }
1504
+
1505
+ let { method, body, jobId, job_id, ...querystring } = params
1506
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1507
+
1508
+ let path = ''
1509
+ if (method == null) method = 'POST'
1510
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_reset'
1511
+
1512
+ // build request object
1513
+ const request = {
1514
+ method,
1515
+ path,
1516
+ body: body || '',
1517
+ querystring
1518
+ }
1519
+
1520
+ return this.transport.request(request, options, callback)
1521
+ }
1522
+
1523
+ MlApi.prototype.revertModelSnapshot = function mlRevertModelSnapshotApi (params, options, callback) {
1524
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1525
+
1526
+ // check required parameters
1527
+ if (params.job_id == null && params.jobId == null) {
1528
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1529
+ return handleError(err, callback)
1530
+ }
1531
+ if (params.snapshot_id == null && params.snapshotId == null) {
1532
+ const err = new this[kConfigurationError]('Missing required parameter: snapshot_id or snapshotId')
1533
+ return handleError(err, callback)
1534
+ }
1535
+
1536
+ // check required url components
1537
+ if ((params.snapshot_id != null || params.snapshotId != null) && ((params.job_id == null && params.jobId == null))) {
1538
+ const err = new this[kConfigurationError]('Missing required parameter of the url: job_id')
1539
+ return handleError(err, callback)
1540
+ }
1541
+
1542
+ let { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params
1543
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1544
+
1545
+ let path = ''
1546
+ if (method == null) method = 'POST'
1547
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_revert'
1548
+
1549
+ // build request object
1550
+ const request = {
1551
+ method,
1552
+ path,
1553
+ body: body || '',
1554
+ querystring
1555
+ }
1556
+
1557
+ return this.transport.request(request, options, callback)
1558
+ }
1559
+
1560
+ MlApi.prototype.setUpgradeMode = function mlSetUpgradeModeApi (params, options, callback) {
1561
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1562
+
1563
+ let { method, body, ...querystring } = params
1564
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1565
+
1566
+ let path = ''
1567
+ if (method == null) method = 'POST'
1568
+ path = '/' + '_ml' + '/' + 'set_upgrade_mode'
1569
+
1570
+ // build request object
1571
+ const request = {
1572
+ method,
1573
+ path,
1574
+ body: body || '',
1575
+ querystring
1576
+ }
1577
+
1578
+ return this.transport.request(request, options, callback)
1579
+ }
1580
+
1581
+ MlApi.prototype.startDataFrameAnalytics = function mlStartDataFrameAnalyticsApi (params, options, callback) {
1582
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1583
+
1584
+ // check required parameters
1585
+ if (params.id == null) {
1586
+ const err = new this[kConfigurationError]('Missing required parameter: id')
1587
+ return handleError(err, callback)
1588
+ }
1589
+
1590
+ let { method, body, id, ...querystring } = params
1591
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1592
+
1593
+ let path = ''
1594
+ if (method == null) method = 'POST'
1595
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_start'
1596
+
1597
+ // build request object
1598
+ const request = {
1599
+ method,
1600
+ path,
1601
+ body: body || '',
1602
+ querystring
1603
+ }
1604
+
1605
+ return this.transport.request(request, options, callback)
1606
+ }
1607
+
1608
+ MlApi.prototype.startDatafeed = function mlStartDatafeedApi (params, options, callback) {
1609
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1610
+
1611
+ // check required parameters
1612
+ if (params.datafeed_id == null && params.datafeedId == null) {
1613
+ const err = new this[kConfigurationError]('Missing required parameter: datafeed_id or datafeedId')
1614
+ return handleError(err, callback)
1615
+ }
1616
+
1617
+ let { method, body, datafeedId, datafeed_id, ...querystring } = params
1618
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1619
+
1620
+ let path = ''
1621
+ if (method == null) method = 'POST'
1622
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_start'
1623
+
1624
+ // build request object
1625
+ const request = {
1626
+ method,
1627
+ path,
1628
+ body: body || '',
1629
+ querystring
1630
+ }
1631
+
1632
+ return this.transport.request(request, options, callback)
1633
+ }
1634
+
1635
+ MlApi.prototype.stopDataFrameAnalytics = function mlStopDataFrameAnalyticsApi (params, options, callback) {
1636
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1637
+
1638
+ // check required parameters
1639
+ if (params.id == null) {
1640
+ const err = new this[kConfigurationError]('Missing required parameter: id')
1641
+ return handleError(err, callback)
1642
+ }
1643
+
1644
+ let { method, body, id, ...querystring } = params
1645
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1646
+
1647
+ let path = ''
1648
+ if (method == null) method = 'POST'
1649
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_stop'
1650
+
1651
+ // build request object
1652
+ const request = {
1653
+ method,
1654
+ path,
1655
+ body: body || '',
1656
+ querystring
1657
+ }
1658
+
1659
+ return this.transport.request(request, options, callback)
1660
+ }
1661
+
1662
+ MlApi.prototype.stopDatafeed = function mlStopDatafeedApi (params, options, callback) {
1663
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1664
+
1665
+ // check required parameters
1666
+ if (params.datafeed_id == null && params.datafeedId == null) {
1667
+ const err = new this[kConfigurationError]('Missing required parameter: datafeed_id or datafeedId')
1668
+ return handleError(err, callback)
1669
+ }
1670
+
1671
+ let { method, body, datafeedId, datafeed_id, ...querystring } = params
1672
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1673
+
1674
+ let path = ''
1675
+ if (method == null) method = 'POST'
1676
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_stop'
1677
+
1678
+ // build request object
1679
+ const request = {
1680
+ method,
1681
+ path,
1682
+ body: body || '',
1683
+ querystring
1684
+ }
1685
+
1686
+ return this.transport.request(request, options, callback)
1687
+ }
1688
+
1689
+ MlApi.prototype.updateDataFrameAnalytics = function mlUpdateDataFrameAnalyticsApi (params, options, callback) {
1690
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1691
+
1692
+ // check required parameters
1693
+ if (params.id == null) {
1694
+ const err = new this[kConfigurationError]('Missing required parameter: id')
1695
+ return handleError(err, callback)
1696
+ }
1697
+ if (params.body == null) {
1698
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1699
+ return handleError(err, callback)
1700
+ }
1701
+
1702
+ let { method, body, id, ...querystring } = params
1703
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1704
+
1705
+ let path = ''
1706
+ if (method == null) method = 'POST'
1707
+ path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) + '/' + '_update'
1708
+
1709
+ // build request object
1710
+ const request = {
1711
+ method,
1712
+ path,
1713
+ body: body || '',
1714
+ querystring
1715
+ }
1716
+
1717
+ return this.transport.request(request, options, callback)
1718
+ }
1719
+
1720
+ MlApi.prototype.updateDatafeed = function mlUpdateDatafeedApi (params, options, callback) {
1721
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1722
+
1723
+ // check required parameters
1724
+ if (params.datafeed_id == null && params.datafeedId == null) {
1725
+ const err = new this[kConfigurationError]('Missing required parameter: datafeed_id or datafeedId')
1726
+ return handleError(err, callback)
1727
+ }
1728
+ if (params.body == null) {
1729
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1730
+ return handleError(err, callback)
1731
+ }
1732
+
1733
+ let { method, body, datafeedId, datafeed_id, ...querystring } = params
1734
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1735
+
1736
+ let path = ''
1737
+ if (method == null) method = 'POST'
1738
+ path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_update'
1739
+
1740
+ // build request object
1741
+ const request = {
1742
+ method,
1743
+ path,
1744
+ body: body || '',
1745
+ querystring
1746
+ }
1747
+
1748
+ return this.transport.request(request, options, callback)
1749
+ }
1750
+
1751
+ MlApi.prototype.updateFilter = function mlUpdateFilterApi (params, options, callback) {
1752
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1753
+
1754
+ // check required parameters
1755
+ if (params.filter_id == null && params.filterId == null) {
1756
+ const err = new this[kConfigurationError]('Missing required parameter: filter_id or filterId')
1757
+ return handleError(err, callback)
1758
+ }
1759
+ if (params.body == null) {
1760
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1761
+ return handleError(err, callback)
1762
+ }
1763
+
1764
+ let { method, body, filterId, filter_id, ...querystring } = params
1765
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1766
+
1767
+ let path = ''
1768
+ if (method == null) method = 'POST'
1769
+ path = '/' + '_ml' + '/' + 'filters' + '/' + encodeURIComponent(filter_id || filterId) + '/' + '_update'
1770
+
1771
+ // build request object
1772
+ const request = {
1773
+ method,
1774
+ path,
1775
+ body: body || '',
1776
+ querystring
1777
+ }
1778
+
1779
+ return this.transport.request(request, options, callback)
1780
+ }
1781
+
1782
+ MlApi.prototype.updateJob = function mlUpdateJobApi (params, options, callback) {
1783
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1784
+
1785
+ // check required parameters
1786
+ if (params.job_id == null && params.jobId == null) {
1787
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1788
+ return handleError(err, callback)
1789
+ }
1790
+ if (params.body == null) {
1791
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1792
+ return handleError(err, callback)
1793
+ }
1794
+
1795
+ let { method, body, jobId, job_id, ...querystring } = params
1796
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1797
+
1798
+ let path = ''
1799
+ if (method == null) method = 'POST'
1800
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_update'
1801
+
1802
+ // build request object
1803
+ const request = {
1804
+ method,
1805
+ path,
1806
+ body: body || '',
1807
+ querystring
1808
+ }
1809
+
1810
+ return this.transport.request(request, options, callback)
1811
+ }
1812
+
1813
+ MlApi.prototype.updateModelSnapshot = function mlUpdateModelSnapshotApi (params, options, callback) {
1814
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1815
+
1816
+ // check required parameters
1817
+ if (params.job_id == null && params.jobId == null) {
1818
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1819
+ return handleError(err, callback)
1820
+ }
1821
+ if (params.snapshot_id == null && params.snapshotId == null) {
1822
+ const err = new this[kConfigurationError]('Missing required parameter: snapshot_id or snapshotId')
1823
+ return handleError(err, callback)
1824
+ }
1825
+ if (params.body == null) {
1826
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1827
+ return handleError(err, callback)
1828
+ }
1829
+
1830
+ // check required url components
1831
+ if ((params.snapshot_id != null || params.snapshotId != null) && ((params.job_id == null && params.jobId == null))) {
1832
+ const err = new this[kConfigurationError]('Missing required parameter of the url: job_id')
1833
+ return handleError(err, callback)
1834
+ }
1835
+
1836
+ let { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params
1837
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1838
+
1839
+ let path = ''
1840
+ if (method == null) method = 'POST'
1841
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_update'
1842
+
1843
+ // build request object
1844
+ const request = {
1845
+ method,
1846
+ path,
1847
+ body: body || '',
1848
+ querystring
1849
+ }
1850
+
1851
+ return this.transport.request(request, options, callback)
1852
+ }
1853
+
1854
+ MlApi.prototype.upgradeJobSnapshot = function mlUpgradeJobSnapshotApi (params, options, callback) {
1855
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1856
+
1857
+ // check required parameters
1858
+ if (params.job_id == null && params.jobId == null) {
1859
+ const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
1860
+ return handleError(err, callback)
1861
+ }
1862
+ if (params.snapshot_id == null && params.snapshotId == null) {
1863
+ const err = new this[kConfigurationError]('Missing required parameter: snapshot_id or snapshotId')
1864
+ return handleError(err, callback)
1865
+ }
1866
+
1867
+ // check required url components
1868
+ if ((params.snapshot_id != null || params.snapshotId != null) && ((params.job_id == null && params.jobId == null))) {
1869
+ const err = new this[kConfigurationError]('Missing required parameter of the url: job_id')
1870
+ return handleError(err, callback)
1871
+ }
1872
+
1873
+ let { method, body, jobId, job_id, snapshotId, snapshot_id, ...querystring } = params
1874
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1875
+
1876
+ let path = ''
1877
+ if (method == null) method = 'POST'
1878
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + 'model_snapshots' + '/' + encodeURIComponent(snapshot_id || snapshotId) + '/' + '_upgrade'
1879
+
1880
+ // build request object
1881
+ const request = {
1882
+ method,
1883
+ path,
1884
+ body: body || '',
1885
+ querystring
1886
+ }
1887
+
1888
+ return this.transport.request(request, options, callback)
1889
+ }
1890
+
1891
+ MlApi.prototype.validate = function mlValidateApi (params, options, callback) {
1892
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1893
+
1894
+ // check required parameters
1895
+ if (params.body == null) {
1896
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1897
+ return handleError(err, callback)
1898
+ }
1899
+
1900
+ let { method, body, ...querystring } = params
1901
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1902
+
1903
+ let path = ''
1904
+ if (method == null) method = 'POST'
1905
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_validate'
1906
+
1907
+ // build request object
1908
+ const request = {
1909
+ method,
1910
+ path,
1911
+ body: body || '',
1912
+ querystring
1913
+ }
1914
+
1915
+ return this.transport.request(request, options, callback)
1916
+ }
1917
+
1918
+ MlApi.prototype.validateDetector = function mlValidateDetectorApi (params, options, callback) {
1919
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
1920
+
1921
+ // check required parameters
1922
+ if (params.body == null) {
1923
+ const err = new this[kConfigurationError]('Missing required parameter: body')
1924
+ return handleError(err, callback)
1925
+ }
1926
+
1927
+ let { method, body, ...querystring } = params
1928
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1929
+
1930
+ let path = ''
1931
+ if (method == null) method = 'POST'
1932
+ path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + '_validate' + '/' + 'detector'
1933
+
1934
+ // build request object
1935
+ const request = {
1936
+ method,
1937
+ path,
1938
+ body: body || '',
1939
+ querystring
1940
+ }
1941
+
1942
+ return this.transport.request(request, options, callback)
1943
+ }
1944
+
1945
+ Object.defineProperties(MlApi.prototype, {
1946
+ close_job: { get () { return this.closeJob } },
1947
+ delete_calendar: { get () { return this.deleteCalendar } },
1948
+ delete_calendar_event: { get () { return this.deleteCalendarEvent } },
1949
+ delete_calendar_job: { get () { return this.deleteCalendarJob } },
1950
+ delete_data_frame_analytics: { get () { return this.deleteDataFrameAnalytics } },
1951
+ delete_datafeed: { get () { return this.deleteDatafeed } },
1952
+ delete_expired_data: { get () { return this.deleteExpiredData } },
1953
+ delete_filter: { get () { return this.deleteFilter } },
1954
+ delete_forecast: { get () { return this.deleteForecast } },
1955
+ delete_job: { get () { return this.deleteJob } },
1956
+ delete_model_snapshot: { get () { return this.deleteModelSnapshot } },
1957
+ delete_trained_model: { get () { return this.deleteTrainedModel } },
1958
+ delete_trained_model_alias: { get () { return this.deleteTrainedModelAlias } },
1959
+ estimate_model_memory: { get () { return this.estimateModelMemory } },
1960
+ evaluate_data_frame: { get () { return this.evaluateDataFrame } },
1961
+ explain_data_frame_analytics: { get () { return this.explainDataFrameAnalytics } },
1962
+ find_file_structure: { get () { return this.findFileStructure } },
1963
+ flush_job: { get () { return this.flushJob } },
1964
+ get_buckets: { get () { return this.getBuckets } },
1965
+ get_calendar_events: { get () { return this.getCalendarEvents } },
1966
+ get_calendars: { get () { return this.getCalendars } },
1967
+ get_categories: { get () { return this.getCategories } },
1968
+ get_data_frame_analytics: { get () { return this.getDataFrameAnalytics } },
1969
+ get_data_frame_analytics_stats: { get () { return this.getDataFrameAnalyticsStats } },
1970
+ get_datafeed_stats: { get () { return this.getDatafeedStats } },
1971
+ get_datafeeds: { get () { return this.getDatafeeds } },
1972
+ get_filters: { get () { return this.getFilters } },
1973
+ get_influencers: { get () { return this.getInfluencers } },
1974
+ get_job_stats: { get () { return this.getJobStats } },
1975
+ get_jobs: { get () { return this.getJobs } },
1976
+ get_model_snapshots: { get () { return this.getModelSnapshots } },
1977
+ get_overall_buckets: { get () { return this.getOverallBuckets } },
1978
+ get_records: { get () { return this.getRecords } },
1979
+ get_trained_models: { get () { return this.getTrainedModels } },
1980
+ get_trained_models_stats: { get () { return this.getTrainedModelsStats } },
1981
+ open_job: { get () { return this.openJob } },
1982
+ post_calendar_events: { get () { return this.postCalendarEvents } },
1983
+ post_data: { get () { return this.postData } },
1984
+ preview_data_frame_analytics: { get () { return this.previewDataFrameAnalytics } },
1985
+ preview_datafeed: { get () { return this.previewDatafeed } },
1986
+ put_calendar: { get () { return this.putCalendar } },
1987
+ put_calendar_job: { get () { return this.putCalendarJob } },
1988
+ put_data_frame_analytics: { get () { return this.putDataFrameAnalytics } },
1989
+ put_datafeed: { get () { return this.putDatafeed } },
1990
+ put_filter: { get () { return this.putFilter } },
1991
+ put_job: { get () { return this.putJob } },
1992
+ put_trained_model: { get () { return this.putTrainedModel } },
1993
+ put_trained_model_alias: { get () { return this.putTrainedModelAlias } },
1994
+ reset_job: { get () { return this.resetJob } },
1995
+ revert_model_snapshot: { get () { return this.revertModelSnapshot } },
1996
+ set_upgrade_mode: { get () { return this.setUpgradeMode } },
1997
+ start_data_frame_analytics: { get () { return this.startDataFrameAnalytics } },
1998
+ start_datafeed: { get () { return this.startDatafeed } },
1999
+ stop_data_frame_analytics: { get () { return this.stopDataFrameAnalytics } },
2000
+ stop_datafeed: { get () { return this.stopDatafeed } },
2001
+ update_data_frame_analytics: { get () { return this.updateDataFrameAnalytics } },
2002
+ update_datafeed: { get () { return this.updateDatafeed } },
2003
+ update_filter: { get () { return this.updateFilter } },
2004
+ update_job: { get () { return this.updateJob } },
2005
+ update_model_snapshot: { get () { return this.updateModelSnapshot } },
2006
+ upgrade_job_snapshot: { get () { return this.upgradeJobSnapshot } },
2007
+ validate_detector: { get () { return this.validateDetector } }
2008
+ })
2009
+
2010
+ module.exports = MlApi