API generation

This commit is contained in:
delvedor
2019-08-14 08:57:25 +02:00
parent ce90db86cf
commit f7be49f2ba
10 changed files with 237 additions and 9 deletions

View File

@ -0,0 +1,87 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildDataFrameUpdateDataFrameTransform (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [data_frame.update_data_frame_transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/update-data-frame-transform.html) request
*
* @param {string} transform_id - The id of the transform.
* @param {boolean} defer_validation - If validations should be deferred until data frame transform starts, defaults to false.
* @param {object} body - The update data frame transform definition
*/
const acceptedQuerystring = [
'defer_validation'
]
const snakeCase = {
deferValidation: 'defer_validation'
}
return function dataFrameUpdateDataFrameTransform (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 = []
var { method, body, transformId, transform_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_data_frame' + '/' + 'transforms' + '/' + encodeURIComponent(transform_id || transformId) + '/' + '_update'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildDataFrameUpdateDataFrameTransform

View File

@ -0,0 +1,81 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
'use strict'
/* eslint camelcase: 0 */
/* eslint no-unused-vars: 0 */
function buildMlEstimateMemoryUsage (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [ml.estimate_memory_usage](http://www.elastic.co/guide/en/elasticsearch/reference/current/estimate-memory-usage-dfanalytics.html) request
*
* @param {object} body - Memory usage estimation definition
*/
const acceptedQuerystring = [
]
const snakeCase = {
}
return function mlEstimateMemoryUsage (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 = []
var { method, body, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {
method = 'POST'
}
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
path = '/' + '_ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + '_estimate_memory_usage'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildMlEstimateMemoryUsage

View File

@ -11,9 +11,9 @@ function buildSlmDeleteLifecycle (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [slm.delete_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api.html) request
* Perform a [slm.delete_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-delete.html) request
*
* @param {string} policy - The id of the snapshot lifecycle policy to remove
* @param {string} policy_id - The id of the snapshot lifecycle policy to remove
*/
const acceptedQuerystring = [
@ -49,7 +49,7 @@ function buildSlmDeleteLifecycle (opts) {
}
var warnings = []
var { method, body, policy_id, policyId, ...querystring } = params
var { method, body, policyId, policy_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
if (method == null) {

View File

@ -11,7 +11,7 @@ function buildSlmExecuteLifecycle (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [slm.execute_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api.html) request
* Perform a [slm.execute_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-execute.html) request
*
* @param {string} policy_id - The id of the snapshot lifecycle policy to be executed
*/

View File

@ -11,7 +11,7 @@ function buildSlmGetLifecycle (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [slm.get_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api.html) request
* Perform a [slm.get_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get.html) request
*
* @param {string} policy_id - Comma-separated list of snapshot lifecycle policies to retrieve
*/

View File

@ -11,7 +11,7 @@ function buildSlmPutLifecycle (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [slm.put_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api.html) request
* Perform a [slm.put_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-put.html) request
*
* @param {string} policy_id - The id of the snapshot lifecycle policy
* @param {object} body - The snapshot lifecycle policy definition to register

View File

@ -96,7 +96,9 @@ function ESAPI (opts) {
start_data_frame_transform: lazyLoad('data_frame.start_data_frame_transform', opts),
startDataFrameTransform: lazyLoad('data_frame.start_data_frame_transform', opts),
stop_data_frame_transform: lazyLoad('data_frame.stop_data_frame_transform', opts),
stopDataFrameTransform: lazyLoad('data_frame.stop_data_frame_transform', opts)
stopDataFrameTransform: lazyLoad('data_frame.stop_data_frame_transform', opts),
update_data_frame_transform: lazyLoad('data_frame.update_data_frame_transform', opts),
updateDataFrameTransform: lazyLoad('data_frame.update_data_frame_transform', opts)
},
dataFrame: {
delete_data_frame_transform: lazyLoad('data_frame.delete_data_frame_transform', opts),
@ -112,7 +114,9 @@ function ESAPI (opts) {
start_data_frame_transform: lazyLoad('data_frame.start_data_frame_transform', opts),
startDataFrameTransform: lazyLoad('data_frame.start_data_frame_transform', opts),
stop_data_frame_transform: lazyLoad('data_frame.stop_data_frame_transform', opts),
stopDataFrameTransform: lazyLoad('data_frame.stop_data_frame_transform', opts)
stopDataFrameTransform: lazyLoad('data_frame.stop_data_frame_transform', opts),
update_data_frame_transform: lazyLoad('data_frame.update_data_frame_transform', opts),
updateDataFrameTransform: lazyLoad('data_frame.update_data_frame_transform', opts)
},
delete: lazyLoad('delete', opts),
delete_by_query: lazyLoad('delete_by_query', opts),
@ -271,6 +275,8 @@ function ESAPI (opts) {
deleteJob: lazyLoad('ml.delete_job', opts),
delete_model_snapshot: lazyLoad('ml.delete_model_snapshot', opts),
deleteModelSnapshot: lazyLoad('ml.delete_model_snapshot', opts),
estimate_memory_usage: lazyLoad('ml.estimate_memory_usage', opts),
estimateMemoryUsage: lazyLoad('ml.estimate_memory_usage', opts),
evaluate_data_frame: lazyLoad('ml.evaluate_data_frame', opts),
evaluateDataFrame: lazyLoad('ml.evaluate_data_frame', opts),
find_file_structure: lazyLoad('ml.find_file_structure', opts),

View File

@ -1413,6 +1413,12 @@ export interface DataFrameStopDataFrameTransform extends Generic {
allow_no_match?: boolean;
}
export interface DataFrameUpdateDataFrameTransform<T = any> extends Generic {
transform_id: string;
defer_validation?: boolean;
body: T;
}
export interface GraphExplore<T = any> extends Generic {
index?: string | string[];
type?: string | string[];
@ -1576,6 +1582,10 @@ export interface MlDeleteModelSnapshot extends Generic {
snapshot_id: string;
}
export interface MlEstimateMemoryUsage<T = any> extends Generic {
body: T;
}
export interface MlEvaluateDataFrame<T = any> extends Generic {
body: T;
}

View File

@ -5494,6 +5494,29 @@ link:{ref}/stop-data-frame-transform.html[Reference]
|===
=== dataFrame.updateDataFrameTransform
[source,ts]
----
client.dataFrame.updateDataFrameTransform({
transform_id: string,
defer_validation: boolean,
body: object
})
----
link:{ref}/update-data-frame-transform.html[Reference]
[cols=2*]
|===
|`transform_id` or `transformId`
|`string` - The id of the transform.
|`defer_validation` or `deferValidation`
|`boolean` - If validations should be deferred until data frame transform starts, defaults to false.
|`body`
|`object` - The update data frame transform definition
|===
=== graph.explore
[source,ts]
----
@ -6091,6 +6114,21 @@ link:{ref}/ml-delete-snapshot.html[Reference]
|===
=== ml.estimateMemoryUsage
[source,ts]
----
client.ml.estimateMemoryUsage({
body: object
})
----
link:{ref}/estimate-memory-usage-dfanalytics.html[Reference]
[cols=2*]
|===
|`body`
|`object` - Memory usage estimation definition
|===
=== ml.evaluateDataFrame
[source,ts]
----
@ -7851,7 +7889,7 @@ client.slm.deleteLifecycle({
link:{ref}/slm-api-delete.html[Reference]
[cols=2*]
|===
|`policy_id`
|`policy_id` or `policyId`
|`string` - The id of the snapshot lifecycle policy to remove
|===

6
index.d.ts vendored
View File

@ -195,6 +195,8 @@ declare class Client extends EventEmitter {
startDataFrameTransform: ApiMethod<RequestParams.DataFrameStartDataFrameTransform>
stop_data_frame_transform: ApiMethod<RequestParams.DataFrameStopDataFrameTransform>
stopDataFrameTransform: ApiMethod<RequestParams.DataFrameStopDataFrameTransform>
update_data_frame_transform: ApiMethod<RequestParams.DataFrameUpdateDataFrameTransform>
updateDataFrameTransform: ApiMethod<RequestParams.DataFrameUpdateDataFrameTransform>
}
dataFrame: {
delete_data_frame_transform: ApiMethod<RequestParams.DataFrameDeleteDataFrameTransform>
@ -211,6 +213,8 @@ declare class Client extends EventEmitter {
startDataFrameTransform: ApiMethod<RequestParams.DataFrameStartDataFrameTransform>
stop_data_frame_transform: ApiMethod<RequestParams.DataFrameStopDataFrameTransform>
stopDataFrameTransform: ApiMethod<RequestParams.DataFrameStopDataFrameTransform>
update_data_frame_transform: ApiMethod<RequestParams.DataFrameUpdateDataFrameTransform>
updateDataFrameTransform: ApiMethod<RequestParams.DataFrameUpdateDataFrameTransform>
}
delete: ApiMethod<RequestParams.Delete>
delete_by_query: ApiMethod<RequestParams.DeleteByQuery>
@ -369,6 +373,8 @@ declare class Client extends EventEmitter {
deleteJob: ApiMethod<RequestParams.MlDeleteJob>
delete_model_snapshot: ApiMethod<RequestParams.MlDeleteModelSnapshot>
deleteModelSnapshot: ApiMethod<RequestParams.MlDeleteModelSnapshot>
estimate_memory_usage: ApiMethod<RequestParams.MlEstimateMemoryUsage>
estimateMemoryUsage: ApiMethod<RequestParams.MlEstimateMemoryUsage>
evaluate_data_frame: ApiMethod<RequestParams.MlEvaluateDataFrame>
evaluateDataFrame: ApiMethod<RequestParams.MlEvaluateDataFrame>
find_file_structure: ApiMethod<RequestParams.MlFindFileStructure>