API generation
This commit is contained in:
88
api/api/indices.exists_index_template.js
Normal file
88
api/api/indices.exists_index_template.js
Normal file
@ -0,0 +1,88 @@
|
||||
// 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 buildIndicesExistsIndexTemplate (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'flat_settings',
|
||||
'master_timeout',
|
||||
'local',
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
flatSettings: 'flat_settings',
|
||||
masterTimeout: 'master_timeout',
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a indices.exists_index_template request
|
||||
* Returns information about whether a particular index template exists.
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html
|
||||
*/
|
||||
return function indicesExistsIndexTemplate (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 = 'HEAD'
|
||||
path = '/' + '_index_template' + '/' + 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 = buildIndicesExistsIndexTemplate
|
||||
@ -27,7 +27,7 @@ function buildSearchableSnapshotsClearCache (opts) {
|
||||
|
||||
/**
|
||||
* Perform a searchable_snapshots.clear_cache request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-clear-cache.html
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-clear-cache.html
|
||||
*/
|
||||
return function searchableSnapshotsClearCache (params, options, callback) {
|
||||
options = options || {}
|
||||
|
||||
@ -23,7 +23,7 @@ function buildSearchableSnapshotsMount (opts) {
|
||||
|
||||
/**
|
||||
* Perform a searchable_snapshots.mount request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-mount-snapshot
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-mount-snapshot.html
|
||||
*/
|
||||
return function searchableSnapshotsMount (params, options, callback) {
|
||||
options = options || {}
|
||||
|
||||
@ -21,7 +21,7 @@ function buildSearchableSnapshotsStats (opts) {
|
||||
|
||||
/**
|
||||
* Perform a searchable_snapshots.stats request
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-stats.html
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-stats.html
|
||||
*/
|
||||
return function searchableSnapshotsStats (params, options, callback) {
|
||||
options = options || {}
|
||||
|
||||
@ -239,6 +239,8 @@ function ESAPI (opts) {
|
||||
exists: lazyLoad('indices.exists', opts),
|
||||
exists_alias: lazyLoad('indices.exists_alias', opts),
|
||||
existsAlias: lazyLoad('indices.exists_alias', opts),
|
||||
exists_index_template: lazyLoad('indices.exists_index_template', opts),
|
||||
existsIndexTemplate: lazyLoad('indices.exists_index_template', opts),
|
||||
exists_template: lazyLoad('indices.exists_template', opts),
|
||||
existsTemplate: lazyLoad('indices.exists_template', opts),
|
||||
exists_type: lazyLoad('indices.exists_type', opts),
|
||||
|
||||
7
api/requestParams.d.ts
vendored
7
api/requestParams.d.ts
vendored
@ -673,6 +673,13 @@ export interface IndicesExistsAlias extends Generic {
|
||||
local?: boolean;
|
||||
}
|
||||
|
||||
export interface IndicesExistsIndexTemplate extends Generic {
|
||||
name: string;
|
||||
flat_settings?: boolean;
|
||||
master_timeout?: string;
|
||||
local?: boolean;
|
||||
}
|
||||
|
||||
export interface IndicesExistsTemplate extends Generic {
|
||||
name: string | string[];
|
||||
flat_settings?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user