API generation

This commit is contained in:
delvedor
2021-02-09 09:57:02 +01:00
parent 20b7e93475
commit f4f7c733d1
7 changed files with 241 additions and 1 deletions

125
api/api/logstash.js Normal file
View File

@ -0,0 +1,125 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
function LogstashApi (transport, ConfigurationError) {
this.transport = transport
this[kConfigurationError] = ConfigurationError
}
LogstashApi.prototype.deletePipeline = function logstashDeletePipelineApi (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 = 'DELETE'
path = '/' + '_logstash' + '/' + 'pipeline' + '/' + encodeURIComponent(id)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
return this.transport.request(request, options, callback)
}
LogstashApi.prototype.getPipeline = function logstashGetPipelineApi (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 = '/' + '_logstash' + '/' + 'pipeline' + '/' + encodeURIComponent(id)
// build request object
const request = {
method,
path,
body: null,
querystring
}
return this.transport.request(request, options, callback)
}
LogstashApi.prototype.putPipeline = function logstashPutPipelineApi (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)
}
if (params['body'] == null) {
const err = new this[kConfigurationError]('Missing required parameter: body')
return handleError(err, callback)
}
var { method, body, id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
var path = ''
if (method == null) method = 'PUT'
path = '/' + '_logstash' + '/' + 'pipeline' + '/' + encodeURIComponent(id)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
return this.transport.request(request, options, callback)
}
Object.defineProperties(LogstashApi.prototype, {
delete_pipeline: { get () { return this.deletePipeline } },
get_pipeline: { get () { return this.getPipeline } },
put_pipeline: { get () { return this.putPipeline } }
})
module.exports = LogstashApi

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']
const acceptedQuerystring = ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'master_timeout', 'wait_for_completion', 'storage']
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

@ -74,6 +74,7 @@ const EqlApi = require('./api/eql')
const GraphApi = require('./api/graph')
const IlmApi = require('./api/ilm')
const LicenseApi = require('./api/license')
const LogstashApi = require('./api/logstash')
const MigrationApi = require('./api/migration')
const MlApi = require('./api/ml')
const MonitoringApi = require('./api/monitoring')
@ -106,6 +107,7 @@ const kEql = Symbol('Eql')
const kGraph = Symbol('Graph')
const kIlm = Symbol('Ilm')
const kLicense = Symbol('License')
const kLogstash = Symbol('Logstash')
const kMigration = Symbol('Migration')
const kMl = Symbol('Ml')
const kMonitoring = Symbol('Monitoring')
@ -138,6 +140,7 @@ function ESAPI (opts) {
this[kGraph] = null
this[kIlm] = null
this[kLicense] = null
this[kLogstash] = null
this[kMigration] = null
this[kMl] = null
this[kMonitoring] = null
@ -346,6 +349,14 @@ Object.defineProperties(ESAPI.prototype, {
return this[kLicense]
}
},
logstash: {
get () {
if (this[kLogstash] === null) {
this[kLogstash] = new LogstashApi(this.transport, this[kConfigurationError])
}
return this[kLogstash]
}
},
migration: {
get () {
if (this[kMigration] === null) {

5
api/kibana.d.ts vendored
View File

@ -271,6 +271,11 @@ interface KibanaClient {
postStartBasic<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.LicensePostStartBasic, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
postStartTrial<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.LicensePostStartTrial, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
}
logstash: {
deletePipeline<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.LogstashDeletePipeline, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
getPipeline<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.LogstashGetPipeline, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
putPipeline<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.LogstashPutPipeline<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
}
mget<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.Mget<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
migration: {
deprecations<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.MigrationDeprecations, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>

View File

@ -1431,6 +1431,19 @@ export interface LicensePostStartTrial extends Generic {
acknowledge?: boolean;
}
export interface LogstashDeletePipeline extends Generic {
id: string;
}
export interface LogstashGetPipeline extends Generic {
id: string;
}
export interface LogstashPutPipeline<T = RequestBody> extends Generic {
id: string;
body: T;
}
export interface Mget<T = RequestBody> extends Generic {
index?: string;
type?: string;
@ -2144,6 +2157,7 @@ export interface SearchableSnapshotsMount<T = RequestBody> extends Generic {
snapshot: string;
master_timeout?: string;
wait_for_completion?: boolean;
storage?: string;
body: T;
}

View File

@ -5945,6 +5945,61 @@ link:{ref}/start-trial.html[Documentation] +
|===
[discrete]
=== logstash.deletePipeline
[source,ts]
----
client.logstash.deletePipeline({
id: string
})
----
link:{ref}/logstash-api-delete-pipeline.html[Documentation] +
[cols=2*]
|===
|`id`
|`string` - The ID of the Pipeline
|===
[discrete]
=== logstash.getPipeline
[source,ts]
----
client.logstash.getPipeline({
id: string
})
----
link:{ref}/logstash-api-get-pipeline.html[Documentation] +
[cols=2*]
|===
|`id`
|`string` - A comma-separated list of Pipeline IDs
|===
[discrete]
=== logstash.putPipeline
[source,ts]
----
client.logstash.putPipeline({
id: string,
body: object
})
----
link:{ref}/logstash-api-put-pipeline.html[Documentation] +
[cols=2*]
|===
|`id`
|`string` - The ID of the Pipeline
|`body`
|`object` - The Pipeline to add or update
|===
[discrete]
=== mget
@ -8937,6 +8992,7 @@ client.searchableSnapshots.mount({
snapshot: string,
master_timeout: string,
wait_for_completion: boolean,
storage: string,
body: object
})
----
@ -8955,6 +9011,9 @@ link:{ref}/searchable-snapshots-api-mount-snapshot.html[Documentation] +
|`wait_for_completion` or `waitForCompletion`
|`boolean` - Should this request wait until the operation has completed before returning
|`storage`
|`string` - Selects the kind of local storage used to accelerate searches. Experimental, and defaults to `full_copy`
|`body`
|`object` - The restore configuration for mounting the snapshot as searchable

26
index.d.ts vendored
View File

@ -1286,6 +1286,32 @@ declare class Client {
postStartTrial<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LicensePostStartTrial, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
postStartTrial<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LicensePostStartTrial, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
}
logstash: {
delete_pipeline<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.LogstashDeletePipeline, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
delete_pipeline<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
delete_pipeline<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LogstashDeletePipeline, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
delete_pipeline<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LogstashDeletePipeline, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
deletePipeline<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.LogstashDeletePipeline, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
deletePipeline<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
deletePipeline<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LogstashDeletePipeline, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
deletePipeline<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LogstashDeletePipeline, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_pipeline<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.LogstashGetPipeline, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
get_pipeline<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_pipeline<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LogstashGetPipeline, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
get_pipeline<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LogstashGetPipeline, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
getPipeline<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.LogstashGetPipeline, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
getPipeline<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
getPipeline<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LogstashGetPipeline, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
getPipeline<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.LogstashGetPipeline, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
put_pipeline<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.LogstashPutPipeline<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
put_pipeline<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
put_pipeline<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.LogstashPutPipeline<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
put_pipeline<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.LogstashPutPipeline<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
putPipeline<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.LogstashPutPipeline<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
putPipeline<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
putPipeline<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.LogstashPutPipeline<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
putPipeline<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.LogstashPutPipeline<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
}
mget<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.Mget<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
mget<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
mget<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.Mget<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback