API generation
This commit is contained in:
87
api/api/indices.create_data_stream.js
Normal file
87
api/api/indices.create_data_stream.js
Normal file
@ -0,0 +1,87 @@
|
||||
// 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 buildIndicesCreateDataStream (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a indices.create_data_stream request
|
||||
* Creates or updates a data stream
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
|
||||
*/
|
||||
return function indicesCreateDataStream (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['name'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params['body'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: body')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// validate headers object
|
||||
if (options.headers != null && typeof options.headers !== 'object') {
|
||||
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
var warnings = []
|
||||
var { method, body, name, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if (method == null) method = 'PUT'
|
||||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIndicesCreateDataStream
|
||||
83
api/api/indices.delete_data_stream.js
Normal file
83
api/api/indices.delete_data_stream.js
Normal file
@ -0,0 +1,83 @@
|
||||
// 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 buildIndicesDeleteDataStream (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a indices.delete_data_stream request
|
||||
* Deletes a data stream.
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
|
||||
*/
|
||||
return function indicesDeleteDataStream (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['name'] == null) {
|
||||
const err = new ConfigurationError('Missing required parameter: name')
|
||||
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, name, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if (method == null) method = 'DELETE'
|
||||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIndicesDeleteDataStream
|
||||
82
api/api/indices.get_data_streams.js
Normal file
82
api/api/indices.get_data_streams.js
Normal file
@ -0,0 +1,82 @@
|
||||
// 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 buildIndicesGetDataStreams (opts) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
|
||||
|
||||
const acceptedQuerystring = [
|
||||
'pretty',
|
||||
'human',
|
||||
'error_trace',
|
||||
'source',
|
||||
'filter_path'
|
||||
]
|
||||
|
||||
const snakeCase = {
|
||||
errorTrace: 'error_trace',
|
||||
filterPath: 'filter_path'
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a indices.get_data_streams request
|
||||
* Returns data streams.
|
||||
* https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html
|
||||
*/
|
||||
return function indicesGetDataStreams (params, options, callback) {
|
||||
options = options || {}
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
options = {}
|
||||
}
|
||||
if (typeof params === 'function' || params == null) {
|
||||
callback = params
|
||||
params = {}
|
||||
options = {}
|
||||
}
|
||||
|
||||
// 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, name, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
|
||||
|
||||
var ignore = options.ignore
|
||||
if (typeof ignore === 'number') {
|
||||
options.ignore = [ignore]
|
||||
}
|
||||
|
||||
var path = ''
|
||||
|
||||
if ((name) != null) {
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_data_streams' + '/' + encodeURIComponent(name)
|
||||
} else {
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_data_streams'
|
||||
}
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
options.warnings = warnings.length === 0 ? null : warnings
|
||||
return makeRequest(request, options, callback)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = buildIndicesGetDataStreams
|
||||
@ -216,9 +216,13 @@ function ESAPI (opts) {
|
||||
clone: lazyLoad('indices.clone', opts),
|
||||
close: lazyLoad('indices.close', opts),
|
||||
create: lazyLoad('indices.create', opts),
|
||||
create_data_stream: lazyLoad('indices.create_data_stream', opts),
|
||||
createDataStream: lazyLoad('indices.create_data_stream', opts),
|
||||
delete: lazyLoad('indices.delete', opts),
|
||||
delete_alias: lazyLoad('indices.delete_alias', opts),
|
||||
deleteAlias: lazyLoad('indices.delete_alias', opts),
|
||||
delete_data_stream: lazyLoad('indices.delete_data_stream', opts),
|
||||
deleteDataStream: lazyLoad('indices.delete_data_stream', opts),
|
||||
delete_template: lazyLoad('indices.delete_template', opts),
|
||||
deleteTemplate: lazyLoad('indices.delete_template', opts),
|
||||
exists: lazyLoad('indices.exists', opts),
|
||||
@ -234,6 +238,8 @@ function ESAPI (opts) {
|
||||
get: lazyLoad('indices.get', opts),
|
||||
get_alias: lazyLoad('indices.get_alias', opts),
|
||||
getAlias: lazyLoad('indices.get_alias', opts),
|
||||
get_data_streams: lazyLoad('indices.get_data_streams', opts),
|
||||
getDataStreams: lazyLoad('indices.get_data_streams', opts),
|
||||
get_field_mapping: lazyLoad('indices.get_field_mapping', opts),
|
||||
getFieldMapping: lazyLoad('indices.get_field_mapping', opts),
|
||||
get_mapping: lazyLoad('indices.get_mapping', opts),
|
||||
|
||||
13
api/requestParams.d.ts
vendored
13
api/requestParams.d.ts
vendored
@ -609,6 +609,11 @@ export interface IndicesCreate<T = any> extends Generic {
|
||||
body?: T;
|
||||
}
|
||||
|
||||
export interface IndicesCreateDataStream<T = any> extends Generic {
|
||||
name: string;
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface IndicesDelete extends Generic {
|
||||
index: string | string[];
|
||||
timeout?: string;
|
||||
@ -625,6 +630,10 @@ export interface IndicesDeleteAlias extends Generic {
|
||||
master_timeout?: string;
|
||||
}
|
||||
|
||||
export interface IndicesDeleteDataStream extends Generic {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IndicesDeleteTemplate extends Generic {
|
||||
name: string;
|
||||
timeout?: string;
|
||||
@ -705,6 +714,10 @@ export interface IndicesGetAlias extends Generic {
|
||||
local?: boolean;
|
||||
}
|
||||
|
||||
export interface IndicesGetDataStreams extends Generic {
|
||||
name?: string | string[];
|
||||
}
|
||||
|
||||
export interface IndicesGetFieldMapping extends Generic {
|
||||
fields: string | string[];
|
||||
index?: string | string[];
|
||||
|
||||
@ -2445,6 +2445,26 @@ link:{ref}/indices-create-index.html[Documentation] +
|
||||
|
||||
|===
|
||||
|
||||
=== indices.createDataStream
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.indices.createDataStream({
|
||||
name: string,
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/data-streams.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`name`
|
||||
|`string` - The name of the data stream
|
||||
|
||||
|`body`
|
||||
|`object` - The data stream definition
|
||||
|
||||
|===
|
||||
|
||||
=== indices.delete
|
||||
|
||||
[source,ts]
|
||||
@ -2510,6 +2530,22 @@ link:{ref}/indices-aliases.html[Documentation] +
|
||||
|
||||
|===
|
||||
|
||||
=== indices.deleteDataStream
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.indices.deleteDataStream({
|
||||
name: string
|
||||
})
|
||||
----
|
||||
link:{ref}/data-streams.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`name`
|
||||
|`string` - The name of the data stream
|
||||
|
||||
|===
|
||||
|
||||
=== indices.deleteTemplate
|
||||
|
||||
[source,ts]
|
||||
@ -2837,6 +2873,22 @@ _Default:_ `all`
|
||||
|
||||
|===
|
||||
|
||||
=== indices.getDataStreams
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.indices.getDataStreams({
|
||||
name: string | string[]
|
||||
})
|
||||
----
|
||||
link:{ref}/data-streams.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`name`
|
||||
|`string \| string[]` - The comma separated names of data streams
|
||||
|
||||
|===
|
||||
|
||||
=== indices.getFieldMapping
|
||||
|
||||
[source,ts]
|
||||
|
||||
6
index.d.ts
vendored
6
index.d.ts
vendored
@ -315,9 +315,13 @@ declare class Client extends EventEmitter {
|
||||
clone: ApiMethod<RequestParams.IndicesClone>
|
||||
close: ApiMethod<RequestParams.IndicesClose>
|
||||
create: ApiMethod<RequestParams.IndicesCreate>
|
||||
create_data_stream: ApiMethod<RequestParams.IndicesCreateDataStream>
|
||||
createDataStream: ApiMethod<RequestParams.IndicesCreateDataStream>
|
||||
delete: ApiMethod<RequestParams.IndicesDelete>
|
||||
delete_alias: ApiMethod<RequestParams.IndicesDeleteAlias>
|
||||
deleteAlias: ApiMethod<RequestParams.IndicesDeleteAlias>
|
||||
delete_data_stream: ApiMethod<RequestParams.IndicesDeleteDataStream>
|
||||
deleteDataStream: ApiMethod<RequestParams.IndicesDeleteDataStream>
|
||||
delete_template: ApiMethod<RequestParams.IndicesDeleteTemplate>
|
||||
deleteTemplate: ApiMethod<RequestParams.IndicesDeleteTemplate>
|
||||
exists: ApiMethod<RequestParams.IndicesExists>
|
||||
@ -333,6 +337,8 @@ declare class Client extends EventEmitter {
|
||||
get: ApiMethod<RequestParams.IndicesGet>
|
||||
get_alias: ApiMethod<RequestParams.IndicesGetAlias>
|
||||
getAlias: ApiMethod<RequestParams.IndicesGetAlias>
|
||||
get_data_streams: ApiMethod<RequestParams.IndicesGetDataStreams>
|
||||
getDataStreams: ApiMethod<RequestParams.IndicesGetDataStreams>
|
||||
get_field_mapping: ApiMethod<RequestParams.IndicesGetFieldMapping>
|
||||
getFieldMapping: ApiMethod<RequestParams.IndicesGetFieldMapping>
|
||||
get_mapping: ApiMethod<RequestParams.IndicesGetMapping>
|
||||
|
||||
Reference in New Issue
Block a user