From 79658b1784aa9420bd52c1630aa0e80ad2a78efc Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 17 Feb 2021 09:57:15 +0100 Subject: [PATCH] API generation --- api/api/eql.js | 31 +++++++++++++++++++++++++ api/api/searchable_snapshots.js | 2 +- api/api/snapshot.js | 22 ++++++++++++++++++ api/kibana.d.ts | 2 ++ api/requestParams.d.ts | 9 ++++++++ docs/reference.asciidoc | 41 ++++++++++++++++++++++++++++++++- index.d.ts | 16 +++++++++++++ 7 files changed, 121 insertions(+), 2 deletions(-) diff --git a/api/api/eql.js b/api/api/eql.js index 3813a5aff..ee71c4b5f 100644 --- a/api/api/eql.js +++ b/api/api/eql.js @@ -85,6 +85,33 @@ EqlApi.prototype.get = function eqlGetApi (params, options, callback) { return this.transport.request(request, options, callback) } +EqlApi.prototype.getStatus = function eqlGetStatusApi (params, options, callback) { + ;[params, options, callback] = normalizeArguments(params, options, callback) + + // check required parameters + if (params['id'] == null) { + const err = new this[kConfigurationError]('Missing required parameter: id') + return handleError(err, callback) + } + + var { method, body, id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) + + var path = '' + if (method == null) method = 'GET' + path = '/' + '_eql' + '/' + 'search' + '/' + 'status' + '/' + encodeURIComponent(id) + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + return this.transport.request(request, options, callback) +} + EqlApi.prototype.search = function eqlSearchApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) @@ -116,4 +143,8 @@ EqlApi.prototype.search = function eqlSearchApi (params, options, callback) { return this.transport.request(request, options, callback) } +Object.defineProperties(EqlApi.prototype, { + get_status: { get () { return this.getStatus } } +}) + module.exports = EqlApi diff --git a/api/api/searchable_snapshots.js b/api/api/searchable_snapshots.js index 38625ee30..1b9686e8b 100644 --- a/api/api/searchable_snapshots.js +++ b/api/api/searchable_snapshots.js @@ -23,7 +23,7 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'master_timeout', 'wait_for_completion', 'storage'] +const acceptedQuerystring = ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'master_timeout', 'wait_for_completion', 'storage', 'level'] const snakeCase = { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', waitForCompletion: 'wait_for_completion' } function SearchableSnapshotsApi (transport, ConfigurationError) { diff --git a/api/api/snapshot.js b/api/api/snapshot.js index 6f2c5ce21..05d85977f 100644 --- a/api/api/snapshot.js +++ b/api/api/snapshot.js @@ -275,6 +275,27 @@ SnapshotApi.prototype.get = function snapshotGetApi (params, options, callback) return this.transport.request(request, options, callback) } +SnapshotApi.prototype.getFeatures = function snapshotGetFeaturesApi (params, options, callback) { + ;[params, options, callback] = normalizeArguments(params, options, callback) + + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) + + var path = '' + if (method == null) method = 'GET' + path = '/' + '_snapshottable_features' + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + return this.transport.request(request, options, callback) +} + SnapshotApi.prototype.getRepository = function snapshotGetRepositoryApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) @@ -404,6 +425,7 @@ Object.defineProperties(SnapshotApi.prototype, { cleanup_repository: { get () { return this.cleanupRepository } }, create_repository: { get () { return this.createRepository } }, delete_repository: { get () { return this.deleteRepository } }, + get_features: { get () { return this.getFeatures } }, get_repository: { get () { return this.getRepository } }, verify_repository: { get () { return this.verifyRepository } } }) diff --git a/api/kibana.d.ts b/api/kibana.d.ts index 90eab13d1..92067a796 100644 --- a/api/kibana.d.ts +++ b/api/kibana.d.ts @@ -170,6 +170,7 @@ interface KibanaClient { eql: { delete, TContext = Context>(params?: RequestParams.EqlDelete, options?: TransportRequestOptions): TransportRequestPromise> get, TContext = Context>(params?: RequestParams.EqlGet, options?: TransportRequestOptions): TransportRequestPromise> + getStatus, TContext = Context>(params?: RequestParams.EqlGetStatus, options?: TransportRequestOptions): TransportRequestPromise> search, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.EqlSearch, options?: TransportRequestOptions): TransportRequestPromise> } exists(params?: RequestParams.Exists, options?: TransportRequestOptions): TransportRequestPromise> @@ -430,6 +431,7 @@ interface KibanaClient { delete, TContext = Context>(params?: RequestParams.SnapshotDelete, options?: TransportRequestOptions): TransportRequestPromise> deleteRepository, TContext = Context>(params?: RequestParams.SnapshotDeleteRepository, options?: TransportRequestOptions): TransportRequestPromise> get, TContext = Context>(params?: RequestParams.SnapshotGet, options?: TransportRequestOptions): TransportRequestPromise> + getFeatures, TContext = Context>(params?: RequestParams.SnapshotGetFeatures, options?: TransportRequestOptions): TransportRequestPromise> getRepository, TContext = Context>(params?: RequestParams.SnapshotGetRepository, options?: TransportRequestOptions): TransportRequestPromise> restore, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SnapshotRestore, options?: TransportRequestOptions): TransportRequestPromise> status, TContext = Context>(params?: RequestParams.SnapshotStatus, options?: TransportRequestOptions): TransportRequestPromise> diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 7879a043d..199ff6037 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -726,6 +726,10 @@ export interface EqlGet extends Generic { keep_alive?: string; } +export interface EqlGetStatus extends Generic { + id: string; +} + export interface EqlSearch extends Generic { index: string; wait_for_completion_timeout?: string; @@ -2129,6 +2133,7 @@ export interface SearchableSnapshotsMount extends Generic { export interface SearchableSnapshotsStats extends Generic { index?: string | string[]; + level?: 'cluster' | 'indices' | 'shards'; } export interface SecurityAuthenticate extends Generic { @@ -2351,6 +2356,10 @@ export interface SnapshotGet extends Generic { verbose?: boolean; } +export interface SnapshotGetFeatures extends Generic { + master_timeout?: string; +} + export interface SnapshotGetRepository extends Generic { repository?: string | string[]; master_timeout?: string; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 62ef282aa..f18a9db67 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -2970,6 +2970,23 @@ _Default:_ `5d` |=== +[discrete] +=== eql.getStatus + +[source,ts] +---- +client.eql.getStatus({ + id: string +}) +---- +link:{ref}/eql-search-api.html[Documentation] + +[cols=2*] +|=== +|`id` +|`string` - The async search ID + +|=== + [discrete] === eql.search @@ -8777,7 +8794,8 @@ link:{ref}/searchable-snapshots-api-mount-snapshot.html[Documentation] + [source,ts] ---- client.searchableSnapshots.stats({ - index: string | string[] + index: string | string[], + level: 'cluster' | 'indices' | 'shards' }) ---- link:{ref}/searchable-snapshots-apis.html[Documentation] + @@ -8786,6 +8804,10 @@ link:{ref}/searchable-snapshots-apis.html[Documentation] + |`index` |`string \| string[]` - A comma-separated list of index names +|`level` +|`'cluster' \| 'indices' \| 'shards'` - Return stats aggregated at cluster, index or shard level + +_Default:_ `indices` + |=== [discrete] @@ -9689,6 +9711,23 @@ link:{ref}/modules-snapshots.html[Documentation] + |=== +[discrete] +=== snapshot.getFeatures + +[source,ts] +---- +client.snapshot.getFeatures({ + master_timeout: string +}) +---- +link:{ref}/modules-snapshots.html[Documentation] + +[cols=2*] +|=== +|`master_timeout` or `masterTimeout` +|`string` - Explicit operation timeout for connection to master node + +|=== + [discrete] === snapshot.getRepository diff --git a/index.d.ts b/index.d.ts index 5513625c5..2dd1492af 100644 --- a/index.d.ts +++ b/index.d.ts @@ -691,6 +691,14 @@ declare class Client { get, TContext = Context>(callback: callbackFn): TransportRequestCallback get, TContext = Context>(params: RequestParams.EqlGet, callback: callbackFn): TransportRequestCallback get, TContext = Context>(params: RequestParams.EqlGet, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + get_status, TContext = Context>(params?: RequestParams.EqlGetStatus, options?: TransportRequestOptions): TransportRequestPromise> + get_status, TContext = Context>(callback: callbackFn): TransportRequestCallback + get_status, TContext = Context>(params: RequestParams.EqlGetStatus, callback: callbackFn): TransportRequestCallback + get_status, TContext = Context>(params: RequestParams.EqlGetStatus, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + getStatus, TContext = Context>(params?: RequestParams.EqlGetStatus, options?: TransportRequestOptions): TransportRequestPromise> + getStatus, TContext = Context>(callback: callbackFn): TransportRequestCallback + getStatus, TContext = Context>(params: RequestParams.EqlGetStatus, callback: callbackFn): TransportRequestCallback + getStatus, TContext = Context>(params: RequestParams.EqlGetStatus, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback search, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.EqlSearch, options?: TransportRequestOptions): TransportRequestPromise> search, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback search, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.EqlSearch, callback: callbackFn): TransportRequestCallback @@ -2347,6 +2355,14 @@ declare class Client { get, TContext = Context>(callback: callbackFn): TransportRequestCallback get, TContext = Context>(params: RequestParams.SnapshotGet, callback: callbackFn): TransportRequestCallback get, TContext = Context>(params: RequestParams.SnapshotGet, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + get_features, TContext = Context>(params?: RequestParams.SnapshotGetFeatures, options?: TransportRequestOptions): TransportRequestPromise> + get_features, TContext = Context>(callback: callbackFn): TransportRequestCallback + get_features, TContext = Context>(params: RequestParams.SnapshotGetFeatures, callback: callbackFn): TransportRequestCallback + get_features, TContext = Context>(params: RequestParams.SnapshotGetFeatures, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + getFeatures, TContext = Context>(params?: RequestParams.SnapshotGetFeatures, options?: TransportRequestOptions): TransportRequestPromise> + getFeatures, TContext = Context>(callback: callbackFn): TransportRequestCallback + getFeatures, TContext = Context>(params: RequestParams.SnapshotGetFeatures, callback: callbackFn): TransportRequestCallback + getFeatures, TContext = Context>(params: RequestParams.SnapshotGetFeatures, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback get_repository, TContext = Context>(params?: RequestParams.SnapshotGetRepository, options?: TransportRequestOptions): TransportRequestPromise> get_repository, TContext = Context>(callback: callbackFn): TransportRequestCallback get_repository, TContext = Context>(params: RequestParams.SnapshotGetRepository, callback: callbackFn): TransportRequestCallback