From 953a8033ab4975ab225dbf42afdfe09ae26af69f Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 3 Apr 2020 09:49:51 +0200 Subject: [PATCH] API generation --- .../autoscaling.delete_autoscaling_policy.js | 77 +++++++++++++++++++ .../{cat.transform.js => cat.transforms.js} | 8 +- api/index.js | 4 +- api/requestParams.d.ts | 6 +- docs/reference.asciidoc | 20 ++++- index.d.ts | 16 +++- 6 files changed, 119 insertions(+), 12 deletions(-) create mode 100644 api/api/autoscaling.delete_autoscaling_policy.js rename api/api/{cat.transform.js => cat.transforms.js} (92%) diff --git a/api/api/autoscaling.delete_autoscaling_policy.js b/api/api/autoscaling.delete_autoscaling_policy.js new file mode 100644 index 000000000..e074ce8b0 --- /dev/null +++ b/api/api/autoscaling.delete_autoscaling_policy.js @@ -0,0 +1,77 @@ +// 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 buildAutoscalingDeleteAutoscalingPolicy (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + + const acceptedQuerystring = [ + + ] + + const snakeCase = { + + } + + /** + * Perform a autoscaling.delete_autoscaling_policy request + * https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-delete-autoscaling-policy.html + */ + return function autoscalingDeleteAutoscalingPolicy (params, options, callback) { + options = options || {} + if (typeof options === 'function') { + callback = options + options = {} + } + if (typeof params === 'function' || params == null) { + callback = params + params = {} + options = {} + } + + // check required parameters + if (params['name'] == null) { + const err = new ConfigurationError('Missing required parameter: name') + 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}`) + return handleError(err, callback) + } + + var warnings = [] + var { method, body, name, ...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 = 'DELETE' + path = '/' + '_autoscaling' + '/' + 'policy' + '/' + encodeURIComponent(name) + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildAutoscalingDeleteAutoscalingPolicy diff --git a/api/api/cat.transform.js b/api/api/cat.transforms.js similarity index 92% rename from api/api/cat.transform.js rename to api/api/cat.transforms.js index 35c7e93cd..446b4c953 100644 --- a/api/api/cat.transform.js +++ b/api/api/cat.transforms.js @@ -7,7 +7,7 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ -function buildCatTransform (opts) { +function buildCatTransforms (opts) { // eslint-disable-next-line no-unused-vars const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts @@ -29,11 +29,11 @@ function buildCatTransform (opts) { } /** - * Perform a cat.transform request + * Perform a cat.transforms request * Gets configuration and usage information about transforms. * https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transforms.html */ - return function catTransform (params, options, callback) { + return function catTransforms (params, options, callback) { options = options || {} if (typeof options === 'function') { callback = options @@ -83,4 +83,4 @@ function buildCatTransform (opts) { } } -module.exports = buildCatTransform +module.exports = buildCatTransforms diff --git a/api/index.js b/api/index.js index c22613513..e85766632 100644 --- a/api/index.js +++ b/api/index.js @@ -27,6 +27,8 @@ function ESAPI (opts) { submit: lazyLoad('async_search.submit', opts) }, autoscaling: { + delete_autoscaling_policy: lazyLoad('autoscaling.delete_autoscaling_policy', opts), + deleteAutoscalingPolicy: lazyLoad('autoscaling.delete_autoscaling_policy', opts), get_autoscaling_decision: lazyLoad('autoscaling.get_autoscaling_decision', opts), getAutoscalingDecision: lazyLoad('autoscaling.get_autoscaling_decision', opts), put_autoscaling_policy: lazyLoad('autoscaling.put_autoscaling_policy', opts), @@ -64,7 +66,7 @@ function ESAPI (opts) { templates: lazyLoad('cat.templates', opts), thread_pool: lazyLoad('cat.thread_pool', opts), threadPool: lazyLoad('cat.thread_pool', opts), - transform: lazyLoad('cat.transform', opts) + transforms: lazyLoad('cat.transforms', opts) }, ccr: { delete_auto_follow_pattern: lazyLoad('ccr.delete_auto_follow_pattern', opts), diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 9e68e8090..fdbdc8256 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -1430,6 +1430,10 @@ export interface AsyncSearchSubmit extends Generic { body?: T; } +export interface AutoscalingDeleteAutoscalingPolicy extends Generic { + name: string; +} + export interface AutoscalingGetAutoscalingDecision extends Generic { } @@ -1487,7 +1491,7 @@ export interface CatMlTrainedModels extends Generic { v?: boolean; } -export interface CatTransform extends Generic { +export interface CatTransforms extends Generic { transform_id?: string; from?: number; size?: number; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 2cc6a41aa..90391454d 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -5754,6 +5754,22 @@ _Default:_ `5` |=== +=== autoscaling.deleteAutoscalingPolicy +*Stability:* experimental +[source,ts] +---- +client.autoscaling.deleteAutoscalingPolicy({ + name: string +}) +---- +link:{ref}/autoscaling-delete-autoscaling-policy.html[Documentation] + +[cols=2*] +|=== +|`name` +|`string` - the name of the autoscaling policy + +|=== + === autoscaling.getAutoscalingDecision *Stability:* experimental [source,ts] @@ -5981,11 +5997,11 @@ _Default:_ `100` |=== -=== cat.transform +=== cat.transforms [source,ts] ---- -client.cat.transform({ +client.cat.transforms({ transform_id: string, from: number, size: number, diff --git a/index.d.ts b/index.d.ts index 4650e1bc7..ab15c04a1 100644 --- a/index.d.ts +++ b/index.d.ts @@ -141,6 +141,14 @@ declare class Client extends EventEmitter { submit(params: RequestParams.AsyncSearchSubmit, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback } autoscaling: { + delete_autoscaling_policy(params?: RequestParams.AutoscalingDeleteAutoscalingPolicy, options?: TransportRequestOptions): Promise> + delete_autoscaling_policy(callback: callbackFn): TransportRequestCallback + delete_autoscaling_policy(params: RequestParams.AutoscalingDeleteAutoscalingPolicy, callback: callbackFn): TransportRequestCallback + delete_autoscaling_policy(params: RequestParams.AutoscalingDeleteAutoscalingPolicy, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + deleteAutoscalingPolicy(params?: RequestParams.AutoscalingDeleteAutoscalingPolicy, options?: TransportRequestOptions): Promise> + deleteAutoscalingPolicy(callback: callbackFn): TransportRequestCallback + deleteAutoscalingPolicy(params: RequestParams.AutoscalingDeleteAutoscalingPolicy, callback: callbackFn): TransportRequestCallback + deleteAutoscalingPolicy(params: RequestParams.AutoscalingDeleteAutoscalingPolicy, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback get_autoscaling_decision(params?: RequestParams.AutoscalingGetAutoscalingDecision, options?: TransportRequestOptions): Promise> get_autoscaling_decision(callback: callbackFn): TransportRequestCallback get_autoscaling_decision(params: RequestParams.AutoscalingGetAutoscalingDecision, callback: callbackFn): TransportRequestCallback @@ -283,10 +291,10 @@ declare class Client extends EventEmitter { threadPool(callback: callbackFn): TransportRequestCallback threadPool(params: RequestParams.CatThreadPool, callback: callbackFn): TransportRequestCallback threadPool(params: RequestParams.CatThreadPool, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback - transform(params?: RequestParams.CatTransform, options?: TransportRequestOptions): Promise> - transform(callback: callbackFn): TransportRequestCallback - transform(params: RequestParams.CatTransform, callback: callbackFn): TransportRequestCallback - transform(params: RequestParams.CatTransform, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + transforms(params?: RequestParams.CatTransforms, options?: TransportRequestOptions): Promise> + transforms(callback: callbackFn): TransportRequestCallback + transforms(params: RequestParams.CatTransforms, callback: callbackFn): TransportRequestCallback + transforms(params: RequestParams.CatTransforms, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback } ccr: { delete_auto_follow_pattern(params?: RequestParams.CcrDeleteAutoFollowPattern, options?: TransportRequestOptions): Promise>