API generation
This commit is contained in:
76
api/api/get_script_languages.js
Normal file
76
api/api/get_script_languages.js
Normal file
@ -0,0 +1,76 @@
|
||||
// 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 buildGetScriptLanguages (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a get_script_languages request
|
||||
* Returns available script types, languages and contexts
|
||||
*/
|
||||
return function getScriptLanguages (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_script_language'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildGetScriptLanguages
|
||||
@ -12,11 +12,12 @@ function buildLicenseGet (opts) {
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'local'
|
||||
'local',
|
||||
'accept_enterprise'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
acceptEnterprise: 'accept_enterprise'
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
71
api/api/slm.get_status.js
Normal file
71
api/api/slm.get_status.js
Normal file
@ -0,0 +1,71 @@
|
||||
// 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 buildSlmGetStatus (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a slm.get_status request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-get-status.html
|
||||
*/
|
||||
return function slmGetStatus (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_slm' + '/' + 'status'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildSlmGetStatus
|
||||
71
api/api/slm.start.js
Normal file
71
api/api/slm.start.js
Normal file
@ -0,0 +1,71 @@
|
||||
// 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 buildSlmStart (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a slm.start request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-start.html
|
||||
*/
|
||||
return function slmStart (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_slm' + '/' + 'start'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildSlmStart
|
||||
71
api/api/slm.stop.js
Normal file
71
api/api/slm.stop.js
Normal file
@ -0,0 +1,71 @@
|
||||
// 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 buildSlmStop (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a slm.stop request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-stop.html
|
||||
*/
|
||||
return function slmStop (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_slm' + '/' + 'stop'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildSlmStop
|
||||
@ -151,6 +151,8 @@ function ESAPI (opts) {
|
||||
getScript: lazyLoad('get_script', opts),
|
||||
get_script_context: lazyLoad('get_script_context', opts),
|
||||
getScriptContext: lazyLoad('get_script_context', opts),
|
||||
get_script_languages: lazyLoad('get_script_languages', opts),
|
||||
getScriptLanguages: lazyLoad('get_script_languages', opts),
|
||||
get_source: lazyLoad('get_source', opts),
|
||||
getSource: lazyLoad('get_source', opts),
|
||||
graph: {
|
||||
@ -498,8 +500,12 @@ function ESAPI (opts) {
|
||||
getLifecycle: lazyLoad('slm.get_lifecycle', opts),
|
||||
get_stats: lazyLoad('slm.get_stats', opts),
|
||||
getStats: lazyLoad('slm.get_stats', opts),
|
||||
get_status: lazyLoad('slm.get_status', opts),
|
||||
getStatus: lazyLoad('slm.get_status', opts),
|
||||
put_lifecycle: lazyLoad('slm.put_lifecycle', opts),
|
||||
putLifecycle: lazyLoad('slm.put_lifecycle', opts)
|
||||
putLifecycle: lazyLoad('slm.put_lifecycle', opts),
|
||||
start: lazyLoad('slm.start', opts),
|
||||
stop: lazyLoad('slm.stop', opts)
|
||||
},
|
||||
snapshot: {
|
||||
cleanup_repository: lazyLoad('snapshot.cleanup_repository', opts),
|
||||
|
||||
15
api/requestParams.d.ts
vendored
15
api/requestParams.d.ts
vendored
@ -87,7 +87,7 @@ export interface CatHelp extends Generic {
|
||||
export interface CatIndices extends Generic {
|
||||
index?: string | string[];
|
||||
format?: string;
|
||||
bytes?: 'b' | 'k' | 'm' | 'g';
|
||||
bytes?: 'b' | 'k' | 'kb' | 'm' | 'mb' | 'g' | 'gb' | 't' | 'tb' | 'p' | 'pb';
|
||||
local?: boolean;
|
||||
master_timeout?: string;
|
||||
h?: string | string[];
|
||||
@ -510,6 +510,9 @@ export interface GetScript extends Generic {
|
||||
export interface GetScriptContext extends Generic {
|
||||
}
|
||||
|
||||
export interface GetScriptLanguages extends Generic {
|
||||
}
|
||||
|
||||
export interface GetSource extends Generic {
|
||||
id: string;
|
||||
index: string;
|
||||
@ -1524,6 +1527,7 @@ export interface LicenseDelete extends Generic {
|
||||
|
||||
export interface LicenseGet extends Generic {
|
||||
local?: boolean;
|
||||
accept_enterprise?: boolean;
|
||||
}
|
||||
|
||||
export interface LicenseGetBasicStatus extends Generic {
|
||||
@ -2110,11 +2114,20 @@ export interface SlmGetLifecycle extends Generic {
|
||||
export interface SlmGetStats extends Generic {
|
||||
}
|
||||
|
||||
export interface SlmGetStatus extends Generic {
|
||||
}
|
||||
|
||||
export interface SlmPutLifecycle<T = any> extends Generic {
|
||||
policy_id: string;
|
||||
body?: T;
|
||||
}
|
||||
|
||||
export interface SlmStart extends Generic {
|
||||
}
|
||||
|
||||
export interface SlmStop extends Generic {
|
||||
}
|
||||
|
||||
export interface SqlClearCursor<T = any> extends Generic {
|
||||
body: T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user