API generation

This commit is contained in:
delvedor
2020-02-10 12:05:42 +01:00
parent 6e7385a478
commit 0c4875aa6d
8 changed files with 133 additions and 42 deletions

View File

@ -0,0 +1,71 @@
// 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 buildAutoscalingGetAutoscalingDecision (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
]
const snakeCase = {
}
/**
* Perform a autoscaling.get_autoscaling_decision request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-decision.html
*/
return function autoscalingGetAutoscalingDecision (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, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if (method == null) method = 'GET'
path = '/' + '_autoscaling' + '/' + 'decision'
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildAutoscalingGetAutoscalingDecision

View File

@ -27,7 +27,7 @@ function buildCatMlDatafeeds (opts) {
}
/**
* Perform a cat.ml.datafeeds request
* Perform a cat.ml_datafeeds request
* http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html
*/
return function catMlDatafeeds (params, options, callback) {

View File

@ -28,7 +28,7 @@ function buildCatMlJobs (opts) {
}
/**
* Perform a cat.ml.jobs request
* 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) {

View File

@ -30,7 +30,7 @@ function buildCatMlTrainedModels (opts) {
}
/**
* Perform a cat.ml.trained_models request
* Perform a cat.ml_trained_models request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/get-inference-stats.html
*/
return function catMlTrainedModels (params, options, callback) {

View File

@ -16,6 +16,10 @@ function ESAPI (opts) {
opts.snakeCaseKeys = snakeCaseKeys
const apis = {
autoscaling: {
get_autoscaling_decision: lazyLoad('autoscaling.get_autoscaling_decision', opts),
getAutoscalingDecision: lazyLoad('autoscaling.get_autoscaling_decision', opts)
},
bulk: lazyLoad('bulk', opts),
cat: {
aliases: lazyLoad('cat.aliases', opts),
@ -26,12 +30,12 @@ function ESAPI (opts) {
help: lazyLoad('cat.help', opts),
indices: lazyLoad('cat.indices', opts),
master: lazyLoad('cat.master', opts),
ml: {
datafeeds: lazyLoad('cat.ml.datafeeds', opts),
jobs: lazyLoad('cat.ml.jobs', opts),
trained_models: lazyLoad('cat.ml.trained_models', opts),
trainedModels: lazyLoad('cat.ml.trained_models', opts)
},
ml_datafeeds: lazyLoad('cat.ml_datafeeds', opts),
mlDatafeeds: lazyLoad('cat.ml_datafeeds', opts),
ml_jobs: lazyLoad('cat.ml_jobs', opts),
mlJobs: lazyLoad('cat.ml_jobs', opts),
ml_trained_models: lazyLoad('cat.ml_trained_models', opts),
mlTrainedModels: lazyLoad('cat.ml_trained_models', opts),
nodeattrs: lazyLoad('cat.nodeattrs', opts),
nodes: lazyLoad('cat.nodes', opts),
pending_tasks: lazyLoad('cat.pending_tasks', opts),

View File

@ -95,7 +95,7 @@ export interface CatIndices extends Generic {
help?: boolean;
pri?: boolean;
s?: string | string[];
time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)';
time?: 'd' | 'h' | 'm' | 's' | 'ms' | 'micros' | 'nanos';
v?: boolean;
include_unloaded_segments?: boolean;
}
@ -128,7 +128,7 @@ export interface CatNodes extends Generic {
h?: string | string[];
help?: boolean;
s?: string | string[];
time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)';
time?: 'd' | 'h' | 'm' | 's' | 'ms' | 'micros' | 'nanos';
v?: boolean;
}
@ -139,7 +139,7 @@ export interface CatPendingTasks extends Generic {
h?: string | string[];
help?: boolean;
s?: string | string[];
time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)';
time?: 'd' | 'h' | 'm' | 's' | 'ms' | 'micros' | 'nanos';
v?: boolean;
}
@ -162,7 +162,7 @@ export interface CatRecovery extends Generic {
h?: string | string[];
help?: boolean;
s?: string | string[];
time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)';
time?: 'd' | 'h' | 'm' | 's' | 'ms' | 'micros' | 'nanos';
v?: boolean;
}
@ -195,7 +195,7 @@ export interface CatShards extends Generic {
h?: string | string[];
help?: boolean;
s?: string | string[];
time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)';
time?: 'd' | 'h' | 'm' | 's' | 'ms' | 'micros' | 'nanos';
v?: boolean;
}
@ -207,7 +207,7 @@ export interface CatSnapshots extends Generic {
h?: string | string[];
help?: boolean;
s?: string | string[];
time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)';
time?: 'd' | 'h' | 'm' | 's' | 'ms' | 'micros' | 'nanos';
v?: boolean;
}
@ -220,7 +220,7 @@ export interface CatTasks extends Generic {
h?: string | string[];
help?: boolean;
s?: string | string[];
time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)';
time?: 'd' | 'h' | 'm' | 's' | 'ms' | 'micros' | 'nanos';
v?: boolean;
}
@ -1315,6 +1315,9 @@ export interface UpdateByQueryRethrottle extends Generic {
requests_per_second: number;
}
export interface AutoscalingGetAutoscalingDecision extends Generic {
}
export interface CatMlDatafeeds extends Generic {
datafeed_id?: string;
allow_no_datafeeds?: boolean;