diff --git a/api/api/xpack.graph.explore.js b/api/api/xpack.graph.explore.js new file mode 100644 index 000000000..b8d593eb9 --- /dev/null +++ b/api/api/xpack.graph.explore.js @@ -0,0 +1,98 @@ +'use strict' + +function buildXpackGraphExplore (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.graph.explore](https://www.elastic.co/guide/en/elasticsearch/reference/current/graph-explore-api.html) request + * + * @param {list} index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {list} type - A comma-separated list of document types to search; leave empty to perform the operation on all types + * @param {string} routing - Specific routing value + * @param {time} timeout - Explicit operation timeout + * @param {object} body - Graph Query DSL + */ + return function xpackGraphExplore (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackGraphExplore(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'routing', + 'timeout' + ] + const acceptedQuerystringCamelCased = [ + 'routing', + 'timeout' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = [params['index'], params['type'], '_xpack', 'graph', '_explore'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackGraphExplore diff --git a/api/api/xpack.info.js b/api/api/xpack.info.js new file mode 100644 index 000000000..a70a56199 --- /dev/null +++ b/api/api/xpack.info.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackInfo (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.info](https://www.elastic.co/guide/en/elasticsearch/reference/current/info-api.html) request + * + * @param {list} categories - Comma-separated list of info categories. Can be any of: build, license, features + */ + return function xpackInfo (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackInfo(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'categories' + ] + const acceptedQuerystringCamelCased = [ + 'categories' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackInfo diff --git a/api/api/xpack.license.delete.js b/api/api/xpack.license.delete.js new file mode 100644 index 000000000..426fed0da --- /dev/null +++ b/api/api/xpack.license.delete.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackLicenseDelete (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.license.delete](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * + */ + return function xpackLicenseDelete (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicenseDelete(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'license'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackLicenseDelete diff --git a/api/api/xpack.license.get.js b/api/api/xpack.license.get.js new file mode 100644 index 000000000..d0fd1956e --- /dev/null +++ b/api/api/xpack.license.get.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackLicenseGet (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.license.get](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * + * @param {boolean} local - Return local information, do not retrieve the state from master node (default: false) + */ + return function xpackLicenseGet (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicenseGet(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'local' + ] + const acceptedQuerystringCamelCased = [ + 'local' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'license'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackLicenseGet diff --git a/api/api/xpack.license.get_basic_status.js b/api/api/xpack.license.get_basic_status.js new file mode 100644 index 000000000..815d66869 --- /dev/null +++ b/api/api/xpack.license.get_basic_status.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackLicenseGetBasicStatus (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.license.get_basic_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * + */ + return function xpackLicenseGetBasicStatus (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicenseGetBasicStatus(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'license', 'basic_status'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackLicenseGetBasicStatus diff --git a/api/api/xpack.license.get_trial_status.js b/api/api/xpack.license.get_trial_status.js new file mode 100644 index 000000000..107541302 --- /dev/null +++ b/api/api/xpack.license.get_trial_status.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackLicenseGetTrialStatus (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.license.get_trial_status](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * + */ + return function xpackLicenseGetTrialStatus (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicenseGetTrialStatus(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'license', 'trial_status'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackLicenseGetTrialStatus diff --git a/api/api/xpack.license.post.js b/api/api/xpack.license.post.js new file mode 100644 index 000000000..7515db686 --- /dev/null +++ b/api/api/xpack.license.post.js @@ -0,0 +1,85 @@ +'use strict' + +function buildXpackLicensePost (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.license.post](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * + * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) + * @param {object} body - licenses to be installed + */ + return function xpackLicensePost (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicensePost(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'acknowledge' + ] + const acceptedQuerystringCamelCased = [ + 'acknowledge' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'license'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackLicensePost diff --git a/api/api/xpack.license.post_start_basic.js b/api/api/xpack.license.post_start_basic.js new file mode 100644 index 000000000..969690525 --- /dev/null +++ b/api/api/xpack.license.post_start_basic.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackLicensePostStartBasic (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.license.post_start_basic](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * + * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) + */ + return function xpackLicensePostStartBasic (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicensePostStartBasic(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'acknowledge' + ] + const acceptedQuerystringCamelCased = [ + 'acknowledge' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'license', 'start_basic'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackLicensePostStartBasic diff --git a/api/api/xpack.license.post_start_trial.js b/api/api/xpack.license.post_start_trial.js new file mode 100644 index 000000000..43ae9b6f3 --- /dev/null +++ b/api/api/xpack.license.post_start_trial.js @@ -0,0 +1,95 @@ +'use strict' + +function buildXpackLicensePostStartTrial (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.license.post_start_trial](https://www.elastic.co/guide/en/x-pack/current/license-management.html) request + * + * @param {string} type - The type of trial license to generate (default: "trial") + * @param {boolean} acknowledge - whether the user has acknowledged acknowledge messages (default: false) + */ + return function xpackLicensePostStartTrial (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackLicensePostStartTrial(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'type', + 'acknowledge' + ] + const acceptedQuerystringCamelCased = [ + 'type', + 'acknowledge' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'license', 'start_trial'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackLicensePostStartTrial diff --git a/api/api/xpack.migration.deprecations.js b/api/api/xpack.migration.deprecations.js new file mode 100644 index 000000000..a507a9bd7 --- /dev/null +++ b/api/api/xpack.migration.deprecations.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackMigrationDeprecations (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.migration.deprecations](http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html) request + * + * @param {string} index - Index pattern + */ + return function xpackMigrationDeprecations (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMigrationDeprecations(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = [params['index'], '_xpack', 'migration', 'deprecations'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMigrationDeprecations diff --git a/api/api/xpack.migration.get_assistance.js b/api/api/xpack.migration.get_assistance.js new file mode 100644 index 000000000..be8fddaac --- /dev/null +++ b/api/api/xpack.migration.get_assistance.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackMigrationGetAssistance (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.migration.get_assistance](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-assistance.html) request + * + * @param {list} index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {boolean} allow_no_indices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {enum} expand_wildcards - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {boolean} ignore_unavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + */ + return function xpackMigrationGetAssistance (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMigrationGetAssistance(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'allow_no_indices', + 'expand_wildcards', + 'ignore_unavailable' + ] + const acceptedQuerystringCamelCased = [ + 'allowNoIndices', + 'expandWildcards', + 'ignoreUnavailable' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'migration', 'assistance', params['index']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMigrationGetAssistance diff --git a/api/api/xpack.migration.upgrade.js b/api/api/xpack.migration.upgrade.js new file mode 100644 index 000000000..555395a99 --- /dev/null +++ b/api/api/xpack.migration.upgrade.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackMigrationUpgrade (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.migration.upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html) request + * + * @param {string} index - The name of the index + * @param {boolean} wait_for_completion - Should the request block until the upgrade operation is completed + */ + return function xpackMigrationUpgrade (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMigrationUpgrade(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['index'] == null) { + return callback( + new ConfigurationError('Missing required parameter: index'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'wait_for_completion' + ] + const acceptedQuerystringCamelCased = [ + 'waitForCompletion' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'migration', 'upgrade', params['index']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMigrationUpgrade diff --git a/api/api/xpack.ml.close_job.js b/api/api/xpack.ml.close_job.js new file mode 100644 index 000000000..ea7393029 --- /dev/null +++ b/api/api/xpack.ml.close_job.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlCloseJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.close_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html) request + * + * @param {string} job_id - The name of the job to close + * @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + * @param {boolean} force - True if the job should be forcefully closed + * @param {time} timeout - Controls the time to wait until a job has closed. Default to 30 minutes + */ + return function xpackMlCloseJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlCloseJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'allow_no_jobs', + 'force', + 'timeout' + ] + const acceptedQuerystringCamelCased = [ + 'allowNoJobs', + 'force', + 'timeout' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], '_close'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlCloseJob diff --git a/api/api/xpack.ml.delete_calendar.js b/api/api/xpack.ml.delete_calendar.js new file mode 100644 index 000000000..56aad8467 --- /dev/null +++ b/api/api/xpack.ml.delete_calendar.js @@ -0,0 +1,98 @@ +'use strict' + +function buildXpackMlDeleteCalendar (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.delete_calendar](undefined) request + * + * @param {string} calendar_id - The ID of the calendar to delete + */ + return function xpackMlDeleteCalendar (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteCalendar(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['calendar_id'] == null && params['calendarId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: calendar_id or calendarId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'calendars', params['calendar_id'] || params['calendarId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlDeleteCalendar diff --git a/api/api/xpack.ml.delete_calendar_event.js b/api/api/xpack.ml.delete_calendar_event.js new file mode 100644 index 000000000..32e06da23 --- /dev/null +++ b/api/api/xpack.ml.delete_calendar_event.js @@ -0,0 +1,113 @@ +'use strict' + +function buildXpackMlDeleteCalendarEvent (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.delete_calendar_event](undefined) request + * + * @param {string} calendar_id - The ID of the calendar to modify + * @param {string} event_id - The ID of the event to remove from the calendar + */ + return function xpackMlDeleteCalendarEvent (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteCalendarEvent(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['calendar_id'] == null && params['calendarId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: calendar_id or calendarId'), + result + ) + } + if (params['event_id'] == null && params['eventId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: event_id or eventId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // check required url components + if ((params['event_id'] != null || params['eventId'] != null) && ((params['calendar_id'] == null || params['calendarId']))) { + return callback( + new ConfigurationError('Missing required parameter of the url: calendar_id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'calendars', params['calendar_id'] || params['calendarId'], 'events', params['event_id'] || params['eventId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlDeleteCalendarEvent diff --git a/api/api/xpack.ml.delete_calendar_job.js b/api/api/xpack.ml.delete_calendar_job.js new file mode 100644 index 000000000..635366ec2 --- /dev/null +++ b/api/api/xpack.ml.delete_calendar_job.js @@ -0,0 +1,113 @@ +'use strict' + +function buildXpackMlDeleteCalendarJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.delete_calendar_job](undefined) request + * + * @param {string} calendar_id - The ID of the calendar to modify + * @param {string} job_id - The ID of the job to remove from the calendar + */ + return function xpackMlDeleteCalendarJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteCalendarJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['calendar_id'] == null && params['calendarId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: calendar_id or calendarId'), + result + ) + } + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // check required url components + if ((params['job_id'] != null || params['jobId'] != null) && ((params['calendar_id'] == null || params['calendarId']))) { + return callback( + new ConfigurationError('Missing required parameter of the url: calendar_id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'calendars', params['calendar_id'] || params['calendarId'], 'jobs', params['job_id'] || params['jobId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlDeleteCalendarJob diff --git a/api/api/xpack.ml.delete_datafeed.js b/api/api/xpack.ml.delete_datafeed.js new file mode 100644 index 000000000..1e9b79b23 --- /dev/null +++ b/api/api/xpack.ml.delete_datafeed.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlDeleteDatafeed (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.delete_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html) request + * + * @param {string} datafeed_id - The ID of the datafeed to delete + * @param {boolean} force - True if the datafeed should be forcefully deleted + */ + return function xpackMlDeleteDatafeed (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteDatafeed(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['datafeed_id'] == null && params['datafeedId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'force' + ] + const acceptedQuerystringCamelCased = [ + 'force' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'datafeeds', params['datafeed_id'] || params['datafeedId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlDeleteDatafeed diff --git a/api/api/xpack.ml.delete_expired_data.js b/api/api/xpack.ml.delete_expired_data.js new file mode 100644 index 000000000..245ab4209 --- /dev/null +++ b/api/api/xpack.ml.delete_expired_data.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackMlDeleteExpiredData (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.delete_expired_data](undefined) request + * + */ + return function xpackMlDeleteExpiredData (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteExpiredData(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', '_delete_expired_data'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlDeleteExpiredData diff --git a/api/api/xpack.ml.delete_filter.js b/api/api/xpack.ml.delete_filter.js new file mode 100644 index 000000000..5bb5c6bfc --- /dev/null +++ b/api/api/xpack.ml.delete_filter.js @@ -0,0 +1,98 @@ +'use strict' + +function buildXpackMlDeleteFilter (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.delete_filter](undefined) request + * + * @param {string} filter_id - The ID of the filter to delete + */ + return function xpackMlDeleteFilter (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteFilter(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['filter_id'] == null && params['filterId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: filter_id or filterId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'filters', params['filter_id'] || params['filterId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlDeleteFilter diff --git a/api/api/xpack.ml.delete_job.js b/api/api/xpack.ml.delete_job.js new file mode 100644 index 000000000..43acbbcf1 --- /dev/null +++ b/api/api/xpack.ml.delete_job.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlDeleteJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.delete_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html) request + * + * @param {string} job_id - The ID of the job to delete + * @param {boolean} force - True if the job should be forcefully deleted + */ + return function xpackMlDeleteJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'force' + ] + const acceptedQuerystringCamelCased = [ + 'force' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlDeleteJob diff --git a/api/api/xpack.ml.delete_model_snapshot.js b/api/api/xpack.ml.delete_model_snapshot.js new file mode 100644 index 000000000..668838173 --- /dev/null +++ b/api/api/xpack.ml.delete_model_snapshot.js @@ -0,0 +1,113 @@ +'use strict' + +function buildXpackMlDeleteModelSnapshot (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.delete_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html) request + * + * @param {string} job_id - The ID of the job to fetch + * @param {string} snapshot_id - The ID of the snapshot to delete + */ + return function xpackMlDeleteModelSnapshot (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlDeleteModelSnapshot(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params['snapshot_id'] == null && params['snapshotId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: snapshot_id or snapshotId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // check required url components + if ((params['snapshot_id'] != null || params['snapshotId'] != null) && ((params['job_id'] == null || params['jobId']))) { + return callback( + new ConfigurationError('Missing required parameter of the url: job_id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], 'model_snapshots', params['snapshot_id'] || params['snapshotId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlDeleteModelSnapshot diff --git a/api/api/xpack.ml.flush_job.js b/api/api/xpack.ml.flush_job.js new file mode 100644 index 000000000..a44363b8b --- /dev/null +++ b/api/api/xpack.ml.flush_job.js @@ -0,0 +1,106 @@ +'use strict' + +function buildXpackMlFlushJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.flush_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html) request + * + * @param {string} job_id - The name of the job to flush + * @param {boolean} calc_interim - Calculates interim results for the most recent bucket or all buckets within the latency period + * @param {string} start - When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results + * @param {string} end - When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results + * @param {string} advance_time - Advances time to the given value generating results and updating the model for the advanced interval + * @param {string} skip_time - Skips time to the given value without generating results or updating the model for the skipped interval + * @param {object} body - Flush parameters + */ + return function xpackMlFlushJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlFlushJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'calc_interim', + 'start', + 'end', + 'advance_time', + 'skip_time' + ] + const acceptedQuerystringCamelCased = [ + 'calcInterim', + 'start', + 'end', + 'advanceTime', + 'skipTime' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], '_flush'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlFlushJob diff --git a/api/api/xpack.ml.forecast.js b/api/api/xpack.ml.forecast.js new file mode 100644 index 000000000..d30400f26 --- /dev/null +++ b/api/api/xpack.ml.forecast.js @@ -0,0 +1,102 @@ +'use strict' + +function buildXpackMlForecast (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.forecast](undefined) request + * + * @param {string} job_id - The ID of the job to forecast for + * @param {time} duration - The duration of the forecast + * @param {time} expires_in - The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity. + */ + return function xpackMlForecast (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlForecast(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'duration', + 'expires_in' + ] + const acceptedQuerystringCamelCased = [ + 'duration', + 'expiresIn' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], '_forecast'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlForecast diff --git a/api/api/xpack.ml.get_buckets.js b/api/api/xpack.ml.get_buckets.js new file mode 100644 index 000000000..f9437281b --- /dev/null +++ b/api/api/xpack.ml.get_buckets.js @@ -0,0 +1,127 @@ +'use strict' + +function buildXpackMlGetBuckets (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html) request + * + * @param {string} job_id - ID of the job to get bucket results from + * @param {string} timestamp - The timestamp of the desired single bucket result + * @param {boolean} expand - Include anomaly records + * @param {boolean} exclude_interim - Exclude interim results + * @param {int} from - skips a number of buckets + * @param {int} size - specifies a max number of buckets to get + * @param {string} start - Start time filter for buckets + * @param {string} end - End time filter for buckets + * @param {double} anomaly_score - Filter for the most anomalous buckets + * @param {string} sort - Sort buckets by a particular field + * @param {boolean} desc - Set the sort direction + * @param {object} body - Bucket selection details if not provided in URI + */ + return function xpackMlGetBuckets (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetBuckets(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + + // check required url components + if (params['timestamp'] != null && ((params['job_id'] == null || params['jobId']))) { + return callback( + new ConfigurationError('Missing required parameter of the url: job_id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'expand', + 'exclude_interim', + 'from', + 'size', + 'start', + 'end', + 'anomaly_score', + 'sort', + 'desc' + ] + const acceptedQuerystringCamelCased = [ + 'expand', + 'excludeInterim', + 'from', + 'size', + 'start', + 'end', + 'anomalyScore', + 'sort', + 'desc' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], 'results', 'buckets', params['timestamp']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetBuckets diff --git a/api/api/xpack.ml.get_calendar_events.js b/api/api/xpack.ml.get_calendar_events.js new file mode 100644 index 000000000..107de9318 --- /dev/null +++ b/api/api/xpack.ml.get_calendar_events.js @@ -0,0 +1,111 @@ +'use strict' + +function buildXpackMlGetCalendarEvents (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_calendar_events](undefined) request + * + * @param {string} calendar_id - The ID of the calendar containing the events + * @param {string} job_id - Get events for the job. When this option is used calendar_id must be '_all' + * @param {string} start - Get events after this time + * @param {date} end - Get events before this time + * @param {int} from - Skips a number of events + * @param {int} size - Specifies a max number of events to get + */ + return function xpackMlGetCalendarEvents (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetCalendarEvents(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['calendar_id'] == null && params['calendarId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: calendar_id or calendarId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'job_id', + 'start', + 'end', + 'from', + 'size' + ] + const acceptedQuerystringCamelCased = [ + 'jobId', + 'start', + 'end', + 'from', + 'size' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'calendars', params['calendar_id'] || params['calendarId'], 'events'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetCalendarEvents diff --git a/api/api/xpack.ml.get_calendars.js b/api/api/xpack.ml.get_calendars.js new file mode 100644 index 000000000..c856066de --- /dev/null +++ b/api/api/xpack.ml.get_calendars.js @@ -0,0 +1,96 @@ +'use strict' + +function buildXpackMlGetCalendars (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_calendars](undefined) request + * + * @param {string} calendar_id - The ID of the calendar to fetch + * @param {int} from - skips a number of calendars + * @param {int} size - specifies a max number of calendars to get + */ + return function xpackMlGetCalendars (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetCalendars(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'from', + 'size' + ] + const acceptedQuerystringCamelCased = [ + 'from', + 'size' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'calendars', params['calendar_id'] || params['calendarId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetCalendars diff --git a/api/api/xpack.ml.get_categories.js b/api/api/xpack.ml.get_categories.js new file mode 100644 index 000000000..1cabd11c0 --- /dev/null +++ b/api/api/xpack.ml.get_categories.js @@ -0,0 +1,100 @@ +'use strict' + +function buildXpackMlGetCategories (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_categories](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html) request + * + * @param {string} job_id - The name of the job + * @param {long} category_id - The identifier of the category definition of interest + * @param {int} from - skips a number of categories + * @param {int} size - specifies a max number of categories to get + * @param {object} body - Category selection details if not provided in URI + */ + return function xpackMlGetCategories (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetCategories(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'from', + 'size' + ] + const acceptedQuerystringCamelCased = [ + 'from', + 'size' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], 'results', 'categories'] + const request = { + method, + path: (params['job_id'] || params['jobId']) != null + ? '/' + parts.filter(Boolean).map(encodeURIComponent).join('/') + : '/_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}', + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetCategories diff --git a/api/api/xpack.ml.get_datafeed_stats.js b/api/api/xpack.ml.get_datafeed_stats.js new file mode 100644 index 000000000..645fcba71 --- /dev/null +++ b/api/api/xpack.ml.get_datafeed_stats.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackMlGetDatafeedStats (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_datafeed_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html) request + * + * @param {string} datafeed_id - The ID of the datafeeds stats to fetch + * @param {boolean} allow_no_datafeeds - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + */ + return function xpackMlGetDatafeedStats (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetDatafeedStats(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'allow_no_datafeeds' + ] + const acceptedQuerystringCamelCased = [ + 'allowNoDatafeeds' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'datafeeds', params['datafeed_id'] || params['datafeedId'], '_stats'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetDatafeedStats diff --git a/api/api/xpack.ml.get_datafeeds.js b/api/api/xpack.ml.get_datafeeds.js new file mode 100644 index 000000000..d491d3191 --- /dev/null +++ b/api/api/xpack.ml.get_datafeeds.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackMlGetDatafeeds (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_datafeeds](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html) request + * + * @param {string} datafeed_id - The ID of the datafeeds to fetch + * @param {boolean} allow_no_datafeeds - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + */ + return function xpackMlGetDatafeeds (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetDatafeeds(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'allow_no_datafeeds' + ] + const acceptedQuerystringCamelCased = [ + 'allowNoDatafeeds' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'datafeeds', params['datafeed_id'] || params['datafeedId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetDatafeeds diff --git a/api/api/xpack.ml.get_filters.js b/api/api/xpack.ml.get_filters.js new file mode 100644 index 000000000..f1ff13d1d --- /dev/null +++ b/api/api/xpack.ml.get_filters.js @@ -0,0 +1,96 @@ +'use strict' + +function buildXpackMlGetFilters (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_filters](undefined) request + * + * @param {string} filter_id - The ID of the filter to fetch + * @param {int} from - skips a number of filters + * @param {int} size - specifies a max number of filters to get + */ + return function xpackMlGetFilters (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetFilters(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'from', + 'size' + ] + const acceptedQuerystringCamelCased = [ + 'from', + 'size' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'filters', params['filter_id'] || params['filterId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetFilters diff --git a/api/api/xpack.ml.get_influencers.js b/api/api/xpack.ml.get_influencers.js new file mode 100644 index 000000000..4dc4c7b89 --- /dev/null +++ b/api/api/xpack.ml.get_influencers.js @@ -0,0 +1,115 @@ +'use strict' + +function buildXpackMlGetInfluencers (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_influencers](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html) request + * + * @param {string} job_id - + * @param {boolean} exclude_interim - Exclude interim results + * @param {int} from - skips a number of influencers + * @param {int} size - specifies a max number of influencers to get + * @param {string} start - start timestamp for the requested influencers + * @param {string} end - end timestamp for the requested influencers + * @param {double} influencer_score - influencer score threshold for the requested influencers + * @param {string} sort - sort field for the requested influencers + * @param {boolean} desc - whether the results should be sorted in decending order + * @param {object} body - Influencer selection criteria + */ + return function xpackMlGetInfluencers (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetInfluencers(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'exclude_interim', + 'from', + 'size', + 'start', + 'end', + 'influencer_score', + 'sort', + 'desc' + ] + const acceptedQuerystringCamelCased = [ + 'excludeInterim', + 'from', + 'size', + 'start', + 'end', + 'influencerScore', + 'sort', + 'desc' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], 'results', 'influencers'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetInfluencers diff --git a/api/api/xpack.ml.get_job_stats.js b/api/api/xpack.ml.get_job_stats.js new file mode 100644 index 000000000..7ee5f78c0 --- /dev/null +++ b/api/api/xpack.ml.get_job_stats.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackMlGetJobStats (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_job_stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html) request + * + * @param {string} job_id - The ID of the jobs stats to fetch + * @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + */ + return function xpackMlGetJobStats (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetJobStats(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'allow_no_jobs' + ] + const acceptedQuerystringCamelCased = [ + 'allowNoJobs' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], '_stats'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetJobStats diff --git a/api/api/xpack.ml.get_jobs.js b/api/api/xpack.ml.get_jobs.js new file mode 100644 index 000000000..bf4abf901 --- /dev/null +++ b/api/api/xpack.ml.get_jobs.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackMlGetJobs (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_jobs](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html) request + * + * @param {string} job_id - The ID of the jobs to fetch + * @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + */ + return function xpackMlGetJobs (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetJobs(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'allow_no_jobs' + ] + const acceptedQuerystringCamelCased = [ + 'allowNoJobs' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetJobs diff --git a/api/api/xpack.ml.get_model_snapshots.js b/api/api/xpack.ml.get_model_snapshots.js new file mode 100644 index 000000000..345daf48f --- /dev/null +++ b/api/api/xpack.ml.get_model_snapshots.js @@ -0,0 +1,118 @@ +'use strict' + +function buildXpackMlGetModelSnapshots (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_model_snapshots](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html) request + * + * @param {string} job_id - The ID of the job to fetch + * @param {string} snapshot_id - The ID of the snapshot to fetch + * @param {int} from - Skips a number of documents + * @param {int} size - The default number of documents returned in queries as a string. + * @param {date} start - The filter 'start' query parameter + * @param {date} end - The filter 'end' query parameter + * @param {string} sort - Name of the field to sort on + * @param {boolean} desc - True if the results should be sorted in descending order + * @param {object} body - Model snapshot selection criteria + */ + return function xpackMlGetModelSnapshots (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetModelSnapshots(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + + // check required url components + if ((params['snapshot_id'] != null || params['snapshotId'] != null) && ((params['job_id'] == null || params['jobId']))) { + return callback( + new ConfigurationError('Missing required parameter of the url: job_id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'from', + 'size', + 'start', + 'end', + 'sort', + 'desc' + ] + const acceptedQuerystringCamelCased = [ + 'from', + 'size', + 'start', + 'end', + 'sort', + 'desc' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], 'model_snapshots', params['snapshot_id'] || params['snapshotId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetModelSnapshots diff --git a/api/api/xpack.ml.get_overall_buckets.js b/api/api/xpack.ml.get_overall_buckets.js new file mode 100644 index 000000000..20a13e767 --- /dev/null +++ b/api/api/xpack.ml.get_overall_buckets.js @@ -0,0 +1,112 @@ +'use strict' + +function buildXpackMlGetOverallBuckets (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_overall_buckets](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html) request + * + * @param {string} job_id - The job IDs for which to calculate overall bucket results + * @param {int} top_n - The number of top job bucket scores to be used in the overall_score calculation + * @param {string} bucket_span - The span of the overall buckets. Defaults to the longest job bucket_span + * @param {double} overall_score - Returns overall buckets with overall scores higher than this value + * @param {boolean} exclude_interim - If true overall buckets that include interim buckets will be excluded + * @param {string} start - Returns overall buckets with timestamps after this time + * @param {string} end - Returns overall buckets with timestamps earlier than this time + * @param {boolean} allow_no_jobs - Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified) + * @param {object} body - Overall bucket selection details if not provided in URI + */ + return function xpackMlGetOverallBuckets (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetOverallBuckets(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'top_n', + 'bucket_span', + 'overall_score', + 'exclude_interim', + 'start', + 'end', + 'allow_no_jobs' + ] + const acceptedQuerystringCamelCased = [ + 'topN', + 'bucketSpan', + 'overallScore', + 'excludeInterim', + 'start', + 'end', + 'allowNoJobs' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], 'results', 'overall_buckets'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetOverallBuckets diff --git a/api/api/xpack.ml.get_records.js b/api/api/xpack.ml.get_records.js new file mode 100644 index 000000000..4717cbc9c --- /dev/null +++ b/api/api/xpack.ml.get_records.js @@ -0,0 +1,115 @@ +'use strict' + +function buildXpackMlGetRecords (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.get_records](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html) request + * + * @param {string} job_id - + * @param {boolean} exclude_interim - Exclude interim results + * @param {int} from - skips a number of records + * @param {int} size - specifies a max number of records to get + * @param {string} start - Start time filter for records + * @param {string} end - End time filter for records + * @param {double} record_score - + * @param {string} sort - Sort records by a particular field + * @param {boolean} desc - Set the sort direction + * @param {object} body - Record selection criteria + */ + return function xpackMlGetRecords (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlGetRecords(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'exclude_interim', + 'from', + 'size', + 'start', + 'end', + 'record_score', + 'sort', + 'desc' + ] + const acceptedQuerystringCamelCased = [ + 'excludeInterim', + 'from', + 'size', + 'start', + 'end', + 'recordScore', + 'sort', + 'desc' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], 'results', 'records'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlGetRecords diff --git a/api/api/xpack.ml.info.js b/api/api/xpack.ml.info.js new file mode 100644 index 000000000..6691fbb1f --- /dev/null +++ b/api/api/xpack.ml.info.js @@ -0,0 +1,83 @@ +'use strict' + +function buildXpackMlInfo (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.info](undefined) request + * + */ + return function xpackMlInfo (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlInfo(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'info'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlInfo diff --git a/api/api/xpack.ml.open_job.js b/api/api/xpack.ml.open_job.js new file mode 100644 index 000000000..19a1febcb --- /dev/null +++ b/api/api/xpack.ml.open_job.js @@ -0,0 +1,100 @@ +'use strict' + +function buildXpackMlOpenJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.open_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html) request + * + * @param {string} job_id - The ID of the job to open + * @param {boolean} ignore_downtime - Controls if gaps in data are treated as anomalous or as a maintenance window after a job re-start + * @param {time} timeout - Controls the time to wait until a job has opened. Default to 30 minutes + */ + return function xpackMlOpenJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlOpenJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], '_open'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlOpenJob diff --git a/api/api/xpack.ml.post_calendar_events.js b/api/api/xpack.ml.post_calendar_events.js new file mode 100644 index 000000000..c9868a8e2 --- /dev/null +++ b/api/api/xpack.ml.post_calendar_events.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlPostCalendarEvents (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.post_calendar_events](undefined) request + * + * @param {string} calendar_id - The ID of the calendar to modify + * @param {object} body - A list of events + */ + return function xpackMlPostCalendarEvents (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPostCalendarEvents(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['calendar_id'] == null && params['calendarId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: calendar_id or calendarId'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'calendars', params['calendar_id'] || params['calendarId'], 'events'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlPostCalendarEvents diff --git a/api/api/xpack.ml.post_data.js b/api/api/xpack.ml.post_data.js new file mode 100644 index 000000000..f5a0fe3b6 --- /dev/null +++ b/api/api/xpack.ml.post_data.js @@ -0,0 +1,103 @@ +'use strict' + +function buildXpackMlPostData (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.post_data](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html) request + * + * @param {string} job_id - The name of the job receiving the data + * @param {string} reset_start - Optional parameter to specify the start of the bucket resetting range + * @param {string} reset_end - Optional parameter to specify the end of the bucket resetting range + * @param {object} body - The data to process + */ + return function xpackMlPostData (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPostData(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'reset_start', + 'reset_end' + ] + const acceptedQuerystringCamelCased = [ + 'resetStart', + 'resetEnd' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], '_data'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlPostData diff --git a/api/api/xpack.ml.preview_datafeed.js b/api/api/xpack.ml.preview_datafeed.js new file mode 100644 index 000000000..050790b32 --- /dev/null +++ b/api/api/xpack.ml.preview_datafeed.js @@ -0,0 +1,98 @@ +'use strict' + +function buildXpackMlPreviewDatafeed (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.preview_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html) request + * + * @param {string} datafeed_id - The ID of the datafeed to preview + */ + return function xpackMlPreviewDatafeed (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPreviewDatafeed(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['datafeed_id'] == null && params['datafeedId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'datafeeds', params['datafeed_id'] || params['datafeedId'], '_preview'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlPreviewDatafeed diff --git a/api/api/xpack.ml.put_calendar.js b/api/api/xpack.ml.put_calendar.js new file mode 100644 index 000000000..b4299a313 --- /dev/null +++ b/api/api/xpack.ml.put_calendar.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackMlPutCalendar (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.put_calendar](undefined) request + * + * @param {string} calendar_id - The ID of the calendar to create + * @param {object} body - The calendar details + */ + return function xpackMlPutCalendar (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutCalendar(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['calendar_id'] == null && params['calendarId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: calendar_id or calendarId'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'calendars', params['calendar_id'] || params['calendarId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlPutCalendar diff --git a/api/api/xpack.ml.put_calendar_job.js b/api/api/xpack.ml.put_calendar_job.js new file mode 100644 index 000000000..3345d2e02 --- /dev/null +++ b/api/api/xpack.ml.put_calendar_job.js @@ -0,0 +1,113 @@ +'use strict' + +function buildXpackMlPutCalendarJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.put_calendar_job](undefined) request + * + * @param {string} calendar_id - The ID of the calendar to modify + * @param {string} job_id - The ID of the job to add to the calendar + */ + return function xpackMlPutCalendarJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutCalendarJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['calendar_id'] == null && params['calendarId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: calendar_id or calendarId'), + result + ) + } + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // check required url components + if ((params['job_id'] != null || params['jobId'] != null) && ((params['calendar_id'] == null || params['calendarId']))) { + return callback( + new ConfigurationError('Missing required parameter of the url: calendar_id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'calendars', params['calendar_id'] || params['calendarId'], 'jobs', params['job_id'] || params['jobId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlPutCalendarJob diff --git a/api/api/xpack.ml.put_datafeed.js b/api/api/xpack.ml.put_datafeed.js new file mode 100644 index 000000000..69b66d351 --- /dev/null +++ b/api/api/xpack.ml.put_datafeed.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlPutDatafeed (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.put_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html) request + * + * @param {string} datafeed_id - The ID of the datafeed to create + * @param {object} body - The datafeed config + */ + return function xpackMlPutDatafeed (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutDatafeed(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['datafeed_id'] == null && params['datafeedId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'datafeeds', params['datafeed_id'] || params['datafeedId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlPutDatafeed diff --git a/api/api/xpack.ml.put_filter.js b/api/api/xpack.ml.put_filter.js new file mode 100644 index 000000000..20e0788c1 --- /dev/null +++ b/api/api/xpack.ml.put_filter.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlPutFilter (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.put_filter](undefined) request + * + * @param {string} filter_id - The ID of the filter to create + * @param {object} body - The filter details + */ + return function xpackMlPutFilter (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutFilter(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['filter_id'] == null && params['filterId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: filter_id or filterId'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'filters', params['filter_id'] || params['filterId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlPutFilter diff --git a/api/api/xpack.ml.put_job.js b/api/api/xpack.ml.put_job.js new file mode 100644 index 000000000..80753e7cc --- /dev/null +++ b/api/api/xpack.ml.put_job.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlPutJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.put_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html) request + * + * @param {string} job_id - The ID of the job to create + * @param {object} body - The job + */ + return function xpackMlPutJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlPutJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlPutJob diff --git a/api/api/xpack.ml.revert_model_snapshot.js b/api/api/xpack.ml.revert_model_snapshot.js new file mode 100644 index 000000000..a4bd7cabc --- /dev/null +++ b/api/api/xpack.ml.revert_model_snapshot.js @@ -0,0 +1,109 @@ +'use strict' + +function buildXpackMlRevertModelSnapshot (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.revert_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html) request + * + * @param {string} job_id - The ID of the job to fetch + * @param {string} snapshot_id - The ID of the snapshot to revert to + * @param {boolean} delete_intervening_results - Should we reset the results back to the time of the snapshot? + * @param {object} body - Reversion options + */ + return function xpackMlRevertModelSnapshot (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlRevertModelSnapshot(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params['snapshot_id'] == null && params['snapshotId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: snapshot_id or snapshotId'), + result + ) + } + + // check required url components + if ((params['snapshot_id'] != null || params['snapshotId'] != null) && ((params['job_id'] == null || params['jobId']))) { + return callback( + new ConfigurationError('Missing required parameter of the url: job_id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'delete_intervening_results' + ] + const acceptedQuerystringCamelCased = [ + 'deleteInterveningResults' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], 'model_snapshots', params['snapshot_id'] || params['snapshotId'], '_revert'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlRevertModelSnapshot diff --git a/api/api/xpack.ml.start_datafeed.js b/api/api/xpack.ml.start_datafeed.js new file mode 100644 index 000000000..10f4d488d --- /dev/null +++ b/api/api/xpack.ml.start_datafeed.js @@ -0,0 +1,100 @@ +'use strict' + +function buildXpackMlStartDatafeed (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.start_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html) request + * + * @param {string} datafeed_id - The ID of the datafeed to start + * @param {string} start - The start time from where the datafeed should begin + * @param {string} end - The end time when the datafeed should stop. When not set, the datafeed continues in real time + * @param {time} timeout - Controls the time to wait until a datafeed has started. Default to 20 seconds + * @param {object} body - The start datafeed parameters + */ + return function xpackMlStartDatafeed (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlStartDatafeed(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['datafeed_id'] == null && params['datafeedId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'start', + 'end', + 'timeout' + ] + const acceptedQuerystringCamelCased = [ + 'start', + 'end', + 'timeout' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'datafeeds', params['datafeed_id'] || params['datafeedId'], '_start'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlStartDatafeed diff --git a/api/api/xpack.ml.stop_datafeed.js b/api/api/xpack.ml.stop_datafeed.js new file mode 100644 index 000000000..4381a8b6a --- /dev/null +++ b/api/api/xpack.ml.stop_datafeed.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlStopDatafeed (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.stop_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html) request + * + * @param {string} datafeed_id - The ID of the datafeed to stop + * @param {boolean} allow_no_datafeeds - Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified) + * @param {boolean} force - True if the datafeed should be forcefully stopped. + * @param {time} timeout - Controls the time to wait until a datafeed has stopped. Default to 20 seconds + */ + return function xpackMlStopDatafeed (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlStopDatafeed(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['datafeed_id'] == null && params['datafeedId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'allow_no_datafeeds', + 'force', + 'timeout' + ] + const acceptedQuerystringCamelCased = [ + 'allowNoDatafeeds', + 'force', + 'timeout' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'datafeeds', params['datafeed_id'] || params['datafeedId'], '_stop'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlStopDatafeed diff --git a/api/api/xpack.ml.update_datafeed.js b/api/api/xpack.ml.update_datafeed.js new file mode 100644 index 000000000..f3d8d424b --- /dev/null +++ b/api/api/xpack.ml.update_datafeed.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlUpdateDatafeed (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.update_datafeed](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html) request + * + * @param {string} datafeed_id - The ID of the datafeed to update + * @param {object} body - The datafeed update settings + */ + return function xpackMlUpdateDatafeed (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlUpdateDatafeed(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['datafeed_id'] == null && params['datafeedId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: datafeed_id or datafeedId'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'datafeeds', params['datafeed_id'] || params['datafeedId'], '_update'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlUpdateDatafeed diff --git a/api/api/xpack.ml.update_filter.js b/api/api/xpack.ml.update_filter.js new file mode 100644 index 000000000..8ae999c72 --- /dev/null +++ b/api/api/xpack.ml.update_filter.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlUpdateFilter (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.update_filter](undefined) request + * + * @param {string} filter_id - The ID of the filter to update + * @param {object} body - The filter update + */ + return function xpackMlUpdateFilter (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlUpdateFilter(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['filter_id'] == null && params['filterId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: filter_id or filterId'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'filters', params['filter_id'] || params['filterId'], '_update'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlUpdateFilter diff --git a/api/api/xpack.ml.update_job.js b/api/api/xpack.ml.update_job.js new file mode 100644 index 000000000..6e765d087 --- /dev/null +++ b/api/api/xpack.ml.update_job.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackMlUpdateJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.update_job](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html) request + * + * @param {string} job_id - The ID of the job to create + * @param {object} body - The job update settings + */ + return function xpackMlUpdateJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlUpdateJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], '_update'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlUpdateJob diff --git a/api/api/xpack.ml.update_model_snapshot.js b/api/api/xpack.ml.update_model_snapshot.js new file mode 100644 index 000000000..236c9e661 --- /dev/null +++ b/api/api/xpack.ml.update_model_snapshot.js @@ -0,0 +1,114 @@ +'use strict' + +function buildXpackMlUpdateModelSnapshot (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.update_model_snapshot](http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html) request + * + * @param {string} job_id - The ID of the job to fetch + * @param {string} snapshot_id - The ID of the snapshot to update + * @param {object} body - The model snapshot properties to update + */ + return function xpackMlUpdateModelSnapshot (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlUpdateModelSnapshot(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['job_id'] == null && params['jobId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: job_id or jobId'), + result + ) + } + if (params['snapshot_id'] == null && params['snapshotId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: snapshot_id or snapshotId'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // check required url components + if ((params['snapshot_id'] != null || params['snapshotId'] != null) && ((params['job_id'] == null || params['jobId']))) { + return callback( + new ConfigurationError('Missing required parameter of the url: job_id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', params['job_id'] || params['jobId'], 'model_snapshots', params['snapshot_id'] || params['snapshotId'], '_update'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlUpdateModelSnapshot diff --git a/api/api/xpack.ml.validate.js b/api/api/xpack.ml.validate.js new file mode 100644 index 000000000..edcd81e14 --- /dev/null +++ b/api/api/xpack.ml.validate.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackMlValidate (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.validate](undefined) request + * + * @param {object} body - The job config + */ + return function xpackMlValidate (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlValidate(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', '_validate'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlValidate diff --git a/api/api/xpack.ml.validate_detector.js b/api/api/xpack.ml.validate_detector.js new file mode 100644 index 000000000..312374e95 --- /dev/null +++ b/api/api/xpack.ml.validate_detector.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackMlValidateDetector (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ml.validate_detector](undefined) request + * + * @param {object} body - The detector + */ + return function xpackMlValidateDetector (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMlValidateDetector(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ml', 'anomaly_detectors', '_validate', 'detector'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMlValidateDetector diff --git a/api/api/xpack.monitoring.bulk.js b/api/api/xpack.monitoring.bulk.js new file mode 100644 index 000000000..543f9e2bc --- /dev/null +++ b/api/api/xpack.monitoring.bulk.js @@ -0,0 +1,100 @@ +'use strict' + +function buildXpackMonitoringBulk (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.monitoring.bulk](http://www.elastic.co/guide/en/monitoring/current/appendix-api-bulk.html) request + * + * @param {string} type - Default document type for items which don't provide one + * @param {string} system_id - Identifier of the monitored system + * @param {string} system_api_version - API Version of the monitored system + * @param {string} interval - Collection interval (e.g., '10s' or '10000ms') of the payload + * @param {object} body - The operation definition and data (action-data pairs), separated by newlines + */ + return function xpackMonitoringBulk (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackMonitoringBulk(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'system_id', + 'system_api_version', + 'interval' + ] + const acceptedQuerystringCamelCased = [ + 'systemId', + 'systemApiVersion', + 'interval' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'monitoring', params['type'], '_bulk'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackMonitoringBulk diff --git a/api/api/xpack.rollup.delete_job.js b/api/api/xpack.rollup.delete_job.js new file mode 100644 index 000000000..0bac5a235 --- /dev/null +++ b/api/api/xpack.rollup.delete_job.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackRollupDeleteJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.rollup.delete_job]() request + * + * @param {string} id - The ID of the job to delete + */ + return function xpackRollupDeleteJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupDeleteJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['id'] == null) { + return callback( + new ConfigurationError('Missing required parameter: id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'rollup', 'job', params['id']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackRollupDeleteJob diff --git a/api/api/xpack.rollup.get_jobs.js b/api/api/xpack.rollup.get_jobs.js new file mode 100644 index 000000000..80ee35fd7 --- /dev/null +++ b/api/api/xpack.rollup.get_jobs.js @@ -0,0 +1,84 @@ +'use strict' + +function buildXpackRollupGetJobs (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.rollup.get_jobs]() request + * + * @param {string} id - The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs + */ + return function xpackRollupGetJobs (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupGetJobs(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'rollup', 'job'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackRollupGetJobs diff --git a/api/api/xpack.rollup.get_rollup_caps.js b/api/api/xpack.rollup.get_rollup_caps.js new file mode 100644 index 000000000..3aa0130b5 --- /dev/null +++ b/api/api/xpack.rollup.get_rollup_caps.js @@ -0,0 +1,84 @@ +'use strict' + +function buildXpackRollupGetRollupCaps (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.rollup.get_rollup_caps]() request + * + * @param {string} id - The ID of the index to check rollup capabilities on, or left blank for all jobs + */ + return function xpackRollupGetRollupCaps (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupGetRollupCaps(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'rollup', 'data'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackRollupGetRollupCaps diff --git a/api/api/xpack.rollup.get_rollup_index_caps.js b/api/api/xpack.rollup.get_rollup_index_caps.js new file mode 100644 index 000000000..20dda135c --- /dev/null +++ b/api/api/xpack.rollup.get_rollup_index_caps.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackRollupGetRollupIndexCaps (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.rollup.get_rollup_index_caps]() request + * + * @param {string} index - The rollup index or index pattern to obtain rollup capabilities from. + */ + return function xpackRollupGetRollupIndexCaps (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupGetRollupIndexCaps(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['index'] == null) { + return callback( + new ConfigurationError('Missing required parameter: index'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = [params['index'], '_xpack', 'rollup', 'data'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackRollupGetRollupIndexCaps diff --git a/api/api/xpack.rollup.put_job.js b/api/api/xpack.rollup.put_job.js new file mode 100644 index 000000000..2cb46a5bd --- /dev/null +++ b/api/api/xpack.rollup.put_job.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackRollupPutJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.rollup.put_job]() request + * + * @param {string} id - The ID of the job to create + * @param {object} body - The job configuration + */ + return function xpackRollupPutJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupPutJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['id'] == null) { + return callback( + new ConfigurationError('Missing required parameter: id'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'rollup', 'job', params['id']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackRollupPutJob diff --git a/api/api/xpack.rollup.rollup_search.js b/api/api/xpack.rollup.rollup_search.js new file mode 100644 index 000000000..2cb90065f --- /dev/null +++ b/api/api/xpack.rollup.rollup_search.js @@ -0,0 +1,110 @@ +'use strict' + +function buildXpackRollupRollupSearch (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.rollup.rollup_search]() request + * + * @param {string} index - The index or index-pattern (containing rollup or regular data) that should be searched + * @param {string} type - The doc type inside the index + * @param {object} body - The search request body + */ + return function xpackRollupRollupSearch (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupRollupSearch(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['index'] == null) { + return callback( + new ConfigurationError('Missing required parameter: index'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // check required url components + if (params['type'] != null && (params['index'] == null)) { + return callback( + new ConfigurationError('Missing required parameter of the url: index'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = [params['index'], params['type'], '_rollup_search'] + const request = { + method, + path: params['index'] != null && params['type'] != null + ? '/' + parts.filter(Boolean).map(encodeURIComponent).join('/') + : '/{index}/_rollup_search', + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackRollupRollupSearch diff --git a/api/api/xpack.rollup.start_job.js b/api/api/xpack.rollup.start_job.js new file mode 100644 index 000000000..b513b7dce --- /dev/null +++ b/api/api/xpack.rollup.start_job.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackRollupStartJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.rollup.start_job]() request + * + * @param {string} id - The ID of the job to start + */ + return function xpackRollupStartJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupStartJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['id'] == null) { + return callback( + new ConfigurationError('Missing required parameter: id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'rollup', 'job', params['id'], '_start'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackRollupStartJob diff --git a/api/api/xpack.rollup.stop_job.js b/api/api/xpack.rollup.stop_job.js new file mode 100644 index 000000000..0a1e4340a --- /dev/null +++ b/api/api/xpack.rollup.stop_job.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackRollupStopJob (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.rollup.stop_job]() request + * + * @param {string} id - The ID of the job to stop + */ + return function xpackRollupStopJob (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackRollupStopJob(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['id'] == null) { + return callback( + new ConfigurationError('Missing required parameter: id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'rollup', 'job', params['id'], '_stop'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackRollupStopJob diff --git a/api/api/xpack.security.authenticate.js b/api/api/xpack.security.authenticate.js new file mode 100644 index 000000000..5355caab5 --- /dev/null +++ b/api/api/xpack.security.authenticate.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackSecurityAuthenticate (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.authenticate](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html) request + * + */ + return function xpackSecurityAuthenticate (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityAuthenticate(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', '_authenticate'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityAuthenticate diff --git a/api/api/xpack.security.change_password.js b/api/api/xpack.security.change_password.js new file mode 100644 index 000000000..69e7fb40e --- /dev/null +++ b/api/api/xpack.security.change_password.js @@ -0,0 +1,94 @@ +'use strict' + +function buildXpackSecurityChangePassword (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.change_password](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html) request + * + * @param {string} username - The username of the user to change the password for + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + * @param {object} body - the new password for the user + */ + return function xpackSecurityChangePassword (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityChangePassword(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'user', params['username'], '_password'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityChangePassword diff --git a/api/api/xpack.security.clear_cached_realms.js b/api/api/xpack.security.clear_cached_realms.js new file mode 100644 index 000000000..8b3821303 --- /dev/null +++ b/api/api/xpack.security.clear_cached_realms.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackSecurityClearCachedRealms (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.clear_cached_realms](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html) request + * + * @param {list} realms - Comma-separated list of realms to clear + * @param {list} usernames - Comma-separated list of usernames to clear from the cache + */ + return function xpackSecurityClearCachedRealms (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityClearCachedRealms(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['realms'] == null) { + return callback( + new ConfigurationError('Missing required parameter: realms'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'usernames' + ] + const acceptedQuerystringCamelCased = [ + 'usernames' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'realm', params['realms'], '_clear_cache'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityClearCachedRealms diff --git a/api/api/xpack.security.clear_cached_roles.js b/api/api/xpack.security.clear_cached_roles.js new file mode 100644 index 000000000..f9058cb6b --- /dev/null +++ b/api/api/xpack.security.clear_cached_roles.js @@ -0,0 +1,98 @@ +'use strict' + +function buildXpackSecurityClearCachedRoles (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.clear_cached_roles](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html) request + * + * @param {list} name - Role name + */ + return function xpackSecurityClearCachedRoles (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityClearCachedRoles(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['name'] == null) { + return callback( + new ConfigurationError('Missing required parameter: name'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'role', params['name'], '_clear_cache'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityClearCachedRoles diff --git a/api/api/xpack.security.delete_privileges.js b/api/api/xpack.security.delete_privileges.js new file mode 100644 index 000000000..c8320fde7 --- /dev/null +++ b/api/api/xpack.security.delete_privileges.js @@ -0,0 +1,114 @@ +'use strict' + +function buildXpackSecurityDeletePrivileges (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.delete_privileges](TODO) request + * + * @param {string} application - Application name + * @param {string} name - Privilege name + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + */ + return function xpackSecurityDeletePrivileges (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDeletePrivileges(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['application'] == null) { + return callback( + new ConfigurationError('Missing required parameter: application'), + result + ) + } + if (params['name'] == null) { + return callback( + new ConfigurationError('Missing required parameter: name'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // check required url components + if (params['name'] != null && (params['application'] == null)) { + return callback( + new ConfigurationError('Missing required parameter of the url: application'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'privilege', params['application'], params['name']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityDeletePrivileges diff --git a/api/api/xpack.security.delete_role.js b/api/api/xpack.security.delete_role.js new file mode 100644 index 000000000..c24732e11 --- /dev/null +++ b/api/api/xpack.security.delete_role.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackSecurityDeleteRole (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.delete_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html) request + * + * @param {string} name - Role name + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + */ + return function xpackSecurityDeleteRole (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDeleteRole(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['name'] == null) { + return callback( + new ConfigurationError('Missing required parameter: name'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'role', params['name']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityDeleteRole diff --git a/api/api/xpack.security.delete_role_mapping.js b/api/api/xpack.security.delete_role_mapping.js new file mode 100644 index 000000000..d59fbdfe8 --- /dev/null +++ b/api/api/xpack.security.delete_role_mapping.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackSecurityDeleteRoleMapping (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.delete_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-role-mapping.html#security-api-delete-role-mapping) request + * + * @param {string} name - Role-mapping name + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + */ + return function xpackSecurityDeleteRoleMapping (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDeleteRoleMapping(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['name'] == null) { + return callback( + new ConfigurationError('Missing required parameter: name'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'role_mapping', params['name']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityDeleteRoleMapping diff --git a/api/api/xpack.security.delete_user.js b/api/api/xpack.security.delete_user.js new file mode 100644 index 000000000..f985efe06 --- /dev/null +++ b/api/api/xpack.security.delete_user.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackSecurityDeleteUser (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.delete_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html#security-api-delete-user) request + * + * @param {string} username - username + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + */ + return function xpackSecurityDeleteUser (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDeleteUser(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['username'] == null) { + return callback( + new ConfigurationError('Missing required parameter: username'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'user', params['username']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityDeleteUser diff --git a/api/api/xpack.security.disable_user.js b/api/api/xpack.security.disable_user.js new file mode 100644 index 000000000..6d6a7c0ca --- /dev/null +++ b/api/api/xpack.security.disable_user.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackSecurityDisableUser (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.disable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html#security-api-disable-user) request + * + * @param {string} username - The username of the user to disable + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + */ + return function xpackSecurityDisableUser (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityDisableUser(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'user', params['username'], '_disable'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityDisableUser diff --git a/api/api/xpack.security.enable_user.js b/api/api/xpack.security.enable_user.js new file mode 100644 index 000000000..ce96b8ae8 --- /dev/null +++ b/api/api/xpack.security.enable_user.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackSecurityEnableUser (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.enable_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html#security-api-enable-user) request + * + * @param {string} username - The username of the user to enable + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + */ + return function xpackSecurityEnableUser (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityEnableUser(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'user', params['username'], '_enable'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityEnableUser diff --git a/api/api/xpack.security.get_privileges.js b/api/api/xpack.security.get_privileges.js new file mode 100644 index 000000000..0bb42c912 --- /dev/null +++ b/api/api/xpack.security.get_privileges.js @@ -0,0 +1,101 @@ +'use strict' + +function buildXpackSecurityGetPrivileges (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.get_privileges](TODO) request + * + * @param {string} application - Application name + * @param {string} name - Privilege name + */ + return function xpackSecurityGetPrivileges (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetPrivileges(params, (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 + ) + } + + // check required url components + if (params['name'] != null && (params['application'] == null)) { + return callback( + new ConfigurationError('Missing required parameter of the url: application'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'privilege', params['application'], params['name']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityGetPrivileges diff --git a/api/api/xpack.security.get_role.js b/api/api/xpack.security.get_role.js new file mode 100644 index 000000000..52748befd --- /dev/null +++ b/api/api/xpack.security.get_role.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackSecurityGetRole (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.get_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html) request + * + * @param {string} name - Role name + */ + return function xpackSecurityGetRole (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetRole(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'role', params['name']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityGetRole diff --git a/api/api/xpack.security.get_role_mapping.js b/api/api/xpack.security.get_role_mapping.js new file mode 100644 index 000000000..cf007ca38 --- /dev/null +++ b/api/api/xpack.security.get_role_mapping.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackSecurityGetRoleMapping (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.get_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-role-mapping.html#security-api-get-role-mapping) request + * + * @param {string} name - Role-Mapping name + */ + return function xpackSecurityGetRoleMapping (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetRoleMapping(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'role_mapping', params['name']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityGetRoleMapping diff --git a/api/api/xpack.security.get_token.js b/api/api/xpack.security.get_token.js new file mode 100644 index 000000000..26d25904f --- /dev/null +++ b/api/api/xpack.security.get_token.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackSecurityGetToken (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.get_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-tokens.html#security-api-get-token) request + * + * @param {object} body - The token request to get + */ + return function xpackSecurityGetToken (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetToken(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'oauth2', 'token'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityGetToken diff --git a/api/api/xpack.security.get_user.js b/api/api/xpack.security.get_user.js new file mode 100644 index 000000000..938c3502a --- /dev/null +++ b/api/api/xpack.security.get_user.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackSecurityGetUser (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.get_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html#security-api-get-user) request + * + * @param {list} username - A comma-separated list of usernames + */ + return function xpackSecurityGetUser (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityGetUser(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'user', params['username']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityGetUser diff --git a/api/api/xpack.security.has_privileges.js b/api/api/xpack.security.has_privileges.js new file mode 100644 index 000000000..7c2b046d5 --- /dev/null +++ b/api/api/xpack.security.has_privileges.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackSecurityHasPrivileges (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.has_privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-privileges.html) request + * + * @param {string} user - Username + * @param {object} body - The privileges to test + */ + return function xpackSecurityHasPrivileges (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityHasPrivileges(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'user', params['user'], '_has_privileges'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityHasPrivileges diff --git a/api/api/xpack.security.invalidate_token.js b/api/api/xpack.security.invalidate_token.js new file mode 100644 index 000000000..a6e7304ea --- /dev/null +++ b/api/api/xpack.security.invalidate_token.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackSecurityInvalidateToken (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.invalidate_token](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-tokens.html#security-api-invalidate-token) request + * + * @param {object} body - The token to invalidate + */ + return function xpackSecurityInvalidateToken (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityInvalidateToken(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'oauth2', 'token'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityInvalidateToken diff --git a/api/api/xpack.security.put_privileges.js b/api/api/xpack.security.put_privileges.js new file mode 100644 index 000000000..210a15f2b --- /dev/null +++ b/api/api/xpack.security.put_privileges.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackSecurityPutPrivileges (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.put_privileges](TODO) request + * + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + * @param {object} body - The privilege(s) to add + */ + return function xpackSecurityPutPrivileges (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityPutPrivileges(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'privilege'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityPutPrivileges diff --git a/api/api/xpack.security.put_role.js b/api/api/xpack.security.put_role.js new file mode 100644 index 000000000..045e7dbc4 --- /dev/null +++ b/api/api/xpack.security.put_role.js @@ -0,0 +1,100 @@ +'use strict' + +function buildXpackSecurityPutRole (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.put_role](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html) request + * + * @param {string} name - Role name + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + * @param {object} body - The role to add + */ + return function xpackSecurityPutRole (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityPutRole(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['name'] == null) { + return callback( + new ConfigurationError('Missing required parameter: name'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'role', params['name']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityPutRole diff --git a/api/api/xpack.security.put_role_mapping.js b/api/api/xpack.security.put_role_mapping.js new file mode 100644 index 000000000..d0a0c42bf --- /dev/null +++ b/api/api/xpack.security.put_role_mapping.js @@ -0,0 +1,100 @@ +'use strict' + +function buildXpackSecurityPutRoleMapping (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.put_role_mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-role-mapping.html#security-api-put-role-mapping) request + * + * @param {string} name - Role-mapping name + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + * @param {object} body - The role to add + */ + return function xpackSecurityPutRoleMapping (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityPutRoleMapping(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['name'] == null) { + return callback( + new ConfigurationError('Missing required parameter: name'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'role_mapping', params['name']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityPutRoleMapping diff --git a/api/api/xpack.security.put_user.js b/api/api/xpack.security.put_user.js new file mode 100644 index 000000000..466ebd4e7 --- /dev/null +++ b/api/api/xpack.security.put_user.js @@ -0,0 +1,100 @@ +'use strict' + +function buildXpackSecurityPutUser (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.security.put_user](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html#security-api-put-user) request + * + * @param {string} username - The username of the User + * @param {enum} refresh - If `true` (the default) then refresh the affected 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` then do nothing with refreshes. + * @param {object} body - The user to add + */ + return function xpackSecurityPutUser (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSecurityPutUser(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['username'] == null) { + return callback( + new ConfigurationError('Missing required parameter: username'), + result + ) + } + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'refresh' + ] + const acceptedQuerystringCamelCased = [ + 'refresh' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'security', 'user', params['username']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSecurityPutUser diff --git a/api/api/xpack.sql.clear_cursor.js b/api/api/xpack.sql.clear_cursor.js new file mode 100644 index 000000000..a93a52d99 --- /dev/null +++ b/api/api/xpack.sql.clear_cursor.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackSqlClearCursor (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.sql.clear_cursor](Clear SQL cursor) request + * + * @param {object} body - Specify the cursor value in the `cursor` element to clean the cursor. + */ + return function xpackSqlClearCursor (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSqlClearCursor(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'sql', 'close'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSqlClearCursor diff --git a/api/api/xpack.sql.query.js b/api/api/xpack.sql.query.js new file mode 100644 index 000000000..917a341e7 --- /dev/null +++ b/api/api/xpack.sql.query.js @@ -0,0 +1,93 @@ +'use strict' + +function buildXpackSqlQuery (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.sql.query](Execute SQL) request + * + * @param {string} format - a short version of the Accept header, e.g. json, yaml + * @param {object} body - Use the `query` element to start a query. Use the `cursor` element to continue a query. + */ + return function xpackSqlQuery (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSqlQuery(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'format' + ] + const acceptedQuerystringCamelCased = [ + 'format' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'sql'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSqlQuery diff --git a/api/api/xpack.sql.translate.js b/api/api/xpack.sql.translate.js new file mode 100644 index 000000000..bc4c8929d --- /dev/null +++ b/api/api/xpack.sql.translate.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackSqlTranslate (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.sql.translate](Translate SQL into Elasticsearch queries) request + * + * @param {object} body - Specify the query in the `query` element. + */ + return function xpackSqlTranslate (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSqlTranslate(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['body'] == null) { + return callback( + new ConfigurationError('Missing required parameter: body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = params.body == null ? 'GET' : 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'sql', 'translate'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSqlTranslate diff --git a/api/api/xpack.ssl.certificates.js b/api/api/xpack.ssl.certificates.js new file mode 100644 index 000000000..6f588cc1f --- /dev/null +++ b/api/api/xpack.ssl.certificates.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackSslCertificates (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.ssl.certificates](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-ssl.html) request + * + */ + return function xpackSslCertificates (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackSslCertificates(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'ssl', 'certificates'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackSslCertificates diff --git a/api/api/xpack.usage.js b/api/api/xpack.usage.js new file mode 100644 index 000000000..2b989e752 --- /dev/null +++ b/api/api/xpack.usage.js @@ -0,0 +1,92 @@ +'use strict' + +function buildXpackUsage (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.usage](Retrieve information about xpack features usage) request + * + * @param {time} master_timeout - Specify timeout for watch write operation + */ + return function xpackUsage (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackUsage(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'master_timeout' + ] + const acceptedQuerystringCamelCased = [ + 'masterTimeout' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'usage'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackUsage diff --git a/api/api/xpack.watcher.ack_watch.js b/api/api/xpack.watcher.ack_watch.js new file mode 100644 index 000000000..6bbb92a74 --- /dev/null +++ b/api/api/xpack.watcher.ack_watch.js @@ -0,0 +1,108 @@ +'use strict' + +function buildXpackWatcherAckWatch (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.ack_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html) request + * + * @param {string} watch_id - Watch ID + * @param {list} action_id - A comma-separated list of the action ids to be acked + * @param {time} master_timeout - Explicit operation timeout for connection to master node + */ + return function xpackWatcherAckWatch (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherAckWatch(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['watch_id'] == null && params['watchId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: watch_id or watchId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // check required url components + if ((params['action_id'] != null || params['actionId'] != null) && ((params['watch_id'] == null || params['watchId']))) { + return callback( + new ConfigurationError('Missing required parameter of the url: watch_id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'master_timeout' + ] + const acceptedQuerystringCamelCased = [ + 'masterTimeout' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', 'watch', params['watch_id'] || params['watchId'], '_ack', params['action_id'] || params['actionId']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherAckWatch diff --git a/api/api/xpack.watcher.activate_watch.js b/api/api/xpack.watcher.activate_watch.js new file mode 100644 index 000000000..2669b8c39 --- /dev/null +++ b/api/api/xpack.watcher.activate_watch.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackWatcherActivateWatch (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.activate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html) request + * + * @param {string} watch_id - Watch ID + * @param {time} master_timeout - Explicit operation timeout for connection to master node + */ + return function xpackWatcherActivateWatch (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherActivateWatch(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['watch_id'] == null && params['watchId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: watch_id or watchId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'master_timeout' + ] + const acceptedQuerystringCamelCased = [ + 'masterTimeout' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', 'watch', params['watch_id'] || params['watchId'], '_activate'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherActivateWatch diff --git a/api/api/xpack.watcher.deactivate_watch.js b/api/api/xpack.watcher.deactivate_watch.js new file mode 100644 index 000000000..4e48a6ac5 --- /dev/null +++ b/api/api/xpack.watcher.deactivate_watch.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackWatcherDeactivateWatch (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.deactivate_watch](https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html) request + * + * @param {string} watch_id - Watch ID + * @param {time} master_timeout - Explicit operation timeout for connection to master node + */ + return function xpackWatcherDeactivateWatch (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherDeactivateWatch(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['watch_id'] == null && params['watchId'] == null) { + return callback( + new ConfigurationError('Missing required parameter: watch_id or watchId'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'master_timeout' + ] + const acceptedQuerystringCamelCased = [ + 'masterTimeout' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', 'watch', params['watch_id'] || params['watchId'], '_deactivate'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherDeactivateWatch diff --git a/api/api/xpack.watcher.delete_watch.js b/api/api/xpack.watcher.delete_watch.js new file mode 100644 index 000000000..25a83f816 --- /dev/null +++ b/api/api/xpack.watcher.delete_watch.js @@ -0,0 +1,99 @@ +'use strict' + +function buildXpackWatcherDeleteWatch (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.delete_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html) request + * + * @param {string} id - Watch ID + * @param {time} master_timeout - Explicit operation timeout for connection to master node + */ + return function xpackWatcherDeleteWatch (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherDeleteWatch(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['id'] == null) { + return callback( + new ConfigurationError('Missing required parameter: id'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'master_timeout' + ] + const acceptedQuerystringCamelCased = [ + 'masterTimeout' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'DELETE' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', 'watch', params['id']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherDeleteWatch diff --git a/api/api/xpack.watcher.execute_watch.js b/api/api/xpack.watcher.execute_watch.js new file mode 100644 index 000000000..4fddc77b8 --- /dev/null +++ b/api/api/xpack.watcher.execute_watch.js @@ -0,0 +1,86 @@ +'use strict' + +function buildXpackWatcherExecuteWatch (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.execute_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html) request + * + * @param {string} id - Watch ID + * @param {boolean} debug - indicates whether the watch should execute in debug mode + * @param {object} body - Execution control + */ + return function xpackWatcherExecuteWatch (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherExecuteWatch(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'debug' + ] + const acceptedQuerystringCamelCased = [ + 'debug' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', 'watch', params['id'], '_execute'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherExecuteWatch diff --git a/api/api/xpack.watcher.get_watch.js b/api/api/xpack.watcher.get_watch.js new file mode 100644 index 000000000..7afda8433 --- /dev/null +++ b/api/api/xpack.watcher.get_watch.js @@ -0,0 +1,98 @@ +'use strict' + +function buildXpackWatcherGetWatch (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.get_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html) request + * + * @param {string} id - Watch ID + */ + return function xpackWatcherGetWatch (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherGetWatch(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['id'] == null) { + return callback( + new ConfigurationError('Missing required parameter: id'), + result + ) + } + if (params.body != null) { + return callback( + new ConfigurationError('This API does not require a body'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', 'watch', params['id']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherGetWatch diff --git a/api/api/xpack.watcher.put_watch.js b/api/api/xpack.watcher.put_watch.js new file mode 100644 index 000000000..29d33296a --- /dev/null +++ b/api/api/xpack.watcher.put_watch.js @@ -0,0 +1,100 @@ +'use strict' + +function buildXpackWatcherPutWatch (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.put_watch](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html) request + * + * @param {string} id - Watch ID + * @param {time} master_timeout - Explicit operation timeout for connection to master node + * @param {boolean} active - Specify whether the watch is in/active by default + * @param {number} version - Explicit version number for concurrency control + * @param {object} body - The watch + */ + return function xpackWatcherPutWatch (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherPutWatch(params, (err, body) => { + err ? reject(err) : resolve(body) + }) + }) + } + + // check required parameters + if (params['id'] == null) { + return callback( + new ConfigurationError('Missing required parameter: id'), + result + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'master_timeout', + 'active', + 'version' + ] + const acceptedQuerystringCamelCased = [ + 'masterTimeout', + 'active', + 'version' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'PUT' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', 'watch', params['id']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: params.body || '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherPutWatch diff --git a/api/api/xpack.watcher.restart.js b/api/api/xpack.watcher.restart.js new file mode 100644 index 000000000..f89aaf2ea --- /dev/null +++ b/api/api/xpack.watcher.restart.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackWatcherRestart (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.restart](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-restart.html) request + * + */ + return function xpackWatcherRestart (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherRestart(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', '_restart'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherRestart diff --git a/api/api/xpack.watcher.start.js b/api/api/xpack.watcher.start.js new file mode 100644 index 000000000..2169f1149 --- /dev/null +++ b/api/api/xpack.watcher.start.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackWatcherStart (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.start](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html) request + * + */ + return function xpackWatcherStart (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherStart(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', '_start'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherStart diff --git a/api/api/xpack.watcher.stats.js b/api/api/xpack.watcher.stats.js new file mode 100644 index 000000000..f5b53ca03 --- /dev/null +++ b/api/api/xpack.watcher.stats.js @@ -0,0 +1,96 @@ +'use strict' + +function buildXpackWatcherStats (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.stats](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html) request + * + * @param {enum} metric - Controls what additional stat metrics should be include in the response + * @param {enum} metric - Controls what additional stat metrics should be include in the response + * @param {boolean} emit_stacktraces - Emits stack traces of currently running watches + */ + return function xpackWatcherStats (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherStats(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + 'metric', + 'emit_stacktraces' + ] + const acceptedQuerystringCamelCased = [ + 'metric', + 'emitStacktraces' + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'GET' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', 'stats', params['metric']] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: null, + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherStats diff --git a/api/api/xpack.watcher.stop.js b/api/api/xpack.watcher.stop.js new file mode 100644 index 000000000..22f5d582f --- /dev/null +++ b/api/api/xpack.watcher.stop.js @@ -0,0 +1,91 @@ +'use strict' + +function buildXpackWatcherStop (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, result } = opts + /** + * Perform a [xpack.watcher.stop](http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html) request + * + */ + return function xpackWatcherStop (params, callback) { + if (typeof params === 'function' || params == null) { + callback = params + params = {} + } + // promises support + if (callback == null) { + return new Promise((resolve, reject) => { + xpackWatcherStop(params, (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 + ) + } + + // build querystring object + const querystring = {} + const keys = Object.keys(params) + const acceptedQuerystring = [ + + ] + const acceptedQuerystringCamelCased = [ + + ] + + for (var i = 0, len = keys.length; i < len; i++) { + var key = keys[i] + if (acceptedQuerystring.indexOf(key) !== -1) { + querystring[key] = params[key] + } else { + var camelIndex = acceptedQuerystringCamelCased.indexOf(key) + if (camelIndex !== -1) { + querystring[acceptedQuerystring[camelIndex]] = params[key] + } + } + } + + // configure http method + var method = params.method + if (method == null) { + method = 'POST' + } + + // validate headers object + if (params.headers != null && typeof params.headers !== 'object') { + return callback( + new ConfigurationError(`Headers should be an object, instead got: ${typeof params.headers}`), + result + ) + } + + var ignore = params.ignore || null + if (typeof ignore === 'number') { + ignore = [ignore] + } + + // build request object + const parts = ['_xpack', 'watcher', '_stop'] + const request = { + method, + path: '/' + parts.filter(Boolean).map(encodeURIComponent).join('/'), + querystring, + body: '', + headers: params.headers || null, + ignore, + requestTimeout: params.requestTimeout || null, + agent: null, + url: '' + } + + return makeRequest(request, callback) + } +} + +module.exports = buildXpackWatcherStop diff --git a/api/index.js b/api/index.js index 4d88a2504..20603b0a3 100644 --- a/api/index.js +++ b/api/index.js @@ -2,378 +2,628 @@ const assert = require('assert') +const bulk = require('./api/bulk.js') +const catAliases = require('./api/cat.aliases.js') +const catAllocation = require('./api/cat.allocation.js') +const catCount = require('./api/cat.count.js') +const catFielddata = require('./api/cat.fielddata.js') +const catHealth = require('./api/cat.health.js') +const catHelp = require('./api/cat.help.js') +const catIndices = require('./api/cat.indices.js') +const catMaster = require('./api/cat.master.js') +const catNodeattrs = require('./api/cat.nodeattrs.js') +const catNodes = require('./api/cat.nodes.js') +const catPendingTasks = require('./api/cat.pending_tasks.js') +const catPlugins = require('./api/cat.plugins.js') +const catRecovery = require('./api/cat.recovery.js') +const catRepositories = require('./api/cat.repositories.js') +const catSegments = require('./api/cat.segments.js') +const catShards = require('./api/cat.shards.js') +const catSnapshots = require('./api/cat.snapshots.js') +const catTasks = require('./api/cat.tasks.js') +const catTemplates = require('./api/cat.templates.js') +const catThreadPool = require('./api/cat.thread_pool.js') +const clearScroll = require('./api/clear_scroll.js') +const clusterAllocationExplain = require('./api/cluster.allocation_explain.js') +const clusterGetSettings = require('./api/cluster.get_settings.js') +const clusterHealth = require('./api/cluster.health.js') +const clusterPendingTasks = require('./api/cluster.pending_tasks.js') +const clusterPutSettings = require('./api/cluster.put_settings.js') +const clusterRemoteInfo = require('./api/cluster.remote_info.js') +const clusterReroute = require('./api/cluster.reroute.js') +const clusterState = require('./api/cluster.state.js') +const clusterStats = require('./api/cluster.stats.js') +const count = require('./api/count.js') +const create = require('./api/create.js') +const _delete = require('./api/delete.js') +const deleteByQuery = require('./api/delete_by_query.js') +const deleteScript = require('./api/delete_script.js') +const exists = require('./api/exists.js') +const existsSource = require('./api/exists_source.js') +const explain = require('./api/explain.js') +const fieldCaps = require('./api/field_caps.js') +const get = require('./api/get.js') +const getScript = require('./api/get_script.js') +const getSource = require('./api/get_source.js') +const index = require('./api/index.js') +const indicesAnalyze = require('./api/indices.analyze.js') +const indicesClearCache = require('./api/indices.clear_cache.js') +const indicesClose = require('./api/indices.close.js') +const indicesCreate = require('./api/indices.create.js') +const indicesDelete = require('./api/indices.delete.js') +const indicesDeleteAlias = require('./api/indices.delete_alias.js') +const indicesDeleteTemplate = require('./api/indices.delete_template.js') +const indicesExists = require('./api/indices.exists.js') +const indicesExistsAlias = require('./api/indices.exists_alias.js') +const indicesExistsTemplate = require('./api/indices.exists_template.js') +const indicesExistsType = require('./api/indices.exists_type.js') +const indicesFlush = require('./api/indices.flush.js') +const indicesFlushSynced = require('./api/indices.flush_synced.js') +const indicesForcemerge = require('./api/indices.forcemerge.js') +const indicesGet = require('./api/indices.get.js') +const indicesGetAlias = require('./api/indices.get_alias.js') +const indicesGetFieldMapping = require('./api/indices.get_field_mapping.js') +const indicesGetMapping = require('./api/indices.get_mapping.js') +const indicesGetSettings = require('./api/indices.get_settings.js') +const indicesGetTemplate = require('./api/indices.get_template.js') +const indicesGetUpgrade = require('./api/indices.get_upgrade.js') +const indicesOpen = require('./api/indices.open.js') +const indicesPutAlias = require('./api/indices.put_alias.js') +const indicesPutMapping = require('./api/indices.put_mapping.js') +const indicesPutSettings = require('./api/indices.put_settings.js') +const indicesPutTemplate = require('./api/indices.put_template.js') +const indicesRecovery = require('./api/indices.recovery.js') +const indicesRefresh = require('./api/indices.refresh.js') +const indicesRollover = require('./api/indices.rollover.js') +const indicesSegments = require('./api/indices.segments.js') +const indicesShardStores = require('./api/indices.shard_stores.js') +const indicesShrink = require('./api/indices.shrink.js') +const indicesSplit = require('./api/indices.split.js') +const indicesStats = require('./api/indices.stats.js') +const indicesUpdateAliases = require('./api/indices.update_aliases.js') +const indicesUpgrade = require('./api/indices.upgrade.js') +const indicesValidateQuery = require('./api/indices.validate_query.js') +const info = require('./api/info.js') +const ingestDeletePipeline = require('./api/ingest.delete_pipeline.js') +const ingestGetPipeline = require('./api/ingest.get_pipeline.js') +const ingestProcessorGrok = require('./api/ingest.processor_grok.js') +const ingestPutPipeline = require('./api/ingest.put_pipeline.js') +const ingestSimulate = require('./api/ingest.simulate.js') +const mget = require('./api/mget.js') +const msearch = require('./api/msearch.js') +const msearchTemplate = require('./api/msearch_template.js') +const mtermvectors = require('./api/mtermvectors.js') +const nodesHotThreads = require('./api/nodes.hot_threads.js') +const nodesInfo = require('./api/nodes.info.js') +const nodesStats = require('./api/nodes.stats.js') +const nodesUsage = require('./api/nodes.usage.js') +const ping = require('./api/ping.js') +const putScript = require('./api/put_script.js') +const rankEval = require('./api/rank_eval.js') +const reindex = require('./api/reindex.js') +const reindexRethrottle = require('./api/reindex_rethrottle.js') +const renderSearchTemplate = require('./api/render_search_template.js') +const scriptsPainlessExecute = require('./api/scripts_painless_execute.js') +const scroll = require('./api/scroll.js') +const search = require('./api/search.js') +const searchShards = require('./api/search_shards.js') +const searchTemplate = require('./api/search_template.js') +const snapshotCreate = require('./api/snapshot.create.js') +const snapshotCreateRepository = require('./api/snapshot.create_repository.js') +const snapshotDelete = require('./api/snapshot.delete.js') +const snapshotDeleteRepository = require('./api/snapshot.delete_repository.js') +const snapshotGet = require('./api/snapshot.get.js') +const snapshotGetRepository = require('./api/snapshot.get_repository.js') +const snapshotRestore = require('./api/snapshot.restore.js') +const snapshotStatus = require('./api/snapshot.status.js') +const snapshotVerifyRepository = require('./api/snapshot.verify_repository.js') +const tasksCancel = require('./api/tasks.cancel.js') +const tasksGet = require('./api/tasks.get.js') +const tasksList = require('./api/tasks.list.js') +const termvectors = require('./api/termvectors.js') +const update = require('./api/update.js') +const updateByQuery = require('./api/update_by_query.js') +const xpackGraphExplore = require('./api/xpack.graph.explore.js') +const xpackInfo = require('./api/xpack.info.js') +const xpackLicenseDelete = require('./api/xpack.license.delete.js') +const xpackLicenseGet = require('./api/xpack.license.get.js') +const xpackLicenseGetBasicStatus = require('./api/xpack.license.get_basic_status.js') +const xpackLicenseGetTrialStatus = require('./api/xpack.license.get_trial_status.js') +const xpackLicensePost = require('./api/xpack.license.post.js') +const xpackLicensePostStartBasic = require('./api/xpack.license.post_start_basic.js') +const xpackLicensePostStartTrial = require('./api/xpack.license.post_start_trial.js') +const xpackMigrationDeprecations = require('./api/xpack.migration.deprecations.js') +const xpackMigrationGetAssistance = require('./api/xpack.migration.get_assistance.js') +const xpackMigrationUpgrade = require('./api/xpack.migration.upgrade.js') +const xpackMlCloseJob = require('./api/xpack.ml.close_job.js') +const xpackMlDeleteCalendar = require('./api/xpack.ml.delete_calendar.js') +const xpackMlDeleteCalendarEvent = require('./api/xpack.ml.delete_calendar_event.js') +const xpackMlDeleteCalendarJob = require('./api/xpack.ml.delete_calendar_job.js') +const xpackMlDeleteDatafeed = require('./api/xpack.ml.delete_datafeed.js') +const xpackMlDeleteExpiredData = require('./api/xpack.ml.delete_expired_data.js') +const xpackMlDeleteFilter = require('./api/xpack.ml.delete_filter.js') +const xpackMlDeleteJob = require('./api/xpack.ml.delete_job.js') +const xpackMlDeleteModelSnapshot = require('./api/xpack.ml.delete_model_snapshot.js') +const xpackMlFlushJob = require('./api/xpack.ml.flush_job.js') +const xpackMlForecast = require('./api/xpack.ml.forecast.js') +const xpackMlGetBuckets = require('./api/xpack.ml.get_buckets.js') +const xpackMlGetCalendarEvents = require('./api/xpack.ml.get_calendar_events.js') +const xpackMlGetCalendars = require('./api/xpack.ml.get_calendars.js') +const xpackMlGetCategories = require('./api/xpack.ml.get_categories.js') +const xpackMlGetDatafeedStats = require('./api/xpack.ml.get_datafeed_stats.js') +const xpackMlGetDatafeeds = require('./api/xpack.ml.get_datafeeds.js') +const xpackMlGetFilters = require('./api/xpack.ml.get_filters.js') +const xpackMlGetInfluencers = require('./api/xpack.ml.get_influencers.js') +const xpackMlGetJobStats = require('./api/xpack.ml.get_job_stats.js') +const xpackMlGetJobs = require('./api/xpack.ml.get_jobs.js') +const xpackMlGetModelSnapshots = require('./api/xpack.ml.get_model_snapshots.js') +const xpackMlGetOverallBuckets = require('./api/xpack.ml.get_overall_buckets.js') +const xpackMlGetRecords = require('./api/xpack.ml.get_records.js') +const xpackMlInfo = require('./api/xpack.ml.info.js') +const xpackMlOpenJob = require('./api/xpack.ml.open_job.js') +const xpackMlPostCalendarEvents = require('./api/xpack.ml.post_calendar_events.js') +const xpackMlPostData = require('./api/xpack.ml.post_data.js') +const xpackMlPreviewDatafeed = require('./api/xpack.ml.preview_datafeed.js') +const xpackMlPutCalendar = require('./api/xpack.ml.put_calendar.js') +const xpackMlPutCalendarJob = require('./api/xpack.ml.put_calendar_job.js') +const xpackMlPutDatafeed = require('./api/xpack.ml.put_datafeed.js') +const xpackMlPutFilter = require('./api/xpack.ml.put_filter.js') +const xpackMlPutJob = require('./api/xpack.ml.put_job.js') +const xpackMlRevertModelSnapshot = require('./api/xpack.ml.revert_model_snapshot.js') +const xpackMlStartDatafeed = require('./api/xpack.ml.start_datafeed.js') +const xpackMlStopDatafeed = require('./api/xpack.ml.stop_datafeed.js') +const xpackMlUpdateDatafeed = require('./api/xpack.ml.update_datafeed.js') +const xpackMlUpdateFilter = require('./api/xpack.ml.update_filter.js') +const xpackMlUpdateJob = require('./api/xpack.ml.update_job.js') +const xpackMlUpdateModelSnapshot = require('./api/xpack.ml.update_model_snapshot.js') +const xpackMlValidate = require('./api/xpack.ml.validate.js') +const xpackMlValidateDetector = require('./api/xpack.ml.validate_detector.js') +const xpackMonitoringBulk = require('./api/xpack.monitoring.bulk.js') +const xpackRollupDeleteJob = require('./api/xpack.rollup.delete_job.js') +const xpackRollupGetJobs = require('./api/xpack.rollup.get_jobs.js') +const xpackRollupGetRollupCaps = require('./api/xpack.rollup.get_rollup_caps.js') +const xpackRollupGetRollupIndexCaps = require('./api/xpack.rollup.get_rollup_index_caps.js') +const xpackRollupPutJob = require('./api/xpack.rollup.put_job.js') +const xpackRollupRollupSearch = require('./api/xpack.rollup.rollup_search.js') +const xpackRollupStartJob = require('./api/xpack.rollup.start_job.js') +const xpackRollupStopJob = require('./api/xpack.rollup.stop_job.js') +const xpackSecurityAuthenticate = require('./api/xpack.security.authenticate.js') +const xpackSecurityChangePassword = require('./api/xpack.security.change_password.js') +const xpackSecurityClearCachedRealms = require('./api/xpack.security.clear_cached_realms.js') +const xpackSecurityClearCachedRoles = require('./api/xpack.security.clear_cached_roles.js') +const xpackSecurityDeletePrivileges = require('./api/xpack.security.delete_privileges.js') +const xpackSecurityDeleteRole = require('./api/xpack.security.delete_role.js') +const xpackSecurityDeleteRoleMapping = require('./api/xpack.security.delete_role_mapping.js') +const xpackSecurityDeleteUser = require('./api/xpack.security.delete_user.js') +const xpackSecurityDisableUser = require('./api/xpack.security.disable_user.js') +const xpackSecurityEnableUser = require('./api/xpack.security.enable_user.js') +const xpackSecurityGetPrivileges = require('./api/xpack.security.get_privileges.js') +const xpackSecurityGetRole = require('./api/xpack.security.get_role.js') +const xpackSecurityGetRoleMapping = require('./api/xpack.security.get_role_mapping.js') +const xpackSecurityGetToken = require('./api/xpack.security.get_token.js') +const xpackSecurityGetUser = require('./api/xpack.security.get_user.js') +const xpackSecurityHasPrivileges = require('./api/xpack.security.has_privileges.js') +const xpackSecurityInvalidateToken = require('./api/xpack.security.invalidate_token.js') +const xpackSecurityPutPrivileges = require('./api/xpack.security.put_privileges.js') +const xpackSecurityPutRole = require('./api/xpack.security.put_role.js') +const xpackSecurityPutRoleMapping = require('./api/xpack.security.put_role_mapping.js') +const xpackSecurityPutUser = require('./api/xpack.security.put_user.js') +const xpackSqlClearCursor = require('./api/xpack.sql.clear_cursor.js') +const xpackSqlQuery = require('./api/xpack.sql.query.js') +const xpackSqlTranslate = require('./api/xpack.sql.translate.js') +const xpackSslCertificates = require('./api/xpack.ssl.certificates.js') +const xpackUsage = require('./api/xpack.usage.js') +const xpackWatcherAckWatch = require('./api/xpack.watcher.ack_watch.js') +const xpackWatcherActivateWatch = require('./api/xpack.watcher.activate_watch.js') +const xpackWatcherDeactivateWatch = require('./api/xpack.watcher.deactivate_watch.js') +const xpackWatcherDeleteWatch = require('./api/xpack.watcher.delete_watch.js') +const xpackWatcherExecuteWatch = require('./api/xpack.watcher.execute_watch.js') +const xpackWatcherGetWatch = require('./api/xpack.watcher.get_watch.js') +const xpackWatcherPutWatch = require('./api/xpack.watcher.put_watch.js') +const xpackWatcherRestart = require('./api/xpack.watcher.restart.js') +const xpackWatcherStart = require('./api/xpack.watcher.start.js') +const xpackWatcherStats = require('./api/xpack.watcher.stats.js') +const xpackWatcherStop = require('./api/xpack.watcher.stop.js') + function ESAPI (opts) { assert(opts.makeRequest, 'Missing makeRequest function') assert(opts.ConfigurationError, 'Missing ConfigurationError class') assert(opts.result, 'Missing default result object') const apis = { - bulk: require('./api/bulk.js')(opts), + bulk: bulk(opts), cat: { - aliases: require('./api/cat.aliases.js')(opts), - allocation: require('./api/cat.allocation.js')(opts), - count: require('./api/cat.count.js')(opts), - fielddata: require('./api/cat.fielddata.js')(opts), - health: require('./api/cat.health.js')(opts), - help: require('./api/cat.help.js')(opts), - indices: require('./api/cat.indices.js')(opts), - master: require('./api/cat.master.js')(opts), - nodeattrs: require('./api/cat.nodeattrs.js')(opts), - nodes: require('./api/cat.nodes.js')(opts), - pending_tasks: require('./api/cat.pending_tasks.js')(opts), - plugins: require('./api/cat.plugins.js')(opts), - recovery: require('./api/cat.recovery.js')(opts), - repositories: require('./api/cat.repositories.js')(opts), - segments: require('./api/cat.segments.js')(opts), - shards: require('./api/cat.shards.js')(opts), - snapshots: require('./api/cat.snapshots.js')(opts), - tasks: require('./api/cat.tasks.js')(opts), - templates: require('./api/cat.templates.js')(opts), - thread_pool: require('./api/cat.thread_pool.js')(opts) + aliases: catAliases(opts), + allocation: catAllocation(opts), + count: catCount(opts), + fielddata: catFielddata(opts), + health: catHealth(opts), + help: catHelp(opts), + indices: catIndices(opts), + master: catMaster(opts), + nodeattrs: catNodeattrs(opts), + nodes: catNodes(opts), + pending_tasks: catPendingTasks(opts), + pendingTasks: catPendingTasks(opts), + plugins: catPlugins(opts), + recovery: catRecovery(opts), + repositories: catRepositories(opts), + segments: catSegments(opts), + shards: catShards(opts), + snapshots: catSnapshots(opts), + tasks: catTasks(opts), + templates: catTemplates(opts), + thread_pool: catThreadPool(opts), + threadPool: catThreadPool(opts) }, - clear_scroll: require('./api/clear_scroll.js')(opts), + clear_scroll: clearScroll(opts), + clearScroll: clearScroll(opts), cluster: { - allocation_explain: require('./api/cluster.allocation_explain.js')(opts), - get_settings: require('./api/cluster.get_settings.js')(opts), - health: require('./api/cluster.health.js')(opts), - pending_tasks: require('./api/cluster.pending_tasks.js')(opts), - put_settings: require('./api/cluster.put_settings.js')(opts), - remote_info: require('./api/cluster.remote_info.js')(opts), - reroute: require('./api/cluster.reroute.js')(opts), - state: require('./api/cluster.state.js')(opts), - stats: require('./api/cluster.stats.js')(opts) + allocation_explain: clusterAllocationExplain(opts), + allocationExplain: clusterAllocationExplain(opts), + get_settings: clusterGetSettings(opts), + getSettings: clusterGetSettings(opts), + health: clusterHealth(opts), + pending_tasks: clusterPendingTasks(opts), + pendingTasks: clusterPendingTasks(opts), + put_settings: clusterPutSettings(opts), + putSettings: clusterPutSettings(opts), + remote_info: clusterRemoteInfo(opts), + remoteInfo: clusterRemoteInfo(opts), + reroute: clusterReroute(opts), + state: clusterState(opts), + stats: clusterStats(opts) }, - count: require('./api/count.js')(opts), - create: require('./api/create.js')(opts), - delete: require('./api/delete.js')(opts), - delete_by_query: require('./api/delete_by_query.js')(opts), - delete_script: require('./api/delete_script.js')(opts), - exists: require('./api/exists.js')(opts), - exists_source: require('./api/exists_source.js')(opts), - explain: require('./api/explain.js')(opts), - field_caps: require('./api/field_caps.js')(opts), - get: require('./api/get.js')(opts), - get_script: require('./api/get_script.js')(opts), - get_source: require('./api/get_source.js')(opts), - index: require('./api/index.js')(opts), + count: count(opts), + create: create(opts), + delete: _delete(opts), + delete_by_query: deleteByQuery(opts), + deleteByQuery: deleteByQuery(opts), + delete_script: deleteScript(opts), + deleteScript: deleteScript(opts), + exists: exists(opts), + exists_source: existsSource(opts), + existsSource: existsSource(opts), + explain: explain(opts), + field_caps: fieldCaps(opts), + fieldCaps: fieldCaps(opts), + get: get(opts), + get_script: getScript(opts), + getScript: getScript(opts), + get_source: getSource(opts), + getSource: getSource(opts), + index: index(opts), indices: { - analyze: require('./api/indices.analyze.js')(opts), - clear_cache: require('./api/indices.clear_cache.js')(opts), - close: require('./api/indices.close.js')(opts), - create: require('./api/indices.create.js')(opts), - delete: require('./api/indices.delete.js')(opts), - delete_alias: require('./api/indices.delete_alias.js')(opts), - delete_template: require('./api/indices.delete_template.js')(opts), - exists: require('./api/indices.exists.js')(opts), - exists_alias: require('./api/indices.exists_alias.js')(opts), - exists_template: require('./api/indices.exists_template.js')(opts), - exists_type: require('./api/indices.exists_type.js')(opts), - flush: require('./api/indices.flush.js')(opts), - flush_synced: require('./api/indices.flush_synced.js')(opts), - forcemerge: require('./api/indices.forcemerge.js')(opts), - get: require('./api/indices.get.js')(opts), - get_alias: require('./api/indices.get_alias.js')(opts), - get_field_mapping: require('./api/indices.get_field_mapping.js')(opts), - get_mapping: require('./api/indices.get_mapping.js')(opts), - get_settings: require('./api/indices.get_settings.js')(opts), - get_template: require('./api/indices.get_template.js')(opts), - get_upgrade: require('./api/indices.get_upgrade.js')(opts), - open: require('./api/indices.open.js')(opts), - put_alias: require('./api/indices.put_alias.js')(opts), - put_mapping: require('./api/indices.put_mapping.js')(opts), - put_settings: require('./api/indices.put_settings.js')(opts), - put_template: require('./api/indices.put_template.js')(opts), - recovery: require('./api/indices.recovery.js')(opts), - refresh: require('./api/indices.refresh.js')(opts), - rollover: require('./api/indices.rollover.js')(opts), - segments: require('./api/indices.segments.js')(opts), - shard_stores: require('./api/indices.shard_stores.js')(opts), - shrink: require('./api/indices.shrink.js')(opts), - split: require('./api/indices.split.js')(opts), - stats: require('./api/indices.stats.js')(opts), - update_aliases: require('./api/indices.update_aliases.js')(opts), - upgrade: require('./api/indices.upgrade.js')(opts), - validate_query: require('./api/indices.validate_query.js')(opts) + analyze: indicesAnalyze(opts), + clear_cache: indicesClearCache(opts), + clearCache: indicesClearCache(opts), + close: indicesClose(opts), + create: indicesCreate(opts), + delete: indicesDelete(opts), + delete_alias: indicesDeleteAlias(opts), + deleteAlias: indicesDeleteAlias(opts), + delete_template: indicesDeleteTemplate(opts), + deleteTemplate: indicesDeleteTemplate(opts), + exists: indicesExists(opts), + exists_alias: indicesExistsAlias(opts), + existsAlias: indicesExistsAlias(opts), + exists_template: indicesExistsTemplate(opts), + existsTemplate: indicesExistsTemplate(opts), + exists_type: indicesExistsType(opts), + existsType: indicesExistsType(opts), + flush: indicesFlush(opts), + flush_synced: indicesFlushSynced(opts), + flushSynced: indicesFlushSynced(opts), + forcemerge: indicesForcemerge(opts), + get: indicesGet(opts), + get_alias: indicesGetAlias(opts), + getAlias: indicesGetAlias(opts), + get_field_mapping: indicesGetFieldMapping(opts), + getFieldMapping: indicesGetFieldMapping(opts), + get_mapping: indicesGetMapping(opts), + getMapping: indicesGetMapping(opts), + get_settings: indicesGetSettings(opts), + getSettings: indicesGetSettings(opts), + get_template: indicesGetTemplate(opts), + getTemplate: indicesGetTemplate(opts), + get_upgrade: indicesGetUpgrade(opts), + getUpgrade: indicesGetUpgrade(opts), + open: indicesOpen(opts), + put_alias: indicesPutAlias(opts), + putAlias: indicesPutAlias(opts), + put_mapping: indicesPutMapping(opts), + putMapping: indicesPutMapping(opts), + put_settings: indicesPutSettings(opts), + putSettings: indicesPutSettings(opts), + put_template: indicesPutTemplate(opts), + putTemplate: indicesPutTemplate(opts), + recovery: indicesRecovery(opts), + refresh: indicesRefresh(opts), + rollover: indicesRollover(opts), + segments: indicesSegments(opts), + shard_stores: indicesShardStores(opts), + shardStores: indicesShardStores(opts), + shrink: indicesShrink(opts), + split: indicesSplit(opts), + stats: indicesStats(opts), + update_aliases: indicesUpdateAliases(opts), + updateAliases: indicesUpdateAliases(opts), + upgrade: indicesUpgrade(opts), + validate_query: indicesValidateQuery(opts), + validateQuery: indicesValidateQuery(opts) }, - info: require('./api/info.js')(opts), + info: info(opts), ingest: { - delete_pipeline: require('./api/ingest.delete_pipeline.js')(opts), - get_pipeline: require('./api/ingest.get_pipeline.js')(opts), - processor_grok: require('./api/ingest.processor_grok.js')(opts), - put_pipeline: require('./api/ingest.put_pipeline.js')(opts), - simulate: require('./api/ingest.simulate.js')(opts) + delete_pipeline: ingestDeletePipeline(opts), + deletePipeline: ingestDeletePipeline(opts), + get_pipeline: ingestGetPipeline(opts), + getPipeline: ingestGetPipeline(opts), + processor_grok: ingestProcessorGrok(opts), + processorGrok: ingestProcessorGrok(opts), + put_pipeline: ingestPutPipeline(opts), + putPipeline: ingestPutPipeline(opts), + simulate: ingestSimulate(opts) }, - mget: require('./api/mget.js')(opts), - msearch: require('./api/msearch.js')(opts), - msearch_template: require('./api/msearch_template.js')(opts), - mtermvectors: require('./api/mtermvectors.js')(opts), + mget: mget(opts), + msearch: msearch(opts), + msearch_template: msearchTemplate(opts), + msearchTemplate: msearchTemplate(opts), + mtermvectors: mtermvectors(opts), nodes: { - hot_threads: require('./api/nodes.hot_threads.js')(opts), - info: require('./api/nodes.info.js')(opts), - stats: require('./api/nodes.stats.js')(opts), - usage: require('./api/nodes.usage.js')(opts) + hot_threads: nodesHotThreads(opts), + hotThreads: nodesHotThreads(opts), + info: nodesInfo(opts), + stats: nodesStats(opts), + usage: nodesUsage(opts) }, - ping: require('./api/ping.js')(opts), - put_script: require('./api/put_script.js')(opts), - rank_eval: require('./api/rank_eval.js')(opts), - reindex: require('./api/reindex.js')(opts), - reindex_rethrottle: require('./api/reindex_rethrottle.js')(opts), - render_search_template: require('./api/render_search_template.js')(opts), - scripts_painless_execute: require('./api/scripts_painless_execute.js')(opts), - scroll: require('./api/scroll.js')(opts), - search: require('./api/search.js')(opts), - search_shards: require('./api/search_shards.js')(opts), - search_template: require('./api/search_template.js')(opts), + ping: ping(opts), + put_script: putScript(opts), + putScript: putScript(opts), + rank_eval: rankEval(opts), + rankEval: rankEval(opts), + reindex: reindex(opts), + reindex_rethrottle: reindexRethrottle(opts), + reindexRethrottle: reindexRethrottle(opts), + render_search_template: renderSearchTemplate(opts), + renderSearchTemplate: renderSearchTemplate(opts), + scripts_painless_execute: scriptsPainlessExecute(opts), + scriptsPainlessExecute: scriptsPainlessExecute(opts), + scroll: scroll(opts), + search: search(opts), + search_shards: searchShards(opts), + searchShards: searchShards(opts), + search_template: searchTemplate(opts), + searchTemplate: searchTemplate(opts), snapshot: { - create: require('./api/snapshot.create.js')(opts), - create_repository: require('./api/snapshot.create_repository.js')(opts), - delete: require('./api/snapshot.delete.js')(opts), - delete_repository: require('./api/snapshot.delete_repository.js')(opts), - get: require('./api/snapshot.get.js')(opts), - get_repository: require('./api/snapshot.get_repository.js')(opts), - restore: require('./api/snapshot.restore.js')(opts), - status: require('./api/snapshot.status.js')(opts), - verify_repository: require('./api/snapshot.verify_repository.js')(opts) + create: snapshotCreate(opts), + create_repository: snapshotCreateRepository(opts), + createRepository: snapshotCreateRepository(opts), + delete: snapshotDelete(opts), + delete_repository: snapshotDeleteRepository(opts), + deleteRepository: snapshotDeleteRepository(opts), + get: snapshotGet(opts), + get_repository: snapshotGetRepository(opts), + getRepository: snapshotGetRepository(opts), + restore: snapshotRestore(opts), + status: snapshotStatus(opts), + verify_repository: snapshotVerifyRepository(opts), + verifyRepository: snapshotVerifyRepository(opts) }, tasks: { - cancel: require('./api/tasks.cancel.js')(opts), - get: require('./api/tasks.get.js')(opts), - list: require('./api/tasks.list.js')(opts) + cancel: tasksCancel(opts), + get: tasksGet(opts), + list: tasksList(opts) }, - termvectors: require('./api/termvectors.js')(opts), - update: require('./api/update.js')(opts), - update_by_query: require('./api/update_by_query.js')(opts) + termvectors: termvectors(opts), + update: update(opts), + update_by_query: updateByQuery(opts), + updateByQuery: updateByQuery(opts), + xpack: { + graph: { + explore: xpackGraphExplore(opts) + }, + info: xpackInfo(opts), + license: { + delete: xpackLicenseDelete(opts), + get: xpackLicenseGet(opts), + get_basic_status: xpackLicenseGetBasicStatus(opts), + getBasicStatus: xpackLicenseGetBasicStatus(opts), + get_trial_status: xpackLicenseGetTrialStatus(opts), + getTrialStatus: xpackLicenseGetTrialStatus(opts), + post: xpackLicensePost(opts), + post_start_basic: xpackLicensePostStartBasic(opts), + postStartBasic: xpackLicensePostStartBasic(opts), + post_start_trial: xpackLicensePostStartTrial(opts), + postStartTrial: xpackLicensePostStartTrial(opts) + }, + migration: { + deprecations: xpackMigrationDeprecations(opts), + get_assistance: xpackMigrationGetAssistance(opts), + getAssistance: xpackMigrationGetAssistance(opts), + upgrade: xpackMigrationUpgrade(opts) + }, + ml: { + close_job: xpackMlCloseJob(opts), + closeJob: xpackMlCloseJob(opts), + delete_calendar: xpackMlDeleteCalendar(opts), + deleteCalendar: xpackMlDeleteCalendar(opts), + delete_calendar_event: xpackMlDeleteCalendarEvent(opts), + deleteCalendarEvent: xpackMlDeleteCalendarEvent(opts), + delete_calendar_job: xpackMlDeleteCalendarJob(opts), + deleteCalendarJob: xpackMlDeleteCalendarJob(opts), + delete_datafeed: xpackMlDeleteDatafeed(opts), + deleteDatafeed: xpackMlDeleteDatafeed(opts), + delete_expired_data: xpackMlDeleteExpiredData(opts), + deleteExpiredData: xpackMlDeleteExpiredData(opts), + delete_filter: xpackMlDeleteFilter(opts), + deleteFilter: xpackMlDeleteFilter(opts), + delete_job: xpackMlDeleteJob(opts), + deleteJob: xpackMlDeleteJob(opts), + delete_model_snapshot: xpackMlDeleteModelSnapshot(opts), + deleteModelSnapshot: xpackMlDeleteModelSnapshot(opts), + flush_job: xpackMlFlushJob(opts), + flushJob: xpackMlFlushJob(opts), + forecast: xpackMlForecast(opts), + get_buckets: xpackMlGetBuckets(opts), + getBuckets: xpackMlGetBuckets(opts), + get_calendar_events: xpackMlGetCalendarEvents(opts), + getCalendarEvents: xpackMlGetCalendarEvents(opts), + get_calendars: xpackMlGetCalendars(opts), + getCalendars: xpackMlGetCalendars(opts), + get_categories: xpackMlGetCategories(opts), + getCategories: xpackMlGetCategories(opts), + get_datafeed_stats: xpackMlGetDatafeedStats(opts), + getDatafeedStats: xpackMlGetDatafeedStats(opts), + get_datafeeds: xpackMlGetDatafeeds(opts), + getDatafeeds: xpackMlGetDatafeeds(opts), + get_filters: xpackMlGetFilters(opts), + getFilters: xpackMlGetFilters(opts), + get_influencers: xpackMlGetInfluencers(opts), + getInfluencers: xpackMlGetInfluencers(opts), + get_job_stats: xpackMlGetJobStats(opts), + getJobStats: xpackMlGetJobStats(opts), + get_jobs: xpackMlGetJobs(opts), + getJobs: xpackMlGetJobs(opts), + get_model_snapshots: xpackMlGetModelSnapshots(opts), + getModelSnapshots: xpackMlGetModelSnapshots(opts), + get_overall_buckets: xpackMlGetOverallBuckets(opts), + getOverallBuckets: xpackMlGetOverallBuckets(opts), + get_records: xpackMlGetRecords(opts), + getRecords: xpackMlGetRecords(opts), + info: xpackMlInfo(opts), + open_job: xpackMlOpenJob(opts), + openJob: xpackMlOpenJob(opts), + post_calendar_events: xpackMlPostCalendarEvents(opts), + postCalendarEvents: xpackMlPostCalendarEvents(opts), + post_data: xpackMlPostData(opts), + postData: xpackMlPostData(opts), + preview_datafeed: xpackMlPreviewDatafeed(opts), + previewDatafeed: xpackMlPreviewDatafeed(opts), + put_calendar: xpackMlPutCalendar(opts), + putCalendar: xpackMlPutCalendar(opts), + put_calendar_job: xpackMlPutCalendarJob(opts), + putCalendarJob: xpackMlPutCalendarJob(opts), + put_datafeed: xpackMlPutDatafeed(opts), + putDatafeed: xpackMlPutDatafeed(opts), + put_filter: xpackMlPutFilter(opts), + putFilter: xpackMlPutFilter(opts), + put_job: xpackMlPutJob(opts), + putJob: xpackMlPutJob(opts), + revert_model_snapshot: xpackMlRevertModelSnapshot(opts), + revertModelSnapshot: xpackMlRevertModelSnapshot(opts), + start_datafeed: xpackMlStartDatafeed(opts), + startDatafeed: xpackMlStartDatafeed(opts), + stop_datafeed: xpackMlStopDatafeed(opts), + stopDatafeed: xpackMlStopDatafeed(opts), + update_datafeed: xpackMlUpdateDatafeed(opts), + updateDatafeed: xpackMlUpdateDatafeed(opts), + update_filter: xpackMlUpdateFilter(opts), + updateFilter: xpackMlUpdateFilter(opts), + update_job: xpackMlUpdateJob(opts), + updateJob: xpackMlUpdateJob(opts), + update_model_snapshot: xpackMlUpdateModelSnapshot(opts), + updateModelSnapshot: xpackMlUpdateModelSnapshot(opts), + validate: xpackMlValidate(opts), + validate_detector: xpackMlValidateDetector(opts), + validateDetector: xpackMlValidateDetector(opts) + }, + monitoring: { + bulk: xpackMonitoringBulk(opts) + }, + rollup: { + delete_job: xpackRollupDeleteJob(opts), + deleteJob: xpackRollupDeleteJob(opts), + get_jobs: xpackRollupGetJobs(opts), + getJobs: xpackRollupGetJobs(opts), + get_rollup_caps: xpackRollupGetRollupCaps(opts), + getRollupCaps: xpackRollupGetRollupCaps(opts), + get_rollup_index_caps: xpackRollupGetRollupIndexCaps(opts), + getRollupIndexCaps: xpackRollupGetRollupIndexCaps(opts), + put_job: xpackRollupPutJob(opts), + putJob: xpackRollupPutJob(opts), + rollup_search: xpackRollupRollupSearch(opts), + rollupSearch: xpackRollupRollupSearch(opts), + start_job: xpackRollupStartJob(opts), + startJob: xpackRollupStartJob(opts), + stop_job: xpackRollupStopJob(opts), + stopJob: xpackRollupStopJob(opts) + }, + security: { + authenticate: xpackSecurityAuthenticate(opts), + change_password: xpackSecurityChangePassword(opts), + changePassword: xpackSecurityChangePassword(opts), + clear_cached_realms: xpackSecurityClearCachedRealms(opts), + clearCachedRealms: xpackSecurityClearCachedRealms(opts), + clear_cached_roles: xpackSecurityClearCachedRoles(opts), + clearCachedRoles: xpackSecurityClearCachedRoles(opts), + delete_privileges: xpackSecurityDeletePrivileges(opts), + deletePrivileges: xpackSecurityDeletePrivileges(opts), + delete_role: xpackSecurityDeleteRole(opts), + deleteRole: xpackSecurityDeleteRole(opts), + delete_role_mapping: xpackSecurityDeleteRoleMapping(opts), + deleteRoleMapping: xpackSecurityDeleteRoleMapping(opts), + delete_user: xpackSecurityDeleteUser(opts), + deleteUser: xpackSecurityDeleteUser(opts), + disable_user: xpackSecurityDisableUser(opts), + disableUser: xpackSecurityDisableUser(opts), + enable_user: xpackSecurityEnableUser(opts), + enableUser: xpackSecurityEnableUser(opts), + get_privileges: xpackSecurityGetPrivileges(opts), + getPrivileges: xpackSecurityGetPrivileges(opts), + get_role: xpackSecurityGetRole(opts), + getRole: xpackSecurityGetRole(opts), + get_role_mapping: xpackSecurityGetRoleMapping(opts), + getRoleMapping: xpackSecurityGetRoleMapping(opts), + get_token: xpackSecurityGetToken(opts), + getToken: xpackSecurityGetToken(opts), + get_user: xpackSecurityGetUser(opts), + getUser: xpackSecurityGetUser(opts), + has_privileges: xpackSecurityHasPrivileges(opts), + hasPrivileges: xpackSecurityHasPrivileges(opts), + invalidate_token: xpackSecurityInvalidateToken(opts), + invalidateToken: xpackSecurityInvalidateToken(opts), + put_privileges: xpackSecurityPutPrivileges(opts), + putPrivileges: xpackSecurityPutPrivileges(opts), + put_role: xpackSecurityPutRole(opts), + putRole: xpackSecurityPutRole(opts), + put_role_mapping: xpackSecurityPutRoleMapping(opts), + putRoleMapping: xpackSecurityPutRoleMapping(opts), + put_user: xpackSecurityPutUser(opts), + putUser: xpackSecurityPutUser(opts) + }, + sql: { + clear_cursor: xpackSqlClearCursor(opts), + clearCursor: xpackSqlClearCursor(opts), + query: xpackSqlQuery(opts), + translate: xpackSqlTranslate(opts) + }, + ssl: { + certificates: xpackSslCertificates(opts) + }, + usage: xpackUsage(opts), + watcher: { + ack_watch: xpackWatcherAckWatch(opts), + ackWatch: xpackWatcherAckWatch(opts), + activate_watch: xpackWatcherActivateWatch(opts), + activateWatch: xpackWatcherActivateWatch(opts), + deactivate_watch: xpackWatcherDeactivateWatch(opts), + deactivateWatch: xpackWatcherDeactivateWatch(opts), + delete_watch: xpackWatcherDeleteWatch(opts), + deleteWatch: xpackWatcherDeleteWatch(opts), + execute_watch: xpackWatcherExecuteWatch(opts), + executeWatch: xpackWatcherExecuteWatch(opts), + get_watch: xpackWatcherGetWatch(opts), + getWatch: xpackWatcherGetWatch(opts), + put_watch: xpackWatcherPutWatch(opts), + putWatch: xpackWatcherPutWatch(opts), + restart: xpackWatcherRestart(opts), + start: xpackWatcherStart(opts), + stats: xpackWatcherStats(opts), + stop: xpackWatcherStop(opts) + } + } } - Object.defineProperties(apis.cat, { - pendingTasks: { - get: function () { return this.pending_tasks }, - enumerable: true - }, - threadPool: { - get: function () { return this.thread_pool }, - enumerable: true - } - }) - - Object.defineProperties(apis, { - clearScroll: { - get: function () { return this.clear_scroll }, - enumerable: true - }, - deleteByQuery: { - get: function () { return this.delete_by_query }, - enumerable: true - }, - deleteScript: { - get: function () { return this.delete_script }, - enumerable: true - }, - existsSource: { - get: function () { return this.exists_source }, - enumerable: true - }, - fieldCaps: { - get: function () { return this.field_caps }, - enumerable: true - }, - getScript: { - get: function () { return this.get_script }, - enumerable: true - }, - getSource: { - get: function () { return this.get_source }, - enumerable: true - }, - msearchTemplate: { - get: function () { return this.msearch_template }, - enumerable: true - }, - putScript: { - get: function () { return this.put_script }, - enumerable: true - }, - rankEval: { - get: function () { return this.rank_eval }, - enumerable: true - }, - reindexRethrottle: { - get: function () { return this.reindex_rethrottle }, - enumerable: true - }, - renderSearchTemplate: { - get: function () { return this.render_search_template }, - enumerable: true - }, - scriptsPainlessExecute: { - get: function () { return this.scripts_painless_execute }, - enumerable: true - }, - searchShards: { - get: function () { return this.search_shards }, - enumerable: true - }, - searchTemplate: { - get: function () { return this.search_template }, - enumerable: true - }, - updateByQuery: { - get: function () { return this.update_by_query }, - enumerable: true - } - }) - - Object.defineProperties(apis.cluster, { - allocationExplain: { - get: function () { return this.allocation_explain }, - enumerable: true - }, - getSettings: { - get: function () { return this.get_settings }, - enumerable: true - }, - pendingTasks: { - get: function () { return this.pending_tasks }, - enumerable: true - }, - putSettings: { - get: function () { return this.put_settings }, - enumerable: true - }, - remoteInfo: { - get: function () { return this.remote_info }, - enumerable: true - } - }) - - Object.defineProperties(apis.indices, { - clearCache: { - get: function () { return this.clear_cache }, - enumerable: true - }, - deleteAlias: { - get: function () { return this.delete_alias }, - enumerable: true - }, - deleteTemplate: { - get: function () { return this.delete_template }, - enumerable: true - }, - existsAlias: { - get: function () { return this.exists_alias }, - enumerable: true - }, - existsTemplate: { - get: function () { return this.exists_template }, - enumerable: true - }, - existsType: { - get: function () { return this.exists_type }, - enumerable: true - }, - flushSynced: { - get: function () { return this.flush_synced }, - enumerable: true - }, - getAlias: { - get: function () { return this.get_alias }, - enumerable: true - }, - getFieldMapping: { - get: function () { return this.get_field_mapping }, - enumerable: true - }, - getMapping: { - get: function () { return this.get_mapping }, - enumerable: true - }, - getSettings: { - get: function () { return this.get_settings }, - enumerable: true - }, - getTemplate: { - get: function () { return this.get_template }, - enumerable: true - }, - getUpgrade: { - get: function () { return this.get_upgrade }, - enumerable: true - }, - putAlias: { - get: function () { return this.put_alias }, - enumerable: true - }, - putMapping: { - get: function () { return this.put_mapping }, - enumerable: true - }, - putSettings: { - get: function () { return this.put_settings }, - enumerable: true - }, - putTemplate: { - get: function () { return this.put_template }, - enumerable: true - }, - shardStores: { - get: function () { return this.shard_stores }, - enumerable: true - }, - updateAliases: { - get: function () { return this.update_aliases }, - enumerable: true - }, - validateQuery: { - get: function () { return this.validate_query }, - enumerable: true - } - }) - - Object.defineProperties(apis.ingest, { - deletePipeline: { - get: function () { return this.delete_pipeline }, - enumerable: true - }, - getPipeline: { - get: function () { return this.get_pipeline }, - enumerable: true - }, - processorGrok: { - get: function () { return this.processor_grok }, - enumerable: true - }, - putPipeline: { - get: function () { return this.put_pipeline }, - enumerable: true - } - }) - - Object.defineProperties(apis.nodes, { - hotThreads: { - get: function () { return this.hot_threads }, - enumerable: true - } - }) - - Object.defineProperties(apis.snapshot, { - createRepository: { - get: function () { return this.create_repository }, - enumerable: true - }, - deleteRepository: { - get: function () { return this.delete_repository }, - enumerable: true - }, - getRepository: { - get: function () { return this.get_repository }, - enumerable: true - }, - verifyRepository: { - get: function () { return this.verify_repository }, - enumerable: true - } - }) - return apis }