API generation
This commit is contained in:
84
api/api/cat.ml.jobs.js
Normal file
84
api/api/cat.ml.jobs.js
Normal file
@ -0,0 +1,84 @@
|
||||
// Licensed to Elasticsearch B.V under one or more agreements.
|
||||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
// See the LICENSE file in the project root for more information
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildCatMlJobs (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'allow_no_jobs',
|
||||
'bytes',
|
||||
'format',
|
||||
'h',
|
||||
'help',
|
||||
's',
|
||||
'time',
|
||||
'v'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
allowNoJobs: 'allow_no_jobs'
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a cat.ml.jobs request
|
||||
* http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html
|
||||
*/
|
||||
return function catMlJobs (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, jobId, job_id, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((job_id || jobId) != null) {
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId)
|
||||
} else {
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'anomaly_detectors'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildCatMlJobs
|
||||
@ -7,35 +7,23 @@
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
function buildIndicesFlushSynced (opts) {
|
||||
function buildEqlSearch (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'ignore_unavailable',
|
||||
'allow_no_indices',
|
||||
'expand_wildcards',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
ignoreUnavailable: 'ignore_unavailable',
|
||||
allowNoIndices: 'allow_no_indices',
|
||||
expandWildcards: 'expand_wildcards',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a indices.flush_synced request
|
||||
* Performs a synced flush operation on one or more indices.
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush-api.html
|
||||
* Perform a eql.search request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search.html
|
||||
*/
|
||||
return function indicesFlushSynced (params, options, callback) {
|
||||
return function eqlSearch (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
@ -47,6 +35,16 @@ function buildIndicesFlushSynced (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
@ -64,13 +62,8 @@ function buildIndicesFlushSynced (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
if (method == null) method = body == null ? 'GET' : 'POST'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_flush' + '/' + 'synced'
|
||||
} else {
|
||||
if (method == null) method = body == null ? 'GET' : 'POST'
|
||||
path = '/' + '_flush' + '/' + 'synced'
|
||||
}
|
||||
if (method == null) method = body == null ? 'GET' : 'POST'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_eql' + '/' + 'search'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
@ -85,4 +78,4 @@ function buildIndicesFlushSynced (opts) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIndicesFlushSynced
|
||||
module.exports = buildEqlSearch
|
||||
@ -32,7 +32,7 @@ function buildIndicesGetUpgrade (opts) {
|
||||
|
||||
/**
|
||||
* Perform a indices.get_upgrade request
|
||||
* The _upgrade API is no longer useful and will be removed.
|
||||
* DEPRECATED Returns a progress status of current upgrade.
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html
|
||||
*/
|
||||
return function indicesGetUpgrade (params, options, callback) {
|
||||
@ -64,13 +64,8 @@ function buildIndicesGetUpgrade (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
|
||||
} else {
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_upgrade'
|
||||
}
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
|
||||
@ -36,7 +36,7 @@ function buildIndicesUpgrade (opts) {
|
||||
|
||||
/**
|
||||
* Perform a indices.upgrade request
|
||||
* The _upgrade API is no longer useful and will be removed.
|
||||
* DEPRECATED Upgrades to the current version of Lucene.
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html
|
||||
*/
|
||||
return function indicesUpgrade (params, options, callback) {
|
||||
@ -68,13 +68,8 @@ function buildIndicesUpgrade (opts) {
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((index) != null) {
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
|
||||
} else {
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_upgrade'
|
||||
}
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_upgrade'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
|
||||
@ -16,7 +16,8 @@ function buildMlGetTrainedModels (opts) {
|
||||
'include_model_definition',
|
||||
'decompress_definition',
|
||||
'from',
|
||||
'size'
|
||||
'size',
|
||||
'tags'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
@ -21,7 +21,7 @@ function buildSlmDeleteLifecycle (opts) {
|
||||
|
||||
/**
|
||||
* Perform a slm.delete_lifecycle request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete.html
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete-policy.html
|
||||
*/
|
||||
return function slmDeleteLifecycle (params, options, callback) {
|
||||
options = options || {}
|
||||
|
||||
@ -21,7 +21,7 @@ function buildSlmExecuteLifecycle (opts) {
|
||||
|
||||
/**
|
||||
* Perform a slm.execute_lifecycle request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute.html
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute-policy.html
|
||||
*/
|
||||
return function slmExecuteLifecycle (params, options, callback) {
|
||||
options = options || {}
|
||||
|
||||
@ -21,7 +21,7 @@ function buildSlmGetLifecycle (opts) {
|
||||
|
||||
/**
|
||||
* Perform a slm.get_lifecycle request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get-policy.html
|
||||
*/
|
||||
return function slmGetLifecycle (params, options, callback) {
|
||||
options = options || {}
|
||||
|
||||
@ -21,7 +21,7 @@ function buildSlmGetStats (opts) {
|
||||
|
||||
/**
|
||||
* Perform a slm.get_stats request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-get-stats.html
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-stats.html
|
||||
*/
|
||||
return function slmGetStats (params, options, callback) {
|
||||
options = options || {}
|
||||
|
||||
@ -21,7 +21,7 @@ function buildSlmPutLifecycle (opts) {
|
||||
|
||||
/**
|
||||
* Perform a slm.put_lifecycle request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put.html
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put-policy.html
|
||||
*/
|
||||
return function slmPutLifecycle (params, options, callback) {
|
||||
options = options || {}
|
||||
|
||||
@ -26,6 +26,9 @@ function ESAPI (opts) {
|
||||
help: lazyLoad('cat.help', opts),
|
||||
indices: lazyLoad('cat.indices', opts),
|
||||
master: lazyLoad('cat.master', opts),
|
||||
ml: {
|
||||
jobs: lazyLoad('cat.ml.jobs', opts)
|
||||
},
|
||||
nodeattrs: lazyLoad('cat.nodeattrs', opts),
|
||||
nodes: lazyLoad('cat.nodes', opts),
|
||||
pending_tasks: lazyLoad('cat.pending_tasks', opts),
|
||||
@ -140,6 +143,9 @@ function ESAPI (opts) {
|
||||
putPolicy: lazyLoad('enrich.put_policy', opts),
|
||||
stats: lazyLoad('enrich.stats', opts)
|
||||
},
|
||||
eql: {
|
||||
search: lazyLoad('eql.search', opts)
|
||||
},
|
||||
exists: lazyLoad('exists', opts),
|
||||
exists_source: lazyLoad('exists_source', opts),
|
||||
existsSource: lazyLoad('exists_source', opts),
|
||||
@ -198,8 +204,6 @@ function ESAPI (opts) {
|
||||
exists_type: lazyLoad('indices.exists_type', opts),
|
||||
existsType: lazyLoad('indices.exists_type', opts),
|
||||
flush: lazyLoad('indices.flush', opts),
|
||||
flush_synced: lazyLoad('indices.flush_synced', opts),
|
||||
flushSynced: lazyLoad('indices.flush_synced', opts),
|
||||
forcemerge: lazyLoad('indices.forcemerge', opts),
|
||||
freeze: lazyLoad('indices.freeze', opts),
|
||||
get: lazyLoad('indices.get', opts),
|
||||
|
||||
25
api/requestParams.d.ts
vendored
25
api/requestParams.d.ts
vendored
@ -653,13 +653,6 @@ export interface IndicesFlush extends Generic {
|
||||
expand_wildcards?: 'open' | 'closed' | 'none' | 'all';
|
||||
}
|
||||
|
||||
export interface IndicesFlushSynced extends Generic {
|
||||
index?: string | string[];
|
||||
ignore_unavailable?: boolean;
|
||||
allow_no_indices?: boolean;
|
||||
expand_wildcards?: 'open' | 'closed' | 'none' | 'all';
|
||||
}
|
||||
|
||||
export interface IndicesForcemerge extends Generic {
|
||||
index?: string | string[];
|
||||
flush?: boolean;
|
||||
@ -1322,6 +1315,18 @@ export interface UpdateByQueryRethrottle extends Generic {
|
||||
requests_per_second: number;
|
||||
}
|
||||
|
||||
export interface CatMlJobs extends Generic {
|
||||
job_id?: string;
|
||||
allow_no_jobs?: boolean;
|
||||
bytes?: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb';
|
||||
format?: string;
|
||||
h?: string | string[];
|
||||
help?: boolean;
|
||||
s?: string | string[];
|
||||
time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)';
|
||||
v?: boolean;
|
||||
}
|
||||
|
||||
export interface CcrDeleteAutoFollowPattern extends Generic {
|
||||
name: string;
|
||||
}
|
||||
@ -1446,6 +1451,11 @@ export interface EnrichPutPolicy<T = any> extends Generic {
|
||||
export interface EnrichStats extends Generic {
|
||||
}
|
||||
|
||||
export interface EqlSearch<T = any> extends Generic {
|
||||
index: string;
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface GraphExplore<T = any> extends Generic {
|
||||
index: string | string[];
|
||||
routing?: string;
|
||||
@ -1793,6 +1803,7 @@ export interface MlGetTrainedModels extends Generic {
|
||||
decompress_definition?: boolean;
|
||||
from?: number;
|
||||
size?: number;
|
||||
tags?: string | string[];
|
||||
}
|
||||
|
||||
export interface MlGetTrainedModelsStats extends Generic {
|
||||
|
||||
Reference in New Issue
Block a user