Improve observability (#834)

* API generation

* Added correlation id support

* Updated docs

* Updated test

* Updated code generation

* API generation

* Updated code generation

* Added support for client name and custom context object

* Updated docs

* Updated test

* Fix docs

* Updated docs

* Added id support also for sniffing

* Updated test

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Apply suggestions

* Update docs/configuration.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/configuration.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Update docs/observability.asciidoc

Co-Authored-By: delvedor <delvedor@users.noreply.github.com>

* Apply suggestions

* Updated README.md

* Fixed test

* Addressed suggestions
This commit is contained in:
Tomas Della Vedova
2019-05-03 17:23:40 +02:00
committed by delvedor
parent 9dacd9d9ee
commit b1458e3511
279 changed files with 2436 additions and 142 deletions

View File

@ -119,6 +119,10 @@ The client is designed to be easily configured as you see fit for your needs, fo
nodeFilter: nodeFilterFn;
// custom selection strategy, defaults `round-robin`
nodeSelector: nodeSelectorFn | string;
// function to generate the request id for every request
generateRequestId: generateRequestIdFn;
// name to identify the client instance in the events
name: string;
}
```
@ -143,7 +147,9 @@ The supported *request specific options* are:
asStream: boolean, // default `false`
compression: string, // default `false`
headers: object, // default `null`
querystring: object // default `null`
querystring: object // default `null`,
context: object // default `null`,
id: any // default incr. integer
}
```

View File

@ -136,6 +136,8 @@ function buildBulk (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -120,6 +120,8 @@ function buildCatAliases (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -122,6 +122,8 @@ function buildCatAllocation (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -120,6 +120,8 @@ function buildCatCount (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -124,6 +124,8 @@ function buildCatFielddata (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -117,6 +117,8 @@ function buildCatHealth (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -104,6 +104,8 @@ function buildCatHelp (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -126,6 +126,8 @@ function buildCatIndices (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -115,6 +115,8 @@ function buildCatMaster (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -115,6 +115,8 @@ function buildCatNodeattrs (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -118,6 +118,8 @@ function buildCatNodes (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -115,6 +115,8 @@ function buildCatPendingTasks (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -115,6 +115,8 @@ function buildCatPlugins (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -120,6 +120,8 @@ function buildCatRecovery (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -115,6 +115,8 @@ function buildCatRepositories (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -117,6 +117,8 @@ function buildCatSegments (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -122,6 +122,8 @@ function buildCatShards (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -121,6 +121,8 @@ function buildCatSnapshots (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -120,6 +120,8 @@ function buildCatTasks (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -120,6 +120,8 @@ function buildCatTemplates (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -122,6 +122,8 @@ function buildCatThreadPool (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -96,6 +96,8 @@ function buildCcrDeleteAutoFollowPattern (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -102,6 +102,8 @@ function buildCcrFollow (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -90,6 +90,8 @@ function buildCcrFollowInfo (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -96,6 +96,8 @@ function buildCcrFollowStats (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -101,6 +101,8 @@ function buildCcrForgetFollower (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -94,6 +94,8 @@ function buildCcrGetAutoFollowPattern (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -96,6 +96,8 @@ function buildCcrPauseFollow (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -101,6 +101,8 @@ function buildCcrPutAutoFollowPattern (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -97,6 +97,8 @@ function buildCcrResumeFollow (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -89,6 +89,8 @@ function buildCcrStats (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -96,6 +96,8 @@ function buildCcrUnfollow (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -100,6 +100,8 @@ function buildClearScroll (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -101,6 +101,8 @@ function buildClusterAllocationExplain (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -111,6 +111,8 @@ function buildClusterGetSettings (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -132,6 +132,8 @@ function buildClusterHealth (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -105,6 +105,8 @@ function buildClusterPendingTasks (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -109,6 +109,8 @@ function buildClusterPutSettings (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -100,6 +100,8 @@ function buildClusterRemoteInfo (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -110,6 +110,8 @@ function buildClusterReroute (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -137,6 +137,8 @@ function buildClusterState (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -110,6 +110,8 @@ function buildClusterStats (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -145,6 +145,8 @@ function buildCount (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -134,6 +134,8 @@ function buildCreate (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -0,0 +1,128 @@
/*
* 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 */
function buildDataFrameDeleteDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [data_frame.delete_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-data-frame-transform.html) request
*
* @param {string} transform_id - The id of the transform to delete
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function dataFrameDeleteDataFrameTransform (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['transform_id'] == null && params['transformId'] == null) {
const err = new ConfigurationError('Missing required parameter: transform_id or transformId')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
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 = null
var { method, body, transformId, transform_id } = params
var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id'])
if (method == null) {
method = 'DELETE'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId)
// build request object
const request = {
method,
path,
body: '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}
return makeRequest(request, requestOptions, callback)
function semicopy (obj, exclude) {
var target = {}
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
if (exclude.indexOf(key) === -1) {
target[snakeCase[key] || key] = obj[key]
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
warnings = warnings || []
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
}
}
}
return target
}
}
}
module.exports = buildDataFrameDeleteDataFrameTransform

View File

@ -0,0 +1,131 @@
/*
* 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 */
function buildDataFrameGetDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [data_frame.get_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform.html) request
*
* @param {string} transform_id - The id or comma delimited list of id expressions of the transforms to get, '_all' or '*' implies get all transforms
* @param {int} from - skips a number of transform configs, defaults to 0
* @param {int} size - specifies a max number of transforms to get, defaults to 100
*/
const acceptedQuerystring = [
'from',
'size'
]
const snakeCase = {
}
return function dataFrameGetDataFrameTransform (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.body != null) {
const err = new ConfigurationError('This API does not require a body')
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 = null
var { method, body, transformId, transform_id } = params
var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id'])
if (method == null) {
method = 'GET'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
if ((transform_id || transformId) != null) {
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId)
} else {
path = '/' + '_data_frame' + '/' + 'transforms'
}
// build request object
const request = {
method,
path,
body: null,
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}
return makeRequest(request, requestOptions, callback)
function semicopy (obj, exclude) {
var target = {}
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
if (exclude.indexOf(key) === -1) {
target[snakeCase[key] || key] = obj[key]
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
warnings = warnings || []
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
}
}
}
return target
}
}
}
module.exports = buildDataFrameGetDataFrameTransform

View File

@ -0,0 +1,127 @@
/*
* 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 */
function buildDataFrameGetDataFrameTransformStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [data_frame.get_data_frame_transform_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-data-frame-transform-stats.html) request
*
* @param {string} transform_id - The id of the transform for which to get stats. '_all' or '*' implies all transforms
* @param {number} from - skips a number of transform stats, defaults to 0
* @param {number} size - specifies a max number of transform stats to get, defaults to 100
*/
const acceptedQuerystring = [
'from',
'size'
]
const snakeCase = {
}
return function dataFrameGetDataFrameTransformStats (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.body != null) {
const err = new ConfigurationError('This API does not require a body')
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 = null
var { method, body, transformId, transform_id } = params
var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id'])
if (method == null) {
method = 'GET'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stats'
// build request object
const request = {
method,
path,
body: null,
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}
return makeRequest(request, requestOptions, callback)
function semicopy (obj, exclude) {
var target = {}
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
if (exclude.indexOf(key) === -1) {
target[snakeCase[key] || key] = obj[key]
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
warnings = warnings || []
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
}
}
}
return target
}
}
}
module.exports = buildDataFrameGetDataFrameTransformStats

View File

@ -0,0 +1,124 @@
/*
* 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 */
function buildDataFramePreviewDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [data_frame.preview_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/preview-data-frame-transform.html) request
*
* @param {object} body - The definition for the data_frame transform to preview
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function dataFramePreviewDataFrameTransform (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['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
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 = null
var { method, body } = params
var querystring = semicopy(params, ['method', 'body'])
if (method == null) {
method = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + '_preview'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}
return makeRequest(request, requestOptions, callback)
function semicopy (obj, exclude) {
var target = {}
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
if (exclude.indexOf(key) === -1) {
target[snakeCase[key] || key] = obj[key]
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
warnings = warnings || []
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
}
}
}
return target
}
}
}
module.exports = buildDataFramePreviewDataFrameTransform

View File

@ -0,0 +1,129 @@
/*
* 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 */
function buildDataFramePutDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [data_frame.put_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/put-data-frame-transform.html) request
*
* @param {string} transform_id - The id of the new transform.
* @param {object} body - The data frame transform definition
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function dataFramePutDataFrameTransform (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['transform_id'] == null && params['transformId'] == null) {
const err = new ConfigurationError('Missing required parameter: transform_id or transformId')
return handleError(err, callback)
}
if (params['body'] == null) {
const err = new ConfigurationError('Missing required parameter: body')
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 = null
var { method, body, transformId, transform_id } = params
var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id'])
if (method == null) {
method = 'PUT'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}
return makeRequest(request, requestOptions, callback)
function semicopy (obj, exclude) {
var target = {}
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
if (exclude.indexOf(key) === -1) {
target[snakeCase[key] || key] = obj[key]
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
warnings = warnings || []
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
}
}
}
return target
}
}
}
module.exports = buildDataFramePutDataFrameTransform

View File

@ -0,0 +1,129 @@
/*
* 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 */
function buildDataFrameStartDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [data_frame.start_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/start-data-frame-transform.html) request
*
* @param {string} transform_id - The id of the transform to start
* @param {time} timeout - Controls the time to wait for the transform to start
*/
const acceptedQuerystring = [
'timeout'
]
const snakeCase = {
}
return function dataFrameStartDataFrameTransform (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['transform_id'] == null && params['transformId'] == null) {
const err = new ConfigurationError('Missing required parameter: transform_id or transformId')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
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 = null
var { method, body, transformId, transform_id } = params
var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id'])
if (method == null) {
method = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_start'
// build request object
const request = {
method,
path,
body: '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}
return makeRequest(request, requestOptions, callback)
function semicopy (obj, exclude) {
var target = {}
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
if (exclude.indexOf(key) === -1) {
target[snakeCase[key] || key] = obj[key]
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
warnings = warnings || []
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
}
}
}
return target
}
}
}
module.exports = buildDataFrameStartDataFrameTransform

View File

@ -0,0 +1,132 @@
/*
* 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 */
function buildDataFrameStopDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError } = opts
/**
* Perform a [data_frame.stop_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-data-frame-transform.html) request
*
* @param {string} transform_id - The id of the transform to stop
* @param {boolean} wait_for_completion - Whether to wait for the transform to fully stop before returning or not. Default to false
* @param {time} timeout - Controls the time to wait until the transform has stopped. Default to 30 seconds
*/
const acceptedQuerystring = [
'wait_for_completion',
'timeout'
]
const snakeCase = {
waitForCompletion: 'wait_for_completion'
}
return function dataFrameStopDataFrameTransform (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['transform_id'] == null && params['transformId'] == null) {
const err = new ConfigurationError('Missing required parameter: transform_id or transformId')
return handleError(err, callback)
}
if (params.body != null) {
const err = new ConfigurationError('This API does not require a body')
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 = null
var { method, body, transformId, transform_id } = params
var querystring = semicopy(params, ['method', 'body', 'transformId', 'transform_id'])
if (method == null) {
method = 'POST'
}
var ignore = options.ignore || null
if (typeof ignore === 'number') {
ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_stop'
// build request object
const request = {
method,
path,
body: '',
querystring
}
const requestOptions = {
ignore,
requestTimeout: options.requestTimeout || null,
maxRetries: options.maxRetries || null,
asStream: options.asStream || false,
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}
return makeRequest(request, requestOptions, callback)
function semicopy (obj, exclude) {
var target = {}
var keys = Object.keys(obj)
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i]
if (exclude.indexOf(key) === -1) {
target[snakeCase[key] || key] = obj[key]
if (acceptedQuerystring.indexOf(snakeCase[key] || key) === -1) {
warnings = warnings || []
warnings.push('Client - Unknown parameter: "' + key + '", sending it as query parameter')
}
}
}
return target
}
}
}
module.exports = buildDataFrameStopDataFrameTransform

View File

@ -137,6 +137,8 @@ function buildDelete (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -196,6 +196,8 @@ function buildDeleteByQuery (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -112,6 +112,8 @@ function buildDeleteByQueryRethrottle (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -110,6 +110,8 @@ function buildDeleteScript (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -141,6 +141,8 @@ function buildExists (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -147,6 +147,8 @@ function buildExistsSource (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -143,6 +143,8 @@ function buildExplain (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -116,6 +116,8 @@ function buildFieldCaps (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -147,6 +147,8 @@ function buildGet (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -108,6 +108,8 @@ function buildGetScript (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -138,6 +138,8 @@ function buildGetSource (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -105,6 +105,8 @@ function buildGraphExplore (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -96,6 +96,8 @@ function buildIlmDeleteLifecycle (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -96,6 +96,8 @@ function buildIlmExplainLifecycle (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -100,6 +100,8 @@ function buildIlmGetLifecycle (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -95,6 +95,8 @@ function buildIlmGetStatus (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -91,6 +91,8 @@ function buildIlmMoveToStep (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -91,6 +91,8 @@ function buildIlmPutLifecycle (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -96,6 +96,8 @@ function buildIlmRemovePolicy (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -96,6 +96,8 @@ function buildIlmRetry (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -95,6 +95,8 @@ function buildIlmStart (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -95,6 +95,8 @@ function buildIlmStop (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -143,6 +143,8 @@ function buildIndex (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -102,6 +102,8 @@ function buildIndicesAnalyze (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -124,6 +124,8 @@ function buildIndicesClearCache (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -119,6 +119,8 @@ function buildIndicesClose (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -113,6 +113,8 @@ function buildIndicesCreate (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -119,6 +119,8 @@ function buildIndicesDelete (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -125,6 +125,8 @@ function buildIndicesDeleteAlias (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -110,6 +110,8 @@ function buildIndicesDeleteTemplate (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -122,6 +122,8 @@ function buildIndicesExists (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -121,6 +121,8 @@ function buildIndicesExistsAlias (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -113,6 +113,8 @@ function buildIndicesExistsTemplate (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -127,6 +127,8 @@ function buildIndicesExistsType (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -119,6 +119,8 @@ function buildIndicesFlush (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -114,6 +114,8 @@ function buildIndicesFlushSynced (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -122,6 +122,8 @@ function buildIndicesForcemerge (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -115,6 +115,8 @@ function buildIndicesFreeze (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -128,6 +128,8 @@ function buildIndicesGet (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -121,6 +121,8 @@ function buildIndicesGetAlias (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -132,6 +132,8 @@ function buildIndicesGetFieldMapping (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -127,6 +127,8 @@ function buildIndicesGetMapping (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -130,6 +130,8 @@ function buildIndicesGetSettings (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -116,6 +116,8 @@ function buildIndicesGetTemplate (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -114,6 +114,8 @@ function buildIndicesGetUpgrade (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -122,6 +122,8 @@ function buildIndicesOpen (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -122,6 +122,8 @@ function buildIndicesPutAlias (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

View File

@ -136,6 +136,8 @@ function buildIndicesPutMapping (opts) {
headers: options.headers || null,
querystring: options.querystring || null,
compression: options.compression || false,
id: options.id || null,
context: options.context || null,
warnings
}

Some files were not shown because too many files have changed in this diff Show More