API generation
This commit is contained in:
@ -14,14 +14,18 @@ function buildIlmExplainLifecycle (opts) {
|
|||||||
* Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request
|
* Perform a [ilm.explain_lifecycle](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html) request
|
||||||
*
|
*
|
||||||
* @param {string} index - The name of the index to explain
|
* @param {string} index - The name of the index to explain
|
||||||
|
* @param {boolean} only_managed - filters the indices included in the response to ones managed by ILM
|
||||||
|
* @param {boolean} only_errors - filters the indices included in the response to ones in an ILM error state, implies only_managed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const acceptedQuerystring = [
|
const acceptedQuerystring = [
|
||||||
|
'only_managed',
|
||||||
|
'only_errors'
|
||||||
]
|
]
|
||||||
|
|
||||||
const snakeCase = {
|
const snakeCase = {
|
||||||
|
onlyManaged: 'only_managed',
|
||||||
|
onlyErrors: 'only_errors'
|
||||||
}
|
}
|
||||||
|
|
||||||
return function ilmExplainLifecycle (params, options, callback) {
|
return function ilmExplainLifecycle (params, options, callback) {
|
||||||
|
|||||||
106
api/api/indices.clone.js
Normal file
106
api/api/indices.clone.js
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
// Licensed to Elasticsearch B.V under one or more agreements.
|
||||||
|
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||||
|
// See the LICENSE file in the project root for more information
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/* eslint camelcase: 0 */
|
||||||
|
/* eslint no-unused-vars: 0 */
|
||||||
|
|
||||||
|
function buildIndicesClone (opts) {
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||||
|
/**
|
||||||
|
* Perform a [indices.clone](http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html) request
|
||||||
|
*
|
||||||
|
* @param {string} index - The name of the source index to clone
|
||||||
|
* @param {string} target - The name of the target index to clone into
|
||||||
|
* @param {time} timeout - Explicit operation timeout
|
||||||
|
* @param {time} master_timeout - Specify timeout for connection to master
|
||||||
|
* @param {string} wait_for_active_shards - Set the number of active shards to wait for on the cloned index before the operation returns.
|
||||||
|
* @param {object} body - The configuration for the target index (`settings` and `aliases`)
|
||||||
|
*/
|
||||||
|
|
||||||
|
const acceptedQuerystring = [
|
||||||
|
'timeout',
|
||||||
|
'master_timeout',
|
||||||
|
'wait_for_active_shards',
|
||||||
|
'pretty',
|
||||||
|
'human',
|
||||||
|
'error_trace',
|
||||||
|
'source',
|
||||||
|
'filter_path'
|
||||||
|
]
|
||||||
|
|
||||||
|
const snakeCase = {
|
||||||
|
masterTimeout: 'master_timeout',
|
||||||
|
waitForActiveShards: 'wait_for_active_shards',
|
||||||
|
errorTrace: 'error_trace',
|
||||||
|
filterPath: 'filter_path'
|
||||||
|
}
|
||||||
|
|
||||||
|
return function indicesClone (params, options, callback) {
|
||||||
|
options = options || {}
|
||||||
|
if (typeof options === 'function') {
|
||||||
|
callback = options
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
|
if (typeof params === 'function' || params == null) {
|
||||||
|
callback = params
|
||||||
|
params = {}
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check required parameters
|
||||||
|
if (params['index'] == null) {
|
||||||
|
const err = new ConfigurationError('Missing required parameter: index')
|
||||||
|
return handleError(err, callback)
|
||||||
|
}
|
||||||
|
if (params['target'] == null) {
|
||||||
|
const err = new ConfigurationError('Missing required parameter: target')
|
||||||
|
return handleError(err, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
// check required url components
|
||||||
|
if (params['target'] != null && (params['index'] == null)) {
|
||||||
|
const err = new ConfigurationError('Missing required parameter of the url: index')
|
||||||
|
return handleError(err, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate headers object
|
||||||
|
if (options.headers != null && typeof options.headers !== 'object') {
|
||||||
|
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||||
|
return handleError(err, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
var warnings = []
|
||||||
|
var { method, body, index, target, ...querystring } = params
|
||||||
|
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||||
|
|
||||||
|
if (method == null) {
|
||||||
|
method = 'PUT'
|
||||||
|
}
|
||||||
|
|
||||||
|
var ignore = options.ignore
|
||||||
|
if (typeof ignore === 'number') {
|
||||||
|
options.ignore = [ignore]
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = ''
|
||||||
|
|
||||||
|
path = '/' + encodeURIComponent(index) + '/' + '_clone' + '/' + encodeURIComponent(target)
|
||||||
|
|
||||||
|
// build request object
|
||||||
|
const request = {
|
||||||
|
method,
|
||||||
|
path,
|
||||||
|
body: body || '',
|
||||||
|
querystring
|
||||||
|
}
|
||||||
|
|
||||||
|
options.warnings = warnings.length === 0 ? null : warnings
|
||||||
|
return makeRequest(request, options, callback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = buildIndicesClone
|
||||||
@ -159,6 +159,7 @@ function ESAPI (opts) {
|
|||||||
analyze: lazyLoad('indices.analyze', opts),
|
analyze: lazyLoad('indices.analyze', opts),
|
||||||
clear_cache: lazyLoad('indices.clear_cache', opts),
|
clear_cache: lazyLoad('indices.clear_cache', opts),
|
||||||
clearCache: lazyLoad('indices.clear_cache', opts),
|
clearCache: lazyLoad('indices.clear_cache', opts),
|
||||||
|
clone: lazyLoad('indices.clone', opts),
|
||||||
close: lazyLoad('indices.close', opts),
|
close: lazyLoad('indices.close', opts),
|
||||||
create: lazyLoad('indices.create', opts),
|
create: lazyLoad('indices.create', opts),
|
||||||
delete: lazyLoad('indices.delete', opts),
|
delete: lazyLoad('indices.delete', opts),
|
||||||
|
|||||||
11
api/requestParams.d.ts
vendored
11
api/requestParams.d.ts
vendored
@ -558,6 +558,15 @@ export interface IndicesClearCache extends Generic {
|
|||||||
request?: boolean;
|
request?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IndicesClone<T = any> extends Generic {
|
||||||
|
index: string;
|
||||||
|
target: string;
|
||||||
|
timeout?: string;
|
||||||
|
master_timeout?: string;
|
||||||
|
wait_for_active_shards?: string;
|
||||||
|
body?: T;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IndicesClose extends Generic {
|
export interface IndicesClose extends Generic {
|
||||||
index: string | string[];
|
index: string | string[];
|
||||||
timeout?: string;
|
timeout?: string;
|
||||||
@ -1418,6 +1427,8 @@ export interface IlmDeleteLifecycle extends Generic {
|
|||||||
|
|
||||||
export interface IlmExplainLifecycle extends Generic {
|
export interface IlmExplainLifecycle extends Generic {
|
||||||
index?: string;
|
index?: string;
|
||||||
|
only_managed?: boolean;
|
||||||
|
only_errors?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IlmGetLifecycle extends Generic {
|
export interface IlmGetLifecycle extends Generic {
|
||||||
|
|||||||
@ -2143,6 +2143,41 @@ _Default:_ `open`
|
|||||||
|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
=== indices.clone
|
||||||
|
[source,ts]
|
||||||
|
----
|
||||||
|
client.indices.clone({
|
||||||
|
index: string,
|
||||||
|
target: string,
|
||||||
|
timeout: string,
|
||||||
|
master_timeout: string,
|
||||||
|
wait_for_active_shards: string,
|
||||||
|
body: object
|
||||||
|
})
|
||||||
|
----
|
||||||
|
link:{ref}/indices-clone-index.html[Reference]
|
||||||
|
[cols=2*]
|
||||||
|
|===
|
||||||
|
|`index`
|
||||||
|
|`string` - The name of the source index to clone
|
||||||
|
|
||||||
|
|`target`
|
||||||
|
|`string` - The name of the target index to clone into
|
||||||
|
|
||||||
|
|`timeout`
|
||||||
|
|`string` - Explicit operation timeout
|
||||||
|
|
||||||
|
|`master_timeout` or `masterTimeout`
|
||||||
|
|`string` - Specify timeout for connection to master
|
||||||
|
|
||||||
|
|`wait_for_active_shards` or `waitForActiveShards`
|
||||||
|
|`string` - Set the number of active shards to wait for on the cloned index before the operation returns.
|
||||||
|
|
||||||
|
|`body`
|
||||||
|
|`object` - The configuration for the target index (`settings` and `aliases`)
|
||||||
|
|
||||||
|
|===
|
||||||
|
|
||||||
=== indices.close
|
=== indices.close
|
||||||
[source,ts]
|
[source,ts]
|
||||||
----
|
----
|
||||||
@ -5509,7 +5544,9 @@ link:{ref}/ilm-delete-lifecycle.html[Reference]
|
|||||||
[source,ts]
|
[source,ts]
|
||||||
----
|
----
|
||||||
client.ilm.explainLifecycle({
|
client.ilm.explainLifecycle({
|
||||||
index: string
|
index: string,
|
||||||
|
only_managed: boolean,
|
||||||
|
only_errors: boolean
|
||||||
})
|
})
|
||||||
----
|
----
|
||||||
link:{ref}/ilm-explain-lifecycle.html[Reference]
|
link:{ref}/ilm-explain-lifecycle.html[Reference]
|
||||||
@ -5518,6 +5555,12 @@ link:{ref}/ilm-explain-lifecycle.html[Reference]
|
|||||||
|`index`
|
|`index`
|
||||||
|`string` - The name of the index to explain
|
|`string` - The name of the index to explain
|
||||||
|
|
||||||
|
|`only_managed` or `onlyManaged`
|
||||||
|
|`boolean` - filters the indices included in the response to ones managed by ILM
|
||||||
|
|
||||||
|
|`only_errors` or `onlyErrors`
|
||||||
|
|`boolean` - filters the indices included in the response to ones in an ILM error state, implies only_managed
|
||||||
|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
=== ilm.getLifecycle
|
=== ilm.getLifecycle
|
||||||
|
|||||||
1
index.d.ts
vendored
1
index.d.ts
vendored
@ -257,6 +257,7 @@ declare class Client extends EventEmitter {
|
|||||||
analyze: ApiMethod<RequestParams.IndicesAnalyze>
|
analyze: ApiMethod<RequestParams.IndicesAnalyze>
|
||||||
clear_cache: ApiMethod<RequestParams.IndicesClearCache>
|
clear_cache: ApiMethod<RequestParams.IndicesClearCache>
|
||||||
clearCache: ApiMethod<RequestParams.IndicesClearCache>
|
clearCache: ApiMethod<RequestParams.IndicesClearCache>
|
||||||
|
clone: ApiMethod<RequestParams.IndicesClone>
|
||||||
close: ApiMethod<RequestParams.IndicesClose>
|
close: ApiMethod<RequestParams.IndicesClose>
|
||||||
create: ApiMethod<RequestParams.IndicesCreate>
|
create: ApiMethod<RequestParams.IndicesCreate>
|
||||||
delete: ApiMethod<RequestParams.IndicesDelete>
|
delete: ApiMethod<RequestParams.IndicesDelete>
|
||||||
|
|||||||
Reference in New Issue
Block a user