API generation

This commit is contained in:
delvedor
2020-04-30 11:28:37 +02:00
parent 5db574a576
commit 0d5c7a880f
22 changed files with 541 additions and 21 deletions

View File

@ -21,6 +21,7 @@ function buildAutoscalingDeleteAutoscalingPolicy (opts) {
/**
* Perform a autoscaling.delete_autoscaling_policy request
* Deletes an autoscaling policy.
* https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-delete-autoscaling-policy.html
*/
return function autoscalingDeleteAutoscalingPolicy (params, options, callback) {

View File

@ -21,6 +21,7 @@ function buildAutoscalingGetAutoscalingPolicy (opts) {
/**
* Perform a autoscaling.get_autoscaling_policy request
* Retrieves an autoscaling policy.
* https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-policy.html
*/
return function autoscalingGetAutoscalingPolicy (params, options, callback) {

View File

@ -21,6 +21,7 @@ function buildAutoscalingPutAutoscalingPolicy (opts) {
/**
* Perform a autoscaling.put_autoscaling_policy request
* Creates a new autoscaling policy.
* https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-put-autoscaling-policy.html
*/
return function autoscalingPutAutoscalingPolicy (params, options, callback) {

View File

@ -23,6 +23,7 @@ function buildBulk (opts) {
'_source_includes',
'_source_include',
'pipeline',
'prefer_v2_templates',
'pretty',
'human',
'error_trace',
@ -36,6 +37,7 @@ function buildBulk (opts) {
_sourceExclude: '_source_exclude',
_sourceIncludes: '_source_includes',
_sourceInclude: '_source_include',
preferV2Templates: 'prefer_v2_templates',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -0,0 +1,79 @@
// 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 buildClusterDeleteVotingConfigExclusions (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'wait_for_removal',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
waitForRemoval: 'wait_for_removal',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
/**
* Perform a cluster.delete_voting_config_exclusions request
* Clears cluster voting config exclusions.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html
*/
return function clusterDeleteVotingConfigExclusions (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 = 'DELETE'
path = '/' + '_cluster' + '/' + 'voting_config_exclusions'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildClusterDeleteVotingConfigExclusions

View File

@ -0,0 +1,82 @@
// 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 buildClusterPostVotingConfigExclusions (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'node_ids',
'node_names',
'timeout',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
nodeIds: 'node_ids',
nodeNames: 'node_names',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
/**
* Perform a cluster.post_voting_config_exclusions request
* Updates the cluster voting config exclusions by node ids or node names.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html
*/
return function clusterPostVotingConfigExclusions (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 = '/' + '_cluster' + '/' + 'voting_config_exclusions'
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildClusterPostVotingConfigExclusions

View File

@ -19,6 +19,7 @@ function buildCreate (opts) {
'version',
'version_type',
'pipeline',
'prefer_v2_templates',
'pretty',
'human',
'error_trace',
@ -29,6 +30,7 @@ function buildCreate (opts) {
const snakeCase = {
waitForActiveShards: 'wait_for_active_shards',
versionType: 'version_type',
preferV2Templates: 'prefer_v2_templates',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -22,7 +22,7 @@ function buildEqlSearch (opts) {
/**
* Perform a eql.search request
* Returns results matching a query expressed in Event Query Language (EQL)
* https://www.elastic.co/guide/en/elasticsearch/reference/current/eql.html
* https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html
*/
return function eqlSearch (params, options, callback) {
options = options || {}

View File

@ -22,6 +22,7 @@ function buildIndex (opts) {
'if_seq_no',
'if_primary_term',
'pipeline',
'prefer_v2_templates',
'pretty',
'human',
'error_trace',
@ -35,6 +36,7 @@ function buildIndex (opts) {
versionType: 'version_type',
ifSeqNo: 'if_seq_no',
ifPrimaryTerm: 'if_primary_term',
preferV2Templates: 'prefer_v2_templates',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -15,6 +15,7 @@ function buildIndicesCreate (opts) {
'wait_for_active_shards',
'timeout',
'master_timeout',
'prefer_v2_templates',
'pretty',
'human',
'error_trace',
@ -25,6 +26,7 @@ function buildIndicesCreate (opts) {
const snakeCase = {
waitForActiveShards: 'wait_for_active_shards',
masterTimeout: 'master_timeout',
preferV2Templates: 'prefer_v2_templates',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -16,6 +16,7 @@ function buildIndicesRollover (opts) {
'dry_run',
'master_timeout',
'wait_for_active_shards',
'prefer_v2_templates',
'pretty',
'human',
'error_trace',
@ -27,6 +28,7 @@ function buildIndicesRollover (opts) {
dryRun: 'dry_run',
masterTimeout: 'master_timeout',
waitForActiveShards: 'wait_for_active_shards',
preferV2Templates: 'prefer_v2_templates',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -0,0 +1,85 @@
// 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 buildIndicesSimulateIndexTemplate (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
'master_timeout',
'pretty',
'human',
'error_trace',
'source',
'filter_path'
]
const snakeCase = {
masterTimeout: 'master_timeout',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}
/**
* Perform a indices.simulate_index_template request
* Simulate matching the given index name against the index templates in the system
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
*/
return function indicesSimulateIndexTemplate (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 = 'POST'
path = '/' + '_index_template' + '/' + '_simulate_index' + '/' + encodeURIComponent(name)
// build request object
const request = {
method,
path,
body: body || '',
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildIndicesSimulateIndexTemplate

View File

@ -68,15 +68,6 @@ function buildNodesHotThreads (opts) {
if ((node_id || nodeId) != null) {
if (method == null) method = 'GET'
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
} else if ((node_id || nodeId) != null) {
if (method == null) method = 'GET'
path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
} else if ((node_id || nodeId) != null) {
if (method == null) method = 'GET'
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hotthreads'
} else if ((node_id || nodeId) != null) {
if (method == null) method = 'GET'
path = '/' + '_cluster' + '/' + 'nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'hot_threads'
} else {
if (method == null) method = 'GET'
path = '/' + '_nodes' + '/' + 'hot_threads'

View File

@ -27,6 +27,7 @@ function buildSearchableSnapshotsClearCache (opts) {
/**
* Perform a searchable_snapshots.clear_cache request
* Clear the cache of searchable snapshots.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-clear-cache.html
*/
return function searchableSnapshotsClearCache (params, options, callback) {

View File

@ -23,6 +23,7 @@ function buildSearchableSnapshotsMount (opts) {
/**
* Perform a searchable_snapshots.mount request
* Mount a snapshot as a searchable index.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-mount-snapshot.html
*/
return function searchableSnapshotsMount (params, options, callback) {

View File

@ -0,0 +1,78 @@
// 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 buildSearchableSnapshotsRepositoryStats (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
const acceptedQuerystring = [
]
const snakeCase = {
}
/**
* Perform a searchable_snapshots.repository_stats request
* Retrieve usage statistics about a snapshot repository.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-repository-stats.html
*/
return function searchableSnapshotsRepositoryStats (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['repository'] == null) {
const err = new ConfigurationError('Missing required parameter: repository')
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, repository, ...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 = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + '_stats'
// build request object
const request = {
method,
path,
body: null,
querystring
}
options.warnings = warnings.length === 0 ? null : warnings
return makeRequest(request, options, callback)
}
}
module.exports = buildSearchableSnapshotsRepositoryStats

View File

@ -21,6 +21,7 @@ function buildSearchableSnapshotsStats (opts) {
/**
* Perform a searchable_snapshots.stats request
* Retrieve various statistics about searchable snapshots.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-stats.html
*/
return function searchableSnapshotsStats (params, options, callback) {

View File

@ -25,6 +25,7 @@ function buildUpdate (opts) {
'timeout',
'if_seq_no',
'if_primary_term',
'prefer_v2_templates',
'pretty',
'human',
'error_trace',
@ -41,6 +42,7 @@ function buildUpdate (opts) {
retryOnConflict: 'retry_on_conflict',
ifSeqNo: 'if_seq_no',
ifPrimaryTerm: 'if_primary_term',
preferV2Templates: 'prefer_v2_templates',
errorTrace: 'error_trace',
filterPath: 'filter_path'
}

View File

@ -102,6 +102,8 @@ function ESAPI (opts) {
allocationExplain: lazyLoad('cluster.allocation_explain', opts),
delete_component_template: lazyLoad('cluster.delete_component_template', opts),
deleteComponentTemplate: lazyLoad('cluster.delete_component_template', opts),
delete_voting_config_exclusions: lazyLoad('cluster.delete_voting_config_exclusions', opts),
deleteVotingConfigExclusions: lazyLoad('cluster.delete_voting_config_exclusions', opts),
exists_component_template: lazyLoad('cluster.exists_component_template', opts),
existsComponentTemplate: lazyLoad('cluster.exists_component_template', opts),
get_component_template: lazyLoad('cluster.get_component_template', opts),
@ -111,6 +113,8 @@ function ESAPI (opts) {
health: lazyLoad('cluster.health', opts),
pending_tasks: lazyLoad('cluster.pending_tasks', opts),
pendingTasks: lazyLoad('cluster.pending_tasks', opts),
post_voting_config_exclusions: lazyLoad('cluster.post_voting_config_exclusions', opts),
postVotingConfigExclusions: lazyLoad('cluster.post_voting_config_exclusions', opts),
put_component_template: lazyLoad('cluster.put_component_template', opts),
putComponentTemplate: lazyLoad('cluster.put_component_template', opts),
put_settings: lazyLoad('cluster.put_settings', opts),
@ -285,6 +289,8 @@ function ESAPI (opts) {
shard_stores: lazyLoad('indices.shard_stores', opts),
shardStores: lazyLoad('indices.shard_stores', opts),
shrink: lazyLoad('indices.shrink', opts),
simulate_index_template: lazyLoad('indices.simulate_index_template', opts),
simulateIndexTemplate: lazyLoad('indices.simulate_index_template', opts),
split: lazyLoad('indices.split', opts),
stats: lazyLoad('indices.stats', opts),
unfreeze: lazyLoad('indices.unfreeze', opts),
@ -496,12 +502,16 @@ function ESAPI (opts) {
clear_cache: lazyLoad('searchable_snapshots.clear_cache', opts),
clearCache: lazyLoad('searchable_snapshots.clear_cache', opts),
mount: lazyLoad('searchable_snapshots.mount', opts),
repository_stats: lazyLoad('searchable_snapshots.repository_stats', opts),
repositoryStats: lazyLoad('searchable_snapshots.repository_stats', opts),
stats: lazyLoad('searchable_snapshots.stats', opts)
},
searchableSnapshots: {
clear_cache: lazyLoad('searchable_snapshots.clear_cache', opts),
clearCache: lazyLoad('searchable_snapshots.clear_cache', opts),
mount: lazyLoad('searchable_snapshots.mount', opts),
repository_stats: lazyLoad('searchable_snapshots.repository_stats', opts),
repositoryStats: lazyLoad('searchable_snapshots.repository_stats', opts),
stats: lazyLoad('searchable_snapshots.stats', opts)
},
security: {

View File

@ -27,6 +27,7 @@ export interface Bulk<T = RequestNDBody> extends Generic {
_source_excludes?: string | string[];
_source_includes?: string | string[];
pipeline?: string;
prefer_v2_templates?: boolean;
body: T;
}
@ -268,6 +269,10 @@ export interface ClusterDeleteComponentTemplate extends Generic {
master_timeout?: string;
}
export interface ClusterDeleteVotingConfigExclusions extends Generic {
wait_for_removal?: boolean;
}
export interface ClusterExistsComponentTemplate extends Generic {
name: string;
master_timeout?: string;
@ -307,6 +312,12 @@ export interface ClusterPendingTasks extends Generic {
master_timeout?: string;
}
export interface ClusterPostVotingConfigExclusions extends Generic {
node_ids?: string;
node_names?: string;
timeout?: string;
}
export interface ClusterPutComponentTemplate<T = RequestBody> extends Generic {
name: string;
create?: boolean;
@ -384,6 +395,7 @@ export interface Create<T = RequestBody> extends Generic {
version?: number;
version_type?: 'internal' | 'external' | 'external_gte';
pipeline?: string;
prefer_v2_templates?: boolean;
body: T;
}
@ -571,6 +583,7 @@ export interface Index<T = RequestBody> extends Generic {
if_seq_no?: number;
if_primary_term?: number;
pipeline?: string;
prefer_v2_templates?: boolean;
body: T;
}
@ -614,6 +627,7 @@ export interface IndicesCreate<T = RequestBody> extends Generic {
wait_for_active_shards?: string;
timeout?: string;
master_timeout?: string;
prefer_v2_templates?: boolean;
body?: T;
}
@ -867,6 +881,7 @@ export interface IndicesRollover<T = RequestBody> extends Generic {
dry_run?: boolean;
master_timeout?: string;
wait_for_active_shards?: string;
prefer_v2_templates?: boolean;
body?: T;
}
@ -895,6 +910,12 @@ export interface IndicesShrink<T = RequestBody> extends Generic {
body?: T;
}
export interface IndicesSimulateIndexTemplate<T = RequestBody> extends Generic {
name: string;
master_timeout?: string;
body?: T;
}
export interface IndicesSplit<T = RequestBody> extends Generic {
index: string;
target: string;
@ -1053,9 +1074,10 @@ export interface NodesInfo extends Generic {
timeout?: string;
}
export interface NodesReloadSecureSettings extends Generic {
export interface NodesReloadSecureSettings<T = RequestBody> extends Generic {
node_id?: string | string[];
timeout?: string;
body?: T;
}
export interface NodesStats extends Generic {
@ -1335,6 +1357,7 @@ export interface Update<T = RequestBody> extends Generic {
timeout?: string;
if_seq_no?: number;
if_primary_term?: number;
prefer_v2_templates?: boolean;
body: T;
}
@ -2209,6 +2232,10 @@ export interface SearchableSnapshotsMount<T = RequestBody> extends Generic {
body: T;
}
export interface SearchableSnapshotsRepositoryStats extends Generic {
repository: string;
}
export interface SearchableSnapshotsStats extends Generic {
index?: string | string[];
}