Skip to content

Update code generation #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions api/api/bulk.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@
function buildBulk (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [bulk](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html) request
*
* @param {string} index - Default index for items which don't provide one
* @param {string} type - Default document type for items which don't provide one
* @param {string} wait_for_active_shards - Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)
* @param {enum} refresh - If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes.
* @param {string} routing - Specific routing value
* @param {time} timeout - Explicit operation timeout
* @param {string} type - Default document type for items which don't provide one
* @param {list} _source - True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request
* @param {list} _source_excludes - Default list of fields to exclude from the returned _source field, can be overridden on each sub-request
* @param {list} _source_includes - Default list of fields to extract and return from the _source field, can be overridden on each sub-request
* @param {string} pipeline - The pipeline id to preprocess incoming documents with
* @param {object} body - The operation definition and data (action-data pairs), separated by newlines
*/

const acceptedQuerystring = [
'wait_for_active_shards',
Expand Down Expand Up @@ -56,6 +40,11 @@ function buildBulk (opts) {
filterPath: 'filter_path'
}

/**
* Perform a bulk request
* Allows to perform multiple index/update/delete operations in a single request.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html
*/
return function bulk (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
Expand Down Expand Up @@ -90,10 +79,6 @@ function buildBulk (opts) {
var { method, body, index, type, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
method = 'POST'
}

var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
Expand All @@ -102,10 +87,13 @@ function buildBulk (opts) {
var path = ''

if ((index) != null && (type) != null) {
if (method == null) method = 'POST'
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_bulk'
} else if ((index) != null) {
if (method == null) method = 'POST'
path = '/' + encodeURIComponent(index) + '/' + '_bulk'
} else {
if (method == null) method = 'POST'
path = '/' + '_bulk'
}

Expand Down
29 changes: 7 additions & 22 deletions api/api/cat.aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@
function buildCatAliases (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [cat.aliases](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html) request
*
* @param {list} name - A comma-separated list of alias names to return
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Explicit operation timeout for connection to master node
* @param {list} h - Comma-separated list of column names to display
* @param {boolean} help - Return help information
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/

const acceptedQuerystring = [
'format',
Expand All @@ -44,6 +32,11 @@ function buildCatAliases (opts) {
filterPath: 'filter_path'
}

/**
* Perform a cat.aliases request
* Shows information about currently configured aliases to indices including filter and routing infos.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html
*/
return function catAliases (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
Expand All @@ -56,12 +49,6 @@ function buildCatAliases (opts) {
options = {}
}

// check required parameters
if (params.body != null) {
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') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -72,10 +59,6 @@ function buildCatAliases (opts) {
var { method, body, name, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
method = 'GET'
}

var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
Expand All @@ -84,8 +67,10 @@ function buildCatAliases (opts) {
var path = ''

if ((name) != null) {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'aliases' + '/' + encodeURIComponent(name)
} else {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'aliases'
}

Expand Down
30 changes: 7 additions & 23 deletions api/api/cat.allocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@
function buildCatAllocation (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [cat.allocation](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html) request
*
* @param {list} node_id - A comma-separated list of node IDs or names to limit the returned information
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {enum} bytes - The unit in which to display byte values
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Explicit operation timeout for connection to master node
* @param {list} h - Comma-separated list of column names to display
* @param {boolean} help - Return help information
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/

const acceptedQuerystring = [
'format',
Expand All @@ -46,6 +33,11 @@ function buildCatAllocation (opts) {
filterPath: 'filter_path'
}

/**
* Perform a cat.allocation request
* Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html
*/
return function catAllocation (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
Expand All @@ -58,12 +50,6 @@ function buildCatAllocation (opts) {
options = {}
}

// check required parameters
if (params.body != null) {
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') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -74,10 +60,6 @@ function buildCatAllocation (opts) {
var { method, body, nodeId, node_id, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
method = 'GET'
}

var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
Expand All @@ -86,8 +68,10 @@ function buildCatAllocation (opts) {
var path = ''

if ((node_id || nodeId) != null) {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'allocation' + '/' + encodeURIComponent(node_id || nodeId)
} else {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'allocation'
}

Expand Down
29 changes: 7 additions & 22 deletions api/api/cat.count.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@
function buildCatCount (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [cat.count](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html) request
*
* @param {list} index - A comma-separated list of index names to limit the returned information
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Explicit operation timeout for connection to master node
* @param {list} h - Comma-separated list of column names to display
* @param {boolean} help - Return help information
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
*/

const acceptedQuerystring = [
'format',
Expand All @@ -44,6 +32,11 @@ function buildCatCount (opts) {
filterPath: 'filter_path'
}

/**
* Perform a cat.count request
* Provides quick access to the document count of the entire cluster, or individual indices.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html
*/
return function catCount (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
Expand All @@ -56,12 +49,6 @@ function buildCatCount (opts) {
options = {}
}

// check required parameters
if (params.body != null) {
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') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -72,10 +59,6 @@ function buildCatCount (opts) {
var { method, body, index, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
method = 'GET'
}

var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
Expand All @@ -84,8 +67,10 @@ function buildCatCount (opts) {
var path = ''

if ((index) != null) {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'count' + '/' + encodeURIComponent(index)
} else {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'count'
}

Expand Down
31 changes: 7 additions & 24 deletions api/api/cat.fielddata.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@
function buildCatFielddata (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [cat.fielddata](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html) request
*
* @param {list} fields - A comma-separated list of fields to return the fielddata size
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {enum} bytes - The unit in which to display byte values
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Explicit operation timeout for connection to master node
* @param {list} h - Comma-separated list of column names to display
* @param {boolean} help - Return help information
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} v - Verbose mode. Display column headers
* @param {list} fields - A comma-separated list of fields to return in the output
*/

const acceptedQuerystring = [
'format',
Expand All @@ -48,6 +34,11 @@ function buildCatFielddata (opts) {
filterPath: 'filter_path'
}

/**
* Perform a cat.fielddata request
* Shows how much heap memory is currently being used by fielddata on every data node in the cluster.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html
*/
return function catFielddata (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
Expand All @@ -60,12 +51,6 @@ function buildCatFielddata (opts) {
options = {}
}

// check required parameters
if (params.body != null) {
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') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -76,10 +61,6 @@ function buildCatFielddata (opts) {
var { method, body, fields, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
method = 'GET'
}

var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
Expand All @@ -88,8 +69,10 @@ function buildCatFielddata (opts) {
var path = ''

if ((fields) != null) {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'fielddata' + '/' + encodeURIComponent(fields)
} else {
if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'fielddata'
}

Expand Down
28 changes: 6 additions & 22 deletions api/api/cat.health.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@
function buildCatHealth (opts) {
// eslint-disable-next-line no-unused-vars
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
/**
* Perform a [cat.health](https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html) request
*
* @param {string} format - a short version of the Accept header, e.g. json, yaml
* @param {boolean} local - Return local information, do not retrieve the state from master node (default: false)
* @param {time} master_timeout - Explicit operation timeout for connection to master node
* @param {list} h - Comma-separated list of column names to display
* @param {boolean} help - Return help information
* @param {list} s - Comma-separated list of column names or column aliases to sort by
* @param {boolean} ts - Set to false to disable timestamping
* @param {boolean} v - Verbose mode. Display column headers
*/

const acceptedQuerystring = [
'format',
Expand All @@ -45,6 +33,11 @@ function buildCatHealth (opts) {
filterPath: 'filter_path'
}

/**
* Perform a cat.health request
* Returns a concise representation of the cluster health.
* https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html
*/
return function catHealth (params, options, callback) {
options = options || {}
if (typeof options === 'function') {
Expand All @@ -57,12 +50,6 @@ function buildCatHealth (opts) {
options = {}
}

// check required parameters
if (params.body != null) {
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') {
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
Expand All @@ -73,17 +60,14 @@ function buildCatHealth (opts) {
var { method, body, ...querystring } = params
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)

if (method == null) {
method = 'GET'
}

var ignore = options.ignore
if (typeof ignore === 'number') {
options.ignore = [ignore]
}

var path = ''

if (method == null) method = 'GET'
path = '/' + '_cat' + '/' + 'health'

// build request object
Expand Down
Loading