Better api error handling (#790)
* API generation * Updated code generation * Updated test
This commit is contained in:
committed by
GitHub
parent
7d1c660f4e
commit
46bd14a36c
@ -24,7 +24,7 @@
|
||||
|
||||
function buildBulk (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [bulk](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request
|
||||
*
|
||||
@ -79,37 +79,22 @@ function buildBulk (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
bulk(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatAliases (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.aliases](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html) request
|
||||
*
|
||||
@ -71,29 +71,16 @@ function buildCatAliases (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catAliases(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatAllocation (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.allocation](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html) request
|
||||
*
|
||||
@ -73,29 +73,16 @@ function buildCatAllocation (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catAllocation(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatCount (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.count](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html) request
|
||||
*
|
||||
@ -71,29 +71,16 @@ function buildCatCount (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catCount(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatFielddata (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.fielddata](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html) request
|
||||
*
|
||||
@ -75,29 +75,16 @@ function buildCatFielddata (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catFielddata(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatHealth (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html) request
|
||||
*
|
||||
@ -72,29 +72,16 @@ function buildCatHealth (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catHealth(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatHelp (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.help](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html) request
|
||||
*
|
||||
@ -59,29 +59,16 @@ function buildCatHelp (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catHelp(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatIndices (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.indices](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html) request
|
||||
*
|
||||
@ -77,29 +77,16 @@ function buildCatIndices (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catIndices(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatMaster (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.master](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html) request
|
||||
*
|
||||
@ -70,29 +70,16 @@ function buildCatMaster (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catMaster(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatNodeattrs (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.nodeattrs](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html) request
|
||||
*
|
||||
@ -70,29 +70,16 @@ function buildCatNodeattrs (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catNodeattrs(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatNodes (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.nodes](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html) request
|
||||
*
|
||||
@ -73,29 +73,16 @@ function buildCatNodes (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catNodes(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatPendingTasks (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html) request
|
||||
*
|
||||
@ -70,29 +70,16 @@ function buildCatPendingTasks (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catPendingTasks(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatPlugins (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.plugins](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html) request
|
||||
*
|
||||
@ -70,29 +70,16 @@ function buildCatPlugins (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catPlugins(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatRecovery (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html) request
|
||||
*
|
||||
@ -71,29 +71,16 @@ function buildCatRecovery (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catRecovery(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatRepositories (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.repositories](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html) request
|
||||
*
|
||||
@ -70,29 +70,16 @@ function buildCatRepositories (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catRepositories(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatSegments (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html) request
|
||||
*
|
||||
@ -68,29 +68,16 @@ function buildCatSegments (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catSegments(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatShards (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.shards](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html) request
|
||||
*
|
||||
@ -73,29 +73,16 @@ function buildCatShards (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catShards(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatSnapshots (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html) request
|
||||
*
|
||||
@ -72,29 +72,16 @@ function buildCatSnapshots (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catSnapshots(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatTasks (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html) request
|
||||
*
|
||||
@ -75,29 +75,16 @@ function buildCatTasks (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catTasks(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatTemplates (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.templates](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html) request
|
||||
*
|
||||
@ -71,29 +71,16 @@ function buildCatTemplates (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catTemplates(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCatThreadPool (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cat.thread_pool](http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html) request
|
||||
*
|
||||
@ -73,29 +73,16 @@ function buildCatThreadPool (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
catThreadPool(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrDeleteAutoFollowPattern (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.delete_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html) request
|
||||
*
|
||||
@ -51,29 +51,16 @@ function buildCcrDeleteAutoFollowPattern (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrDeleteAutoFollowPattern(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['name'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: name'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrFollow (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html) request
|
||||
*
|
||||
@ -53,35 +53,20 @@ function buildCcrFollow (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrFollow(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrFollowInfo (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.follow_info](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html) request
|
||||
*
|
||||
@ -51,21 +51,10 @@ function buildCcrFollowInfo (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrFollowInfo(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrFollowStats (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.follow_stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html) request
|
||||
*
|
||||
@ -51,21 +51,10 @@ function buildCcrFollowStats (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrFollowStats(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrGetAutoFollowPattern (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.get_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html) request
|
||||
*
|
||||
@ -51,21 +51,10 @@ function buildCcrGetAutoFollowPattern (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrGetAutoFollowPattern(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrPauseFollow (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.pause_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-pause-follow.html) request
|
||||
*
|
||||
@ -51,29 +51,16 @@ function buildCcrPauseFollow (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrPauseFollow(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrPutAutoFollowPattern (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.put_auto_follow_pattern](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html) request
|
||||
*
|
||||
@ -52,35 +52,20 @@ function buildCcrPutAutoFollowPattern (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrPutAutoFollowPattern(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['name'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: name'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrResumeFollow (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.resume_follow](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-post-resume-follow.html) request
|
||||
*
|
||||
@ -52,29 +52,16 @@ function buildCcrResumeFollow (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrResumeFollow(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrStats (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.stats](https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html) request
|
||||
*
|
||||
@ -50,21 +50,10 @@ function buildCcrStats (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrStats(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCcrUnfollow (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ccr.unfollow](http://www.elastic.co/guide/en/elasticsearch/reference/current) request
|
||||
*
|
||||
@ -51,29 +51,16 @@ function buildCcrUnfollow (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ccrUnfollow(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClearScroll (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [clear_scroll](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html) request
|
||||
*
|
||||
@ -57,21 +57,10 @@ function buildClearScroll (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clearScroll(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClusterAllocationExplain (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.allocation_explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html) request
|
||||
*
|
||||
@ -62,21 +62,10 @@ function buildClusterAllocationExplain (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clusterAllocationExplain(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClusterGetSettings (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request
|
||||
*
|
||||
@ -66,29 +66,16 @@ function buildClusterGetSettings (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clusterGetSettings(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClusterHealth (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.health](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html) request
|
||||
*
|
||||
@ -83,29 +83,16 @@ function buildClusterHealth (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clusterHealth(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClusterPendingTasks (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.pending_tasks](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html) request
|
||||
*
|
||||
@ -60,29 +60,16 @@ function buildClusterPendingTasks (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clusterPendingTasks(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClusterPutSettings (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html) request
|
||||
*
|
||||
@ -64,29 +64,16 @@ function buildClusterPutSettings (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clusterPutSettings(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClusterRemoteInfo (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.remote_info](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html) request
|
||||
*
|
||||
@ -55,29 +55,16 @@ function buildClusterRemoteInfo (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clusterRemoteInfo(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClusterReroute (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.reroute](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html) request
|
||||
*
|
||||
@ -71,21 +71,10 @@ function buildClusterReroute (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clusterReroute(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClusterState (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.state](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html) request
|
||||
*
|
||||
@ -80,37 +80,22 @@ function buildClusterState (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clusterState(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['index'] != null && (params['metric'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: metric'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: metric')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildClusterStats (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [cluster.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html) request
|
||||
*
|
||||
@ -61,29 +61,16 @@ function buildClusterStats (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
clusterStats(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCount (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [count](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html) request
|
||||
*
|
||||
@ -94,29 +94,16 @@ function buildCount (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
count(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildCreate (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [create](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request
|
||||
*
|
||||
@ -77,41 +77,24 @@ function buildCreate (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
create(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: id'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildDelete (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html) request
|
||||
*
|
||||
@ -80,49 +80,30 @@ function buildDelete (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
_delete(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: id'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['id'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildDeleteByQuery (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [delete_by_query](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) request
|
||||
*
|
||||
@ -137,43 +137,26 @@ function buildDeleteByQuery (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
deleteByQuery(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildDeleteByQueryRethrottle (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [delete_by_query_rethrottle](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html) request
|
||||
*
|
||||
@ -59,41 +59,24 @@ function buildDeleteByQueryRethrottle (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
deleteByQueryRethrottle(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['task_id'] == null && params['taskId'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: task_id or taskId'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: task_id or taskId')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['requests_per_second'] == null && params['requestsPerSecond'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: requests_per_second or requestsPerSecond'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: requests_per_second or requestsPerSecond')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildDeleteScript (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [delete_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request
|
||||
*
|
||||
@ -61,35 +61,20 @@ function buildDeleteScript (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
deleteScript(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: id'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildExists (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
|
||||
*
|
||||
@ -84,41 +84,24 @@ function buildExists (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
exists(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: id'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildExistsSource (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [exists_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
|
||||
*
|
||||
@ -81,54 +81,33 @@ function buildExistsSource (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
existsSource(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: id'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['id'] != null && (params['type'] == null || params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: type, index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: type, index')
|
||||
return handleError(err, callback)
|
||||
} else if (params['type'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildExplain (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [explain](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html) request
|
||||
*
|
||||
@ -90,35 +90,20 @@ function buildExplain (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
explain(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: id'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildFieldCaps (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [field_caps](http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html) request
|
||||
*
|
||||
@ -67,29 +67,16 @@ function buildFieldCaps (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fieldCaps(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildGet (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [get](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
|
||||
*
|
||||
@ -90,41 +90,24 @@ function buildGet (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
get(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: id'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildGetScript (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [get_script](http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html) request
|
||||
*
|
||||
@ -59,35 +59,20 @@ function buildGetScript (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getScript(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: id'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildGetSource (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [get_source](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html) request
|
||||
*
|
||||
@ -81,41 +81,24 @@ function buildGetSource (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getSource(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['id'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: id'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmDeleteLifecycle (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.delete_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html) request
|
||||
*
|
||||
@ -51,29 +51,16 @@ function buildIlmDeleteLifecycle (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmDeleteLifecycle(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmExplainLifecycle (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request
|
||||
*
|
||||
@ -52,29 +52,16 @@ function buildIlmExplainLifecycle (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmExplainLifecycle(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmGetLifecycle (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.get_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html) request
|
||||
*
|
||||
@ -51,29 +51,16 @@ function buildIlmGetLifecycle (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmGetLifecycle(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmGetStatus (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.get_status](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-status.html) request
|
||||
*
|
||||
@ -50,29 +50,16 @@ function buildIlmGetStatus (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmGetStatus(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmMoveToStep (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.move_to_step](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html) request
|
||||
*
|
||||
@ -52,21 +52,10 @@ function buildIlmMoveToStep (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmMoveToStep(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmPutLifecycle (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.put_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html) request
|
||||
*
|
||||
@ -52,21 +52,10 @@ function buildIlmPutLifecycle (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmPutLifecycle(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmRemovePolicy (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.remove_policy](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-remove-policy.html) request
|
||||
*
|
||||
@ -51,29 +51,16 @@ function buildIlmRemovePolicy (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmRemovePolicy(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmRetry (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.retry](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-retry-policy.html) request
|
||||
*
|
||||
@ -51,29 +51,16 @@ function buildIlmRetry (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmRetry(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmStart (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.start](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-start.html) request
|
||||
*
|
||||
@ -50,29 +50,16 @@ function buildIlmStart (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmStart(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIlmStop (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [ilm.stop](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-stop.html) request
|
||||
*
|
||||
@ -50,29 +50,16 @@ function buildIlmStop (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ilmStop(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndex (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [index](http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) request
|
||||
*
|
||||
@ -86,43 +86,26 @@ function buildIndex (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
_index(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['id'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesAnalyze (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.analyze](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html) request
|
||||
*
|
||||
@ -59,21 +59,10 @@ function buildIndicesAnalyze (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesAnalyze(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesClearCache (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.clear_cache](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html) request
|
||||
*
|
||||
@ -75,29 +75,16 @@ function buildIndicesClearCache (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesClearCache(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesClose (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.close](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request
|
||||
*
|
||||
@ -70,35 +70,20 @@ function buildIndicesClose (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesClose(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesCreate (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.create](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html) request
|
||||
*
|
||||
@ -68,29 +68,16 @@ function buildIndicesCreate (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesCreate(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesDelete (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.delete](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html) request
|
||||
*
|
||||
@ -70,35 +70,20 @@ function buildIndicesDelete (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesDelete(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesDeleteAlias (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.delete_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request
|
||||
*
|
||||
@ -62,49 +62,30 @@ function buildIndicesDeleteAlias (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesDeleteAlias(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['name'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: name'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['name'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesDeleteTemplate (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.delete_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
|
||||
*
|
||||
@ -61,35 +61,20 @@ function buildIndicesDeleteTemplate (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesDeleteTemplate(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['name'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: name'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesExists (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.exists](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html) request
|
||||
*
|
||||
@ -73,35 +73,20 @@ function buildIndicesExists (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesExists(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesExistsAlias (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.exists_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request
|
||||
*
|
||||
@ -68,35 +68,20 @@ function buildIndicesExistsAlias (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesExistsAlias(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['name'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: name'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesExistsTemplate (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.exists_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
|
||||
*
|
||||
@ -64,35 +64,20 @@ function buildIndicesExistsTemplate (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesExistsTemplate(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['name'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: name'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesExistsType (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.exists_type](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html) request
|
||||
*
|
||||
@ -68,49 +68,30 @@ function buildIndicesExistsType (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesExistsType(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['type'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: type'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: type')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['type'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesFlush (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.flush](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html) request
|
||||
*
|
||||
@ -70,29 +70,16 @@ function buildIndicesFlush (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesFlush(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesFlushSynced (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.flush_synced](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html) request
|
||||
*
|
||||
@ -65,29 +65,16 @@ function buildIndicesFlushSynced (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesFlushSynced(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesForcemerge (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.forcemerge](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html) request
|
||||
*
|
||||
@ -73,29 +73,16 @@ function buildIndicesForcemerge (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesForcemerge(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesFreeze (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.freeze](https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html) request
|
||||
*
|
||||
@ -66,35 +66,20 @@ function buildIndicesFreeze (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesFreeze(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesGet (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.get](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html) request
|
||||
*
|
||||
@ -79,35 +79,20 @@ function buildIndicesGet (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesGet(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesGetAlias (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.get_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request
|
||||
*
|
||||
@ -68,29 +68,16 @@ function buildIndicesGetAlias (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesGetAlias(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesGetFieldMapping (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.get_field_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html) request
|
||||
*
|
||||
@ -75,35 +75,20 @@ function buildIndicesGetFieldMapping (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesGetFieldMapping(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['fields'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: fields'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: fields')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesGetMapping (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.get_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html) request
|
||||
*
|
||||
@ -74,29 +74,16 @@ function buildIndicesGetMapping (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesGetMapping(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesGetSettings (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.get_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html) request
|
||||
*
|
||||
@ -77,29 +77,16 @@ function buildIndicesGetSettings (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesGetSettings(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesGetTemplate (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.get_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
|
||||
*
|
||||
@ -67,29 +67,16 @@ function buildIndicesGetTemplate (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesGetTemplate(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesGetUpgrade (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.get_upgrade](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html) request
|
||||
*
|
||||
@ -65,29 +65,16 @@ function buildIndicesGetUpgrade (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesGetUpgrade(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesOpen (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.open](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html) request
|
||||
*
|
||||
@ -73,35 +73,20 @@ function buildIndicesOpen (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesOpen(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesPutAlias (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.put_alias](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html) request
|
||||
*
|
||||
@ -63,43 +63,26 @@ function buildIndicesPutAlias (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesPutAlias(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['name'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: name'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['name'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesPutMapping (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.put_mapping](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html) request
|
||||
*
|
||||
@ -75,29 +75,16 @@ function buildIndicesPutMapping (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesPutMapping(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesPutSettings (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.put_settings](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html) request
|
||||
*
|
||||
@ -77,29 +77,16 @@ function buildIndicesPutSettings (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesPutSettings(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesPutTemplate (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.put_template](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html) request
|
||||
*
|
||||
@ -72,35 +72,20 @@ function buildIndicesPutTemplate (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesPutTemplate(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['name'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: name'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesRecovery (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.recovery](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html) request
|
||||
*
|
||||
@ -61,29 +61,16 @@ function buildIndicesRecovery (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesRecovery(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesRefresh (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.refresh](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html) request
|
||||
*
|
||||
@ -65,29 +65,16 @@ function buildIndicesRefresh (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesRefresh(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesRollover (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.rollover](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html) request
|
||||
*
|
||||
@ -72,37 +72,22 @@ function buildIndicesRollover (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesRollover(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['alias'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: alias'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: alias')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if ((params['new_index'] != null || params['newIndex'] != null) && (params['alias'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: alias'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: alias')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesSegments (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.segments](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html) request
|
||||
*
|
||||
@ -67,29 +67,16 @@ function buildIndicesSegments (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesSegments(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesShardStores (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.shard_stores](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html) request
|
||||
*
|
||||
@ -67,29 +67,16 @@ function buildIndicesShardStores (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesShardStores(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesShrink (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.shrink](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html) request
|
||||
*
|
||||
@ -69,43 +69,26 @@ function buildIndicesShrink (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesShrink(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['target'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: target'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: target')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['target'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesSplit (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.split](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html) request
|
||||
*
|
||||
@ -69,43 +69,26 @@ function buildIndicesSplit (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesSplit(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params['index'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['target'] == null) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter: target'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter: target')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params['target'] != null && (params['index'] == null)) {
|
||||
return callback(
|
||||
new ConfigurationError('Missing required parameter of the url: index'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
function buildIndicesStats (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, result } = opts
|
||||
const { makeRequest, ConfigurationError, handleError } = opts
|
||||
/**
|
||||
* Perform a [indices.stats](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html) request
|
||||
*
|
||||
@ -74,29 +74,16 @@ function buildIndicesStats (opts) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
// promises support
|
||||
if (callback == null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
indicesStats(params, options, (err, body) => {
|
||||
err ? reject(err) : resolve(body)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// check required parameters
|
||||
if (params.body != null) {
|
||||
return callback(
|
||||
new ConfigurationError('This API does not require a body'),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError('This API does not require a body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
return callback(
|
||||
new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`),
|
||||
result
|
||||
)
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = null
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user