API generation

This commit is contained in:
delvedor
2018-11-08 19:35:51 +01:00
parent e97f66b0c3
commit 08e9ff398f
102 changed files with 10474 additions and 350 deletions

View File

@ -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

92
api/api/xpack.info.js Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

83
api/api/xpack.ml.info.js Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

92
api/api/xpack.usage.js Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More