API generation

This commit is contained in:
delvedor
2020-02-19 11:55:45 +01:00
parent b2c85f7797
commit d621d31d39
5 changed files with 148 additions and 0 deletions

View 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 buildCatMlDataFrameAnalytics (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'allow_no_match',
'bytes',
'format',
'h',
'help',
's',
'time',
'v'
]
const snakeCase = {
allowNoMatch: 'allow_no_match'
}
/**
* Perform a cat.ml_data_frame_analytics request
* http://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html
*/
return function catMlDataFrameAnalytics (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, id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if ((id) != null) {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id)
} else {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'ml' + '/' + 'data_frame' + '/' + 'analytics'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildCatMlDataFrameAnalytics

View File

@ -30,6 +30,8 @@ function ESAPI (opts) {
help: lazyLoad('cat.help', opts),
indices: lazyLoad('cat.indices', opts),
master: lazyLoad('cat.master', opts),
ml_data_frame_analytics: lazyLoad('cat.ml_data_frame_analytics', opts),
mlDataFrameAnalytics: lazyLoad('cat.ml_data_frame_analytics', opts),
ml_datafeeds: lazyLoad('cat.ml_datafeeds', opts),
mlDatafeeds: lazyLoad('cat.ml_datafeeds', opts),
ml_jobs: lazyLoad('cat.ml_jobs', opts),

View File

@ -1318,6 +1318,18 @@ export interface UpdateByQueryRethrottle extends Generic {
export interface AutoscalingGetAutoscalingDecision extends Generic {
}
export interface CatMlDataFrameAnalytics extends Generic {
id?: string;
allow_no_match?: 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 CatMlDatafeeds extends Generic {
datafeed_id?: string;
allow_no_datafeeds?: boolean;

View File

@ -5307,6 +5307,54 @@ client.autoscaling.getAutoscalingDecision()
link:{ref}/autoscaling-get-autoscaling-decision.html[Documentation] +
=== cat.mlDataFrameAnalytics
[source,ts]
----
client.cat.mlDataFrameAnalytics({
id: string,
allow_no_match: 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
})
----
link:{ref}/get-dfanalytics-stats.html[Documentation] +
[cols=2*]
|===
|`id`
|`string` - The ID of the data frame analytics to fetch
|`allow_no_match` or `allowNoMatch`
|`boolean` - Whether to ignore if a wildcard expression matches no configs. (This includes `_all` string or when no configs have been specified)
|`bytes`
|`'b' \| 'k' \| 'kb' \| 'm' \| 'mb' \| 'g' \| 'gb' \| 't' \| 'tb' \| 'p' \| 'pb'` - The unit in which to display byte values
|`format`
|`string` - a short version of the Accept header, e.g. json, yaml
|`h`
|`string \| string[]` - Comma-separated list of column names to display
|`help`
|`boolean` - Return help information
|`s`
|`string \| string[]` - Comma-separated list of column names or column aliases to sort by
|`time`
|`'d (Days)' \| 'h (Hours)' \| 'm (Minutes)' \| 's (Seconds)' \| 'ms (Milliseconds)' \| 'micros (Microseconds)' \| 'nanos (Nanoseconds)'` - The unit in which to display time values
|`v`
|`boolean` - Verbose mode. Display column headers
|===
=== cat.mlDatafeeds
[source,ts]

2
index.d.ts vendored
View File

@ -129,6 +129,8 @@ declare class Client extends EventEmitter {
help: ApiMethod<RequestParams.CatHelp>
indices: ApiMethod<RequestParams.CatIndices>
master: ApiMethod<RequestParams.CatMaster>
ml_data_frame_analytics: ApiMethod<RequestParams.CatMlDataFrameAnalytics>
mlDataFrameAnalytics: ApiMethod<RequestParams.CatMlDataFrameAnalytics>
ml_datafeeds: ApiMethod<RequestParams.CatMlDatafeeds>
mlDatafeeds: ApiMethod<RequestParams.CatMlDatafeeds>
ml_jobs: ApiMethod<RequestParams.CatMlJobs>