From 0c4875aa6df6724154ae1a1af07590b919f3da49 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 10 Feb 2020 12:05:42 +0100 Subject: [PATCH] API generation --- .../autoscaling.get_autoscaling_decision.js | 71 +++++++++++++++++++ ...at.ml.datafeeds.js => cat.ml_datafeeds.js} | 2 +- api/api/{cat.ml.jobs.js => cat.ml_jobs.js} | 2 +- ...ned_models.js => cat.ml_trained_models.js} | 2 +- api/index.js | 16 +++-- api/requestParams.d.ts | 17 +++-- docs/reference.asciidoc | 49 +++++++------ index.d.ts | 16 +++-- 8 files changed, 133 insertions(+), 42 deletions(-) create mode 100644 api/api/autoscaling.get_autoscaling_decision.js rename api/api/{cat.ml.datafeeds.js => cat.ml_datafeeds.js} (98%) rename api/api/{cat.ml.jobs.js => cat.ml_jobs.js} (98%) rename api/api/{cat.ml.trained_models.js => cat.ml_trained_models.js} (98%) diff --git a/api/api/autoscaling.get_autoscaling_decision.js b/api/api/autoscaling.get_autoscaling_decision.js new file mode 100644 index 000000000..cf4530c1a --- /dev/null +++ b/api/api/autoscaling.get_autoscaling_decision.js @@ -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 diff --git a/api/api/cat.ml.datafeeds.js b/api/api/cat.ml_datafeeds.js similarity index 98% rename from api/api/cat.ml.datafeeds.js rename to api/api/cat.ml_datafeeds.js index 02a9a11fb..b727192eb 100644 --- a/api/api/cat.ml.datafeeds.js +++ b/api/api/cat.ml_datafeeds.js @@ -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) { diff --git a/api/api/cat.ml.jobs.js b/api/api/cat.ml_jobs.js similarity index 98% rename from api/api/cat.ml.jobs.js rename to api/api/cat.ml_jobs.js index c285cd2e3..fe145366e 100644 --- a/api/api/cat.ml.jobs.js +++ b/api/api/cat.ml_jobs.js @@ -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) { diff --git a/api/api/cat.ml.trained_models.js b/api/api/cat.ml_trained_models.js similarity index 98% rename from api/api/cat.ml.trained_models.js rename to api/api/cat.ml_trained_models.js index 3899be305..b3a8e09e9 100644 --- a/api/api/cat.ml.trained_models.js +++ b/api/api/cat.ml_trained_models.js @@ -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) { diff --git a/api/index.js b/api/index.js index 63d54f172..56f7cda63 100644 --- a/api/index.js +++ b/api/index.js @@ -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), diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index dade332ae..fc5a6f38a 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -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; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index a3fad2ebd..02884b95c 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -392,7 +392,7 @@ client.cat.indices({ 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 }) @@ -431,7 +431,7 @@ link:{ref}/cat-indices.html[Documentation] + |`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 +|`'d' \| 'h' \| 'm' \| 's' \| 'ms' \| 'micros' \| 'nanos'` - The unit in which to display time values |`v` |`boolean` - Verbose mode. Display column headers @@ -533,7 +533,7 @@ client.cat.nodes({ 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 }) ---- @@ -562,7 +562,7 @@ link:{ref}/cat-nodes.html[Documentation] + |`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 +|`'d' \| 'h' \| 'm' \| 's' \| 'ms' \| 'micros' \| 'nanos'` - The unit in which to display time values |`v` |`boolean` - Verbose mode. Display column headers @@ -580,7 +580,7 @@ client.cat.pendingTasks({ 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 }) ---- @@ -606,7 +606,7 @@ link:{ref}/cat-pending-tasks.html[Documentation] + |`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 +|`'d' \| 'h' \| 'm' \| 's' \| 'ms' \| 'micros' \| 'nanos'` - The unit in which to display time values |`v` |`boolean` - Verbose mode. Display column headers @@ -666,7 +666,7 @@ client.cat.recovery({ 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 }) ---- @@ -698,7 +698,7 @@ link:{ref}/cat-recovery.html[Documentation] + |`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 +|`'d' \| 'h' \| 'm' \| 's' \| 'ms' \| 'micros' \| 'nanos'` - The unit in which to display time values |`v` |`boolean` - Verbose mode. Display column headers @@ -798,7 +798,7 @@ client.cat.shards({ 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 }) ---- @@ -830,7 +830,7 @@ link:{ref}/cat-shards.html[Documentation] + |`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 +|`'d' \| 'h' \| 'm' \| 's' \| 'ms' \| 'micros' \| 'nanos'` - The unit in which to display time values |`v` |`boolean` - Verbose mode. Display column headers @@ -849,7 +849,7 @@ client.cat.snapshots({ 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 }) ---- @@ -878,7 +878,7 @@ link:{ref}/cat-snapshots.html[Documentation] + |`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 +|`'d' \| 'h' \| 'm' \| 's' \| 'ms' \| 'micros' \| 'nanos'` - The unit in which to display time values |`v` |`boolean` - Verbose mode. Display column headers @@ -898,7 +898,7 @@ client.cat.tasks({ 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 }) ---- @@ -930,7 +930,7 @@ link:{ref}/tasks.html[Documentation] + |`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 +|`'d' \| 'h' \| 'm' \| 's' \| 'ms' \| 'micros' \| 'nanos'` - The unit in which to display time values |`v` |`boolean` - Verbose mode. Display column headers @@ -5298,11 +5298,20 @@ link:{ref}/docs-update-by-query.html[Documentation] + |=== -=== cat.ml.datafeeds +=== autoscaling.getAutoscalingDecision +*Stability:* experimental +[source,ts] +---- +client.autoscaling.getAutoscalingDecision() +---- +link:{ref}/autoscaling-get-autoscaling-decision.html[Documentation] + + + +=== cat.mlDatafeeds [source,ts] ---- -client.cat.ml.datafeeds({ +client.cat.mlDatafeeds({ datafeed_id: string, allow_no_datafeeds: boolean, format: string, @@ -5342,11 +5351,11 @@ link:{ref}/ml-get-datafeed-stats.html[Documentation] + |=== -=== cat.ml.jobs +=== cat.mlJobs [source,ts] ---- -client.cat.ml.jobs({ +client.cat.mlJobs({ job_id: string, allow_no_jobs: boolean, bytes: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb', @@ -5390,11 +5399,11 @@ link:{ref}/ml-get-job-stats.html[Documentation] + |=== -=== cat.ml.trainedModels +=== cat.mlTrainedModels [source,ts] ---- -client.cat.ml.trainedModels({ +client.cat.mlTrainedModels({ model_id: string, allow_no_match: boolean, from: number, diff --git a/index.d.ts b/index.d.ts index eeb05cdcc..1de2bd3d4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -115,6 +115,10 @@ declare class Client extends EventEmitter { child(opts?: ClientOptions): Client; close(callback?: Function): Promise | void; /* GENERATED */ + autoscaling: { + get_autoscaling_decision: ApiMethod + getAutoscalingDecision: ApiMethod + } bulk: ApiMethod cat: { aliases: ApiMethod @@ -125,12 +129,12 @@ declare class Client extends EventEmitter { help: ApiMethod indices: ApiMethod master: ApiMethod - ml: { - datafeeds: ApiMethod - jobs: ApiMethod - trained_models: ApiMethod - trainedModels: ApiMethod - } + ml_datafeeds: ApiMethod + mlDatafeeds: ApiMethod + ml_jobs: ApiMethod + mlJobs: ApiMethod + ml_trained_models: ApiMethod + mlTrainedModels: ApiMethod nodeattrs: ApiMethod nodes: ApiMethod pending_tasks: ApiMethod