Skip to content

Commit f3b044e

Browse files
committed
API generation
1 parent b439b6c commit f3b044e

13 files changed

+348
-42
lines changed

api/api/indices.create.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ function buildIndicesCreate (opts) {
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
1313

1414
const acceptedQuerystring = [
15-
'include_type_name',
1615
'wait_for_active_shards',
1716
'timeout',
1817
'master_timeout',
@@ -24,7 +23,6 @@ function buildIndicesCreate (opts) {
2423
]
2524

2625
const snakeCase = {
27-
includeTypeName: 'include_type_name',
2826
waitForActiveShards: 'wait_for_active_shards',
2927
masterTimeout: 'master_timeout',
3028
errorTrace: 'error_trace',

api/api/indices.get.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ function buildIndicesGet (opts) {
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
1313

1414
const acceptedQuerystring = [
15-
'include_type_name',
1615
'local',
1716
'ignore_unavailable',
1817
'allow_no_indices',
@@ -28,7 +27,6 @@ function buildIndicesGet (opts) {
2827
]
2928

3029
const snakeCase = {
31-
includeTypeName: 'include_type_name',
3230
ignoreUnavailable: 'ignore_unavailable',
3331
allowNoIndices: 'allow_no_indices',
3432
expandWildcards: 'expand_wildcards',

api/api/indices.get_field_mapping.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ function buildIndicesGetFieldMapping (opts) {
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
1313

1414
const acceptedQuerystring = [
15-
'include_type_name',
1615
'include_defaults',
1716
'ignore_unavailable',
1817
'allow_no_indices',
@@ -26,7 +25,6 @@ function buildIndicesGetFieldMapping (opts) {
2625
]
2726

2827
const snakeCase = {
29-
includeTypeName: 'include_type_name',
3028
includeDefaults: 'include_defaults',
3129
ignoreUnavailable: 'ignore_unavailable',
3230
allowNoIndices: 'allow_no_indices',

api/api/indices.get_template.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ function buildIndicesGetTemplate (opts) {
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
1313

1414
const acceptedQuerystring = [
15-
'include_type_name',
1615
'flat_settings',
1716
'master_timeout',
1817
'local',
@@ -24,7 +23,6 @@ function buildIndicesGetTemplate (opts) {
2423
]
2524

2625
const snakeCase = {
27-
includeTypeName: 'include_type_name',
2826
flatSettings: 'flat_settings',
2927
masterTimeout: 'master_timeout',
3028
errorTrace: 'error_trace',

api/api/indices.put_template.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ function buildIndicesPutTemplate (opts) {
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
1313

1414
const acceptedQuerystring = [
15-
'include_type_name',
1615
'order',
1716
'create',
1817
'timeout',
@@ -26,7 +25,6 @@ function buildIndicesPutTemplate (opts) {
2625
]
2726

2827
const snakeCase = {
29-
includeTypeName: 'include_type_name',
3028
masterTimeout: 'master_timeout',
3129
flatSettings: 'flat_settings',
3230
errorTrace: 'error_trace',

api/api/indices.rollover.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ function buildIndicesRollover (opts) {
1212
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
1313

1414
const acceptedQuerystring = [
15-
'include_type_name',
1615
'timeout',
1716
'dry_run',
1817
'master_timeout',
@@ -25,7 +24,6 @@ function buildIndicesRollover (opts) {
2524
]
2625

2726
const snakeCase = {
28-
includeTypeName: 'include_type_name',
2927
dryRun: 'dry_run',
3028
masterTimeout: 'master_timeout',
3129
waitForActiveShards: 'wait_for_active_shards',

api/api/ml.delete_trained_model.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
'use strict'
6+
7+
/* eslint camelcase: 0 */
8+
/* eslint no-unused-vars: 0 */
9+
10+
function buildMlDeleteTrainedModel (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
16+
]
17+
18+
const snakeCase = {
19+
20+
}
21+
22+
/**
23+
* Perform a ml.delete_trained_model request
24+
* TODO
25+
*/
26+
return function mlDeleteTrainedModel (params, options, callback) {
27+
options = options || {}
28+
if (typeof options === 'function') {
29+
callback = options
30+
options = {}
31+
}
32+
if (typeof params === 'function' || params == null) {
33+
callback = params
34+
params = {}
35+
options = {}
36+
}
37+
38+
// check required parameters
39+
if (params['model_id'] == null && params['modelId'] == null) {
40+
const err = new ConfigurationError('Missing required parameter: model_id or modelId')
41+
return handleError(err, callback)
42+
}
43+
44+
// validate headers object
45+
if (options.headers != null && typeof options.headers !== 'object') {
46+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
47+
return handleError(err, callback)
48+
}
49+
50+
var warnings = []
51+
var { method, body, modelId, model_id, ...querystring } = params
52+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
53+
54+
var ignore = options.ignore
55+
if (typeof ignore === 'number') {
56+
options.ignore = [ignore]
57+
}
58+
59+
var path = ''
60+
61+
if (method == null) method = 'DELETE'
62+
path = '/' + '_ml' + '/' + 'inference' + '/' + encodeURIComponent(model_id || modelId)
63+
64+
// build request object
65+
const request = {
66+
method,
67+
path,
68+
body: body || '',
69+
querystring
70+
}
71+
72+
options.warnings = warnings.length === 0 ? null : warnings
73+
return makeRequest(request, options, callback)
74+
}
75+
}
76+
77+
module.exports = buildMlDeleteTrainedModel

api/api/ml.get_trained_models.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
'use strict'
6+
7+
/* eslint camelcase: 0 */
8+
/* eslint no-unused-vars: 0 */
9+
10+
function buildMlGetTrainedModels (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
'allow_no_match',
16+
'include_model_definition',
17+
'from',
18+
'size'
19+
]
20+
21+
const snakeCase = {
22+
allowNoMatch: 'allow_no_match',
23+
includeModelDefinition: 'include_model_definition'
24+
25+
}
26+
27+
/**
28+
* Perform a ml.get_trained_models request
29+
* TODO
30+
*/
31+
return function mlGetTrainedModels (params, options, callback) {
32+
options = options || {}
33+
if (typeof options === 'function') {
34+
callback = options
35+
options = {}
36+
}
37+
if (typeof params === 'function' || params == null) {
38+
callback = params
39+
params = {}
40+
options = {}
41+
}
42+
43+
// validate headers object
44+
if (options.headers != null && typeof options.headers !== 'object') {
45+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
46+
return handleError(err, callback)
47+
}
48+
49+
var warnings = []
50+
var { method, body, modelId, model_id, ...querystring } = params
51+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
52+
53+
var ignore = options.ignore
54+
if (typeof ignore === 'number') {
55+
options.ignore = [ignore]
56+
}
57+
58+
var path = ''
59+
60+
if ((model_id || modelId) != null) {
61+
if (method == null) method = 'GET'
62+
path = '/' + '_ml' + '/' + 'inference' + '/' + encodeURIComponent(model_id || modelId)
63+
} else {
64+
if (method == null) method = 'GET'
65+
path = '/' + '_ml' + '/' + 'inference'
66+
}
67+
68+
// build request object
69+
const request = {
70+
method,
71+
path,
72+
body: null,
73+
querystring
74+
}
75+
76+
options.warnings = warnings.length === 0 ? null : warnings
77+
return makeRequest(request, options, callback)
78+
}
79+
}
80+
81+
module.exports = buildMlGetTrainedModels
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
'use strict'
6+
7+
/* eslint camelcase: 0 */
8+
/* eslint no-unused-vars: 0 */
9+
10+
function buildMlGetTrainedModelsStats (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
'allow_no_match',
16+
'from',
17+
'size'
18+
]
19+
20+
const snakeCase = {
21+
allowNoMatch: 'allow_no_match'
22+
23+
}
24+
25+
/**
26+
* Perform a ml.get_trained_models_stats request
27+
* TODO
28+
*/
29+
return function mlGetTrainedModelsStats (params, options, callback) {
30+
options = options || {}
31+
if (typeof options === 'function') {
32+
callback = options
33+
options = {}
34+
}
35+
if (typeof params === 'function' || params == null) {
36+
callback = params
37+
params = {}
38+
options = {}
39+
}
40+
41+
// validate headers object
42+
if (options.headers != null && typeof options.headers !== 'object') {
43+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
44+
return handleError(err, callback)
45+
}
46+
47+
var warnings = []
48+
var { method, body, modelId, model_id, ...querystring } = params
49+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
50+
51+
var ignore = options.ignore
52+
if (typeof ignore === 'number') {
53+
options.ignore = [ignore]
54+
}
55+
56+
var path = ''
57+
58+
if ((model_id || modelId) != null) {
59+
if (method == null) method = 'GET'
60+
path = '/' + '_ml' + '/' + 'inference' + '/' + encodeURIComponent(model_id || modelId) + '/' + '_stats'
61+
} else {
62+
if (method == null) method = 'GET'
63+
path = '/' + '_ml' + '/' + 'inference' + '/' + '_stats'
64+
}
65+
66+
// build request object
67+
const request = {
68+
method,
69+
path,
70+
body: null,
71+
querystring
72+
}
73+
74+
options.warnings = warnings.length === 0 ? null : warnings
75+
return makeRequest(request, options, callback)
76+
}
77+
}
78+
79+
module.exports = buildMlGetTrainedModelsStats

api/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ function ESAPI (opts) {
292292
deleteJob: lazyLoad('ml.delete_job', opts),
293293
delete_model_snapshot: lazyLoad('ml.delete_model_snapshot', opts),
294294
deleteModelSnapshot: lazyLoad('ml.delete_model_snapshot', opts),
295+
delete_trained_model: lazyLoad('ml.delete_trained_model', opts),
296+
deleteTrainedModel: lazyLoad('ml.delete_trained_model', opts),
295297
estimate_memory_usage: lazyLoad('ml.estimate_memory_usage', opts),
296298
estimateMemoryUsage: lazyLoad('ml.estimate_memory_usage', opts),
297299
evaluate_data_frame: lazyLoad('ml.evaluate_data_frame', opts),
@@ -331,6 +333,10 @@ function ESAPI (opts) {
331333
getOverallBuckets: lazyLoad('ml.get_overall_buckets', opts),
332334
get_records: lazyLoad('ml.get_records', opts),
333335
getRecords: lazyLoad('ml.get_records', opts),
336+
get_trained_models: lazyLoad('ml.get_trained_models', opts),
337+
getTrainedModels: lazyLoad('ml.get_trained_models', opts),
338+
get_trained_models_stats: lazyLoad('ml.get_trained_models_stats', opts),
339+
getTrainedModelsStats: lazyLoad('ml.get_trained_models_stats', opts),
334340
info: lazyLoad('ml.info', opts),
335341
open_job: lazyLoad('ml.open_job', opts),
336342
openJob: lazyLoad('ml.open_job', opts),

0 commit comments

Comments
 (0)