diff --git a/api/api/logstash.js b/api/api/logstash.js new file mode 100644 index 000000000..6253992fe --- /dev/null +++ b/api/api/logstash.js @@ -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 diff --git a/api/api/searchable_snapshots.js b/api/api/searchable_snapshots.js index 38f857cac..26ea70b83 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'] +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) { diff --git a/api/index.js b/api/index.js index 8c29d1222..496d99cdb 100644 --- a/api/index.js +++ b/api/index.js @@ -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) { diff --git a/api/kibana.d.ts b/api/kibana.d.ts index 35a9b1145..0b1380985 100644 --- a/api/kibana.d.ts +++ b/api/kibana.d.ts @@ -271,6 +271,11 @@ interface KibanaClient { postStartBasic, TContext = Context>(params?: RequestParams.LicensePostStartBasic, options?: TransportRequestOptions): TransportRequestPromise> postStartTrial, TContext = Context>(params?: RequestParams.LicensePostStartTrial, options?: TransportRequestOptions): TransportRequestPromise> } + logstash: { + deletePipeline, TContext = Context>(params?: RequestParams.LogstashDeletePipeline, options?: TransportRequestOptions): TransportRequestPromise> + getPipeline, TContext = Context>(params?: RequestParams.LogstashGetPipeline, options?: TransportRequestOptions): TransportRequestPromise> + putPipeline, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.LogstashPutPipeline, options?: TransportRequestOptions): TransportRequestPromise> + } mget, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.Mget, options?: TransportRequestOptions): TransportRequestPromise> migration: { deprecations, TContext = Context>(params?: RequestParams.MigrationDeprecations, options?: TransportRequestOptions): TransportRequestPromise> diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 545d30d55..3fdf52737 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -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 extends Generic { + id: string; + body: T; +} + export interface Mget extends Generic { index?: string; type?: string; @@ -2144,6 +2157,7 @@ export interface SearchableSnapshotsMount extends Generic { snapshot: string; master_timeout?: string; wait_for_completion?: boolean; + storage?: string; body: T; } diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 2ce6ac554..dc231a9d2 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -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 diff --git a/index.d.ts b/index.d.ts index e154f6453..e9ba44434 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1286,6 +1286,32 @@ declare class Client { postStartTrial, TContext = Context>(params: RequestParams.LicensePostStartTrial, callback: callbackFn): TransportRequestCallback postStartTrial, TContext = Context>(params: RequestParams.LicensePostStartTrial, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback } + logstash: { + delete_pipeline, TContext = Context>(params?: RequestParams.LogstashDeletePipeline, options?: TransportRequestOptions): TransportRequestPromise> + delete_pipeline, TContext = Context>(callback: callbackFn): TransportRequestCallback + delete_pipeline, TContext = Context>(params: RequestParams.LogstashDeletePipeline, callback: callbackFn): TransportRequestCallback + delete_pipeline, TContext = Context>(params: RequestParams.LogstashDeletePipeline, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + deletePipeline, TContext = Context>(params?: RequestParams.LogstashDeletePipeline, options?: TransportRequestOptions): TransportRequestPromise> + deletePipeline, TContext = Context>(callback: callbackFn): TransportRequestCallback + deletePipeline, TContext = Context>(params: RequestParams.LogstashDeletePipeline, callback: callbackFn): TransportRequestCallback + deletePipeline, TContext = Context>(params: RequestParams.LogstashDeletePipeline, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + get_pipeline, TContext = Context>(params?: RequestParams.LogstashGetPipeline, options?: TransportRequestOptions): TransportRequestPromise> + get_pipeline, TContext = Context>(callback: callbackFn): TransportRequestCallback + get_pipeline, TContext = Context>(params: RequestParams.LogstashGetPipeline, callback: callbackFn): TransportRequestCallback + get_pipeline, TContext = Context>(params: RequestParams.LogstashGetPipeline, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + getPipeline, TContext = Context>(params?: RequestParams.LogstashGetPipeline, options?: TransportRequestOptions): TransportRequestPromise> + getPipeline, TContext = Context>(callback: callbackFn): TransportRequestCallback + getPipeline, TContext = Context>(params: RequestParams.LogstashGetPipeline, callback: callbackFn): TransportRequestCallback + getPipeline, TContext = Context>(params: RequestParams.LogstashGetPipeline, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + put_pipeline, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.LogstashPutPipeline, options?: TransportRequestOptions): TransportRequestPromise> + put_pipeline, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback + put_pipeline, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.LogstashPutPipeline, callback: callbackFn): TransportRequestCallback + put_pipeline, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.LogstashPutPipeline, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + putPipeline, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.LogstashPutPipeline, options?: TransportRequestOptions): TransportRequestPromise> + putPipeline, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback + putPipeline, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.LogstashPutPipeline, callback: callbackFn): TransportRequestCallback + putPipeline, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.LogstashPutPipeline, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + } mget, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.Mget, options?: TransportRequestOptions): TransportRequestPromise> mget, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback mget, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.Mget, callback: callbackFn): TransportRequestCallback