API generation
This commit is contained in:
98
api/api/xpack.graph.explore.js
Normal file
98
api/api/xpack.graph.explore.js
Normal 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
92
api/api/xpack.info.js
Normal 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
|
||||
91
api/api/xpack.license.delete.js
Normal file
91
api/api/xpack.license.delete.js
Normal 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
|
||||
92
api/api/xpack.license.get.js
Normal file
92
api/api/xpack.license.get.js
Normal 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
|
||||
91
api/api/xpack.license.get_basic_status.js
Normal file
91
api/api/xpack.license.get_basic_status.js
Normal 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
|
||||
91
api/api/xpack.license.get_trial_status.js
Normal file
91
api/api/xpack.license.get_trial_status.js
Normal 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
|
||||
85
api/api/xpack.license.post.js
Normal file
85
api/api/xpack.license.post.js
Normal 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
|
||||
92
api/api/xpack.license.post_start_basic.js
Normal file
92
api/api/xpack.license.post_start_basic.js
Normal 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
|
||||
95
api/api/xpack.license.post_start_trial.js
Normal file
95
api/api/xpack.license.post_start_trial.js
Normal 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
|
||||
92
api/api/xpack.migration.deprecations.js
Normal file
92
api/api/xpack.migration.deprecations.js
Normal 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
|
||||
91
api/api/xpack.migration.get_assistance.js
Normal file
91
api/api/xpack.migration.get_assistance.js
Normal 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
|
||||
93
api/api/xpack.migration.upgrade.js
Normal file
93
api/api/xpack.migration.upgrade.js
Normal 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
|
||||
99
api/api/xpack.ml.close_job.js
Normal file
99
api/api/xpack.ml.close_job.js
Normal 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
|
||||
98
api/api/xpack.ml.delete_calendar.js
Normal file
98
api/api/xpack.ml.delete_calendar.js
Normal 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
|
||||
113
api/api/xpack.ml.delete_calendar_event.js
Normal file
113
api/api/xpack.ml.delete_calendar_event.js
Normal 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
|
||||
113
api/api/xpack.ml.delete_calendar_job.js
Normal file
113
api/api/xpack.ml.delete_calendar_job.js
Normal 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
|
||||
99
api/api/xpack.ml.delete_datafeed.js
Normal file
99
api/api/xpack.ml.delete_datafeed.js
Normal 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
|
||||
91
api/api/xpack.ml.delete_expired_data.js
Normal file
91
api/api/xpack.ml.delete_expired_data.js
Normal 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
|
||||
98
api/api/xpack.ml.delete_filter.js
Normal file
98
api/api/xpack.ml.delete_filter.js
Normal 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
|
||||
99
api/api/xpack.ml.delete_job.js
Normal file
99
api/api/xpack.ml.delete_job.js
Normal 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
|
||||
113
api/api/xpack.ml.delete_model_snapshot.js
Normal file
113
api/api/xpack.ml.delete_model_snapshot.js
Normal 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
|
||||
106
api/api/xpack.ml.flush_job.js
Normal file
106
api/api/xpack.ml.flush_job.js
Normal 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
|
||||
102
api/api/xpack.ml.forecast.js
Normal file
102
api/api/xpack.ml.forecast.js
Normal 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
|
||||
127
api/api/xpack.ml.get_buckets.js
Normal file
127
api/api/xpack.ml.get_buckets.js
Normal 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
|
||||
111
api/api/xpack.ml.get_calendar_events.js
Normal file
111
api/api/xpack.ml.get_calendar_events.js
Normal 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
|
||||
96
api/api/xpack.ml.get_calendars.js
Normal file
96
api/api/xpack.ml.get_calendars.js
Normal 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
|
||||
100
api/api/xpack.ml.get_categories.js
Normal file
100
api/api/xpack.ml.get_categories.js
Normal 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
|
||||
93
api/api/xpack.ml.get_datafeed_stats.js
Normal file
93
api/api/xpack.ml.get_datafeed_stats.js
Normal 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
|
||||
93
api/api/xpack.ml.get_datafeeds.js
Normal file
93
api/api/xpack.ml.get_datafeeds.js
Normal 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
|
||||
96
api/api/xpack.ml.get_filters.js
Normal file
96
api/api/xpack.ml.get_filters.js
Normal 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
|
||||
115
api/api/xpack.ml.get_influencers.js
Normal file
115
api/api/xpack.ml.get_influencers.js
Normal 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
|
||||
93
api/api/xpack.ml.get_job_stats.js
Normal file
93
api/api/xpack.ml.get_job_stats.js
Normal 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
|
||||
93
api/api/xpack.ml.get_jobs.js
Normal file
93
api/api/xpack.ml.get_jobs.js
Normal 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
|
||||
118
api/api/xpack.ml.get_model_snapshots.js
Normal file
118
api/api/xpack.ml.get_model_snapshots.js
Normal 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
|
||||
112
api/api/xpack.ml.get_overall_buckets.js
Normal file
112
api/api/xpack.ml.get_overall_buckets.js
Normal 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
|
||||
115
api/api/xpack.ml.get_records.js
Normal file
115
api/api/xpack.ml.get_records.js
Normal 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
83
api/api/xpack.ml.info.js
Normal 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
|
||||
100
api/api/xpack.ml.open_job.js
Normal file
100
api/api/xpack.ml.open_job.js
Normal 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
|
||||
99
api/api/xpack.ml.post_calendar_events.js
Normal file
99
api/api/xpack.ml.post_calendar_events.js
Normal 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
|
||||
103
api/api/xpack.ml.post_data.js
Normal file
103
api/api/xpack.ml.post_data.js
Normal 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
|
||||
98
api/api/xpack.ml.preview_datafeed.js
Normal file
98
api/api/xpack.ml.preview_datafeed.js
Normal 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
|
||||
93
api/api/xpack.ml.put_calendar.js
Normal file
93
api/api/xpack.ml.put_calendar.js
Normal 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
|
||||
113
api/api/xpack.ml.put_calendar_job.js
Normal file
113
api/api/xpack.ml.put_calendar_job.js
Normal 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
|
||||
99
api/api/xpack.ml.put_datafeed.js
Normal file
99
api/api/xpack.ml.put_datafeed.js
Normal 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
|
||||
99
api/api/xpack.ml.put_filter.js
Normal file
99
api/api/xpack.ml.put_filter.js
Normal 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
|
||||
99
api/api/xpack.ml.put_job.js
Normal file
99
api/api/xpack.ml.put_job.js
Normal 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
|
||||
109
api/api/xpack.ml.revert_model_snapshot.js
Normal file
109
api/api/xpack.ml.revert_model_snapshot.js
Normal 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
|
||||
100
api/api/xpack.ml.start_datafeed.js
Normal file
100
api/api/xpack.ml.start_datafeed.js
Normal 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
|
||||
99
api/api/xpack.ml.stop_datafeed.js
Normal file
99
api/api/xpack.ml.stop_datafeed.js
Normal 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
|
||||
99
api/api/xpack.ml.update_datafeed.js
Normal file
99
api/api/xpack.ml.update_datafeed.js
Normal 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
|
||||
99
api/api/xpack.ml.update_filter.js
Normal file
99
api/api/xpack.ml.update_filter.js
Normal 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
|
||||
99
api/api/xpack.ml.update_job.js
Normal file
99
api/api/xpack.ml.update_job.js
Normal 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
|
||||
114
api/api/xpack.ml.update_model_snapshot.js
Normal file
114
api/api/xpack.ml.update_model_snapshot.js
Normal 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
|
||||
92
api/api/xpack.ml.validate.js
Normal file
92
api/api/xpack.ml.validate.js
Normal 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
|
||||
92
api/api/xpack.ml.validate_detector.js
Normal file
92
api/api/xpack.ml.validate_detector.js
Normal 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
|
||||
100
api/api/xpack.monitoring.bulk.js
Normal file
100
api/api/xpack.monitoring.bulk.js
Normal 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
|
||||
92
api/api/xpack.rollup.delete_job.js
Normal file
92
api/api/xpack.rollup.delete_job.js
Normal 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
|
||||
84
api/api/xpack.rollup.get_jobs.js
Normal file
84
api/api/xpack.rollup.get_jobs.js
Normal 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
|
||||
84
api/api/xpack.rollup.get_rollup_caps.js
Normal file
84
api/api/xpack.rollup.get_rollup_caps.js
Normal 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
|
||||
92
api/api/xpack.rollup.get_rollup_index_caps.js
Normal file
92
api/api/xpack.rollup.get_rollup_index_caps.js
Normal 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
|
||||
99
api/api/xpack.rollup.put_job.js
Normal file
99
api/api/xpack.rollup.put_job.js
Normal 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
|
||||
110
api/api/xpack.rollup.rollup_search.js
Normal file
110
api/api/xpack.rollup.rollup_search.js
Normal 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
|
||||
92
api/api/xpack.rollup.start_job.js
Normal file
92
api/api/xpack.rollup.start_job.js
Normal 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
|
||||
92
api/api/xpack.rollup.stop_job.js
Normal file
92
api/api/xpack.rollup.stop_job.js
Normal 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
|
||||
91
api/api/xpack.security.authenticate.js
Normal file
91
api/api/xpack.security.authenticate.js
Normal 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
|
||||
94
api/api/xpack.security.change_password.js
Normal file
94
api/api/xpack.security.change_password.js
Normal 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
|
||||
99
api/api/xpack.security.clear_cached_realms.js
Normal file
99
api/api/xpack.security.clear_cached_realms.js
Normal 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
|
||||
98
api/api/xpack.security.clear_cached_roles.js
Normal file
98
api/api/xpack.security.clear_cached_roles.js
Normal 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
|
||||
114
api/api/xpack.security.delete_privileges.js
Normal file
114
api/api/xpack.security.delete_privileges.js
Normal 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
|
||||
99
api/api/xpack.security.delete_role.js
Normal file
99
api/api/xpack.security.delete_role.js
Normal 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
|
||||
99
api/api/xpack.security.delete_role_mapping.js
Normal file
99
api/api/xpack.security.delete_role_mapping.js
Normal 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
|
||||
99
api/api/xpack.security.delete_user.js
Normal file
99
api/api/xpack.security.delete_user.js
Normal 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
|
||||
93
api/api/xpack.security.disable_user.js
Normal file
93
api/api/xpack.security.disable_user.js
Normal 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
|
||||
93
api/api/xpack.security.enable_user.js
Normal file
93
api/api/xpack.security.enable_user.js
Normal 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
|
||||
101
api/api/xpack.security.get_privileges.js
Normal file
101
api/api/xpack.security.get_privileges.js
Normal 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
|
||||
92
api/api/xpack.security.get_role.js
Normal file
92
api/api/xpack.security.get_role.js
Normal 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
|
||||
92
api/api/xpack.security.get_role_mapping.js
Normal file
92
api/api/xpack.security.get_role_mapping.js
Normal 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
|
||||
92
api/api/xpack.security.get_token.js
Normal file
92
api/api/xpack.security.get_token.js
Normal 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
|
||||
92
api/api/xpack.security.get_user.js
Normal file
92
api/api/xpack.security.get_user.js
Normal 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
|
||||
93
api/api/xpack.security.has_privileges.js
Normal file
93
api/api/xpack.security.has_privileges.js
Normal 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
|
||||
92
api/api/xpack.security.invalidate_token.js
Normal file
92
api/api/xpack.security.invalidate_token.js
Normal 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
|
||||
93
api/api/xpack.security.put_privileges.js
Normal file
93
api/api/xpack.security.put_privileges.js
Normal 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
|
||||
100
api/api/xpack.security.put_role.js
Normal file
100
api/api/xpack.security.put_role.js
Normal 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
|
||||
100
api/api/xpack.security.put_role_mapping.js
Normal file
100
api/api/xpack.security.put_role_mapping.js
Normal 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
|
||||
100
api/api/xpack.security.put_user.js
Normal file
100
api/api/xpack.security.put_user.js
Normal 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
|
||||
92
api/api/xpack.sql.clear_cursor.js
Normal file
92
api/api/xpack.sql.clear_cursor.js
Normal 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
|
||||
93
api/api/xpack.sql.query.js
Normal file
93
api/api/xpack.sql.query.js
Normal 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
|
||||
92
api/api/xpack.sql.translate.js
Normal file
92
api/api/xpack.sql.translate.js
Normal 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
|
||||
91
api/api/xpack.ssl.certificates.js
Normal file
91
api/api/xpack.ssl.certificates.js
Normal 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
92
api/api/xpack.usage.js
Normal 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
|
||||
108
api/api/xpack.watcher.ack_watch.js
Normal file
108
api/api/xpack.watcher.ack_watch.js
Normal 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
|
||||
99
api/api/xpack.watcher.activate_watch.js
Normal file
99
api/api/xpack.watcher.activate_watch.js
Normal 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
|
||||
99
api/api/xpack.watcher.deactivate_watch.js
Normal file
99
api/api/xpack.watcher.deactivate_watch.js
Normal 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
|
||||
99
api/api/xpack.watcher.delete_watch.js
Normal file
99
api/api/xpack.watcher.delete_watch.js
Normal 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
|
||||
86
api/api/xpack.watcher.execute_watch.js
Normal file
86
api/api/xpack.watcher.execute_watch.js
Normal 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
|
||||
98
api/api/xpack.watcher.get_watch.js
Normal file
98
api/api/xpack.watcher.get_watch.js
Normal 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
|
||||
100
api/api/xpack.watcher.put_watch.js
Normal file
100
api/api/xpack.watcher.put_watch.js
Normal 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
|
||||
91
api/api/xpack.watcher.restart.js
Normal file
91
api/api/xpack.watcher.restart.js
Normal 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
|
||||
91
api/api/xpack.watcher.start.js
Normal file
91
api/api/xpack.watcher.start.js
Normal 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
|
||||
96
api/api/xpack.watcher.stats.js
Normal file
96
api/api/xpack.watcher.stats.js
Normal 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
Reference in New Issue
Block a user