API generation

This commit is contained in:
delvedor
2020-04-06 11:35:59 +02:00
parent 27a8e2a9bf
commit d10e8bb9f3
5 changed files with 110 additions and 3 deletions

View File

@ -0,0 +1,77 @@
// 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 buildAutoscalingGetAutoscalingPolicy (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
]
const snakeCase = {
}
/**
* Perform a autoscaling.get_autoscaling_policy request
* https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-policy.html
*/
return function autoscalingGetAutoscalingPolicy (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['name'] == null) {
const err = new ConfigurationError('Missing required parameter: name')
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, name, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}
var path = ''
if (method == null) method = 'GET'
path = '/' + '_autoscaling' + '/' + 'policy' + '/' + encodeURIComponent(name)
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildAutoscalingGetAutoscalingPolicy

View File

@ -31,6 +31,8 @@ function ESAPI (opts) {
deleteAutoscalingPolicy: lazyLoad('autoscaling.delete_autoscaling_policy', opts),
get_autoscaling_decision: lazyLoad('autoscaling.get_autoscaling_decision', opts),
getAutoscalingDecision: lazyLoad('autoscaling.get_autoscaling_decision', opts),
get_autoscaling_policy: lazyLoad('autoscaling.get_autoscaling_policy', opts),
getAutoscalingPolicy: lazyLoad('autoscaling.get_autoscaling_policy', opts),
put_autoscaling_policy: lazyLoad('autoscaling.put_autoscaling_policy', opts),
putAutoscalingPolicy: lazyLoad('autoscaling.put_autoscaling_policy', opts)
},

View File

@ -723,7 +723,7 @@ export interface IndicesGetAlias extends Generic {
}
export interface IndicesGetDataStreams extends Generic {
name?: string | string[];
name?: string;
}
export interface IndicesGetFieldMapping extends Generic {
@ -1437,6 +1437,10 @@ export interface AutoscalingDeleteAutoscalingPolicy extends Generic {
export interface AutoscalingGetAutoscalingDecision extends Generic {
}
export interface AutoscalingGetAutoscalingPolicy extends Generic {
name: string;
}
export interface AutoscalingPutAutoscalingPolicy<T = RequestBody> extends Generic {
name: string;
body: T;