API generation

This commit is contained in:
delvedor
2021-02-17 09:57:15 +01:00
parent 19acc4f9d0
commit 79658b1784
7 changed files with 121 additions and 2 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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 } }
})

2
api/kibana.d.ts vendored
View File

@ -170,6 +170,7 @@ interface KibanaClient {
eql: {
delete<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.EqlDelete, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
get<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.EqlGet, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
getStatus<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.EqlGetStatus, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.EqlSearch<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
}
exists<TResponse = boolean, TContext = Context>(params?: RequestParams.Exists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
@ -430,6 +431,7 @@ interface KibanaClient {
delete<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotDelete, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
deleteRepository<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotDeleteRepository, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
get<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotGet, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
getFeatures<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotGetFeatures, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
getRepository<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotGetRepository, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
restore<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotRestore<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
status<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotStatus, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>

View File

@ -726,6 +726,10 @@ export interface EqlGet extends Generic {
keep_alive?: string;
}
export interface EqlGetStatus extends Generic {
id: string;
}
export interface EqlSearch<T = RequestBody> extends Generic {
index: string;
wait_for_completion_timeout?: string;
@ -2129,6 +2133,7 @@ export interface SearchableSnapshotsMount<T = RequestBody> 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;

View File

@ -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

16
index.d.ts vendored
View File

@ -691,6 +691,14 @@ declare class Client {
get<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.EqlGet, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.EqlGet, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_status<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.EqlGetStatus, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
get_status<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_status<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.EqlGetStatus, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_status<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.EqlGetStatus, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
getStatus<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.EqlGetStatus, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
getStatus<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
getStatus<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.EqlGetStatus, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
getStatus<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.EqlGetStatus, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.EqlSearch<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.EqlSearch<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
@ -2347,6 +2355,14 @@ declare class Client {
get<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotGet, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotGet, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_features<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotGetFeatures, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
get_features<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_features<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotGetFeatures, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_features<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotGetFeatures, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
getFeatures<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotGetFeatures, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
getFeatures<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
getFeatures<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotGetFeatures, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
getFeatures<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotGetFeatures, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_repository<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotGetRepository, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
get_repository<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_repository<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotGetRepository, callback: callbackFn<TResponse, TContext>): TransportRequestCallback