diff --git a/api/api/cluster.delete_component_template.js b/api/api/cluster.delete_component_template.js new file mode 100644 index 000000000..0a4b279eb --- /dev/null +++ b/api/api/cluster.delete_component_template.js @@ -0,0 +1,86 @@ +// 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 buildClusterDeleteComponentTemplate (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + + const acceptedQuerystring = [ + 'timeout', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ] + + const snakeCase = { + masterTimeout: 'master_timeout', + errorTrace: 'error_trace', + filterPath: 'filter_path' + } + + /** + * Perform a cluster.delete_component_template request + * Deletes a component template + * https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html + */ + return function clusterDeleteComponentTemplate (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 = '/' + '_component_template' + '/' + 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 = buildClusterDeleteComponentTemplate diff --git a/api/api/cluster.get_component_template.js b/api/api/cluster.get_component_template.js new file mode 100644 index 000000000..e33c15ade --- /dev/null +++ b/api/api/cluster.get_component_template.js @@ -0,0 +1,85 @@ +// 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 buildClusterGetComponentTemplate (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + + const acceptedQuerystring = [ + 'master_timeout', + 'local', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ] + + const snakeCase = { + masterTimeout: 'master_timeout', + errorTrace: 'error_trace', + filterPath: 'filter_path' + } + + /** + * Perform a cluster.get_component_template request + * Returns one or more component templates + * https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html + */ + return function clusterGetComponentTemplate (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 = '/' + '_component_template' + '/' + encodeURIComponent(name) + } else { + if (method == null) method = 'GET' + path = '/' + '_component_template' + } + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildClusterGetComponentTemplate diff --git a/api/api/cluster.put_component_template.js b/api/api/cluster.put_component_template.js new file mode 100644 index 000000000..335f892bc --- /dev/null +++ b/api/api/cluster.put_component_template.js @@ -0,0 +1,91 @@ +// 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 buildClusterPutComponentTemplate (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + + const acceptedQuerystring = [ + 'create', + 'timeout', + 'master_timeout', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ] + + const snakeCase = { + masterTimeout: 'master_timeout', + errorTrace: 'error_trace', + filterPath: 'filter_path' + } + + /** + * Perform a cluster.put_component_template request + * Creates or updates a component template + * https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html + */ + return function clusterPutComponentTemplate (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 = '/' + '_component_template' + '/' + 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 = buildClusterPutComponentTemplate diff --git a/api/api/transform.cat_transform.js b/api/api/transform.cat_transform.js new file mode 100644 index 000000000..fdb977a27 --- /dev/null +++ b/api/api/transform.cat_transform.js @@ -0,0 +1,85 @@ +// 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 buildTransformCatTransform (opts) { + // eslint-disable-next-line no-unused-vars + const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts + + const acceptedQuerystring = [ + 'from', + 'size', + 'allow_no_match', + 'format', + 'h', + 'help', + 's', + 'time', + 'v' + ] + + const snakeCase = { + allowNoMatch: 'allow_no_match' + + } + + /** + * Perform a transform.cat_transform request + * https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transform.html + */ + return function transformCatTransform (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, transformId, transform_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings) + + var ignore = options.ignore + if (typeof ignore === 'number') { + options.ignore = [ignore] + } + + var path = '' + + if ((transform_id || transformId) != null) { + if (method == null) method = 'GET' + path = '/' + '_cat' + '/' + 'transform' + '/' + encodeURIComponent(transform_id || transformId) + } else { + if (method == null) method = 'GET' + path = '/' + '_cat' + '/' + 'transform' + } + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + options.warnings = warnings.length === 0 ? null : warnings + return makeRequest(request, options, callback) + } +} + +module.exports = buildTransformCatTransform diff --git a/api/index.js b/api/index.js index d48a72e56..07d12fd3e 100644 --- a/api/index.js +++ b/api/index.js @@ -93,11 +93,17 @@ function ESAPI (opts) { cluster: { allocation_explain: lazyLoad('cluster.allocation_explain', opts), allocationExplain: lazyLoad('cluster.allocation_explain', opts), + delete_component_template: lazyLoad('cluster.delete_component_template', opts), + deleteComponentTemplate: lazyLoad('cluster.delete_component_template', opts), + get_component_template: lazyLoad('cluster.get_component_template', opts), + getComponentTemplate: lazyLoad('cluster.get_component_template', opts), get_settings: lazyLoad('cluster.get_settings', opts), getSettings: lazyLoad('cluster.get_settings', opts), health: lazyLoad('cluster.health', opts), pending_tasks: lazyLoad('cluster.pending_tasks', opts), pendingTasks: lazyLoad('cluster.pending_tasks', opts), + put_component_template: lazyLoad('cluster.put_component_template', opts), + putComponentTemplate: lazyLoad('cluster.put_component_template', opts), put_settings: lazyLoad('cluster.put_settings', opts), putSettings: lazyLoad('cluster.put_settings', opts), remote_info: lazyLoad('cluster.remote_info', opts), @@ -567,6 +573,8 @@ function ESAPI (opts) { }, termvectors: lazyLoad('termvectors', opts), transform: { + cat_transform: lazyLoad('transform.cat_transform', opts), + catTransform: lazyLoad('transform.cat_transform', opts), delete_transform: lazyLoad('transform.delete_transform', opts), deleteTransform: lazyLoad('transform.delete_transform', opts), get_transform: lazyLoad('transform.get_transform', opts), diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index e15a474f4..40216306a 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -260,6 +260,18 @@ export interface ClusterAllocationExplain extends Generic { body?: T; } +export interface ClusterDeleteComponentTemplate extends Generic { + name: string; + timeout?: string; + master_timeout?: string; +} + +export interface ClusterGetComponentTemplate extends Generic { + name?: string | string[]; + master_timeout?: string; + local?: boolean; +} + export interface ClusterGetSettings extends Generic { flat_settings?: boolean; master_timeout?: string; @@ -287,6 +299,14 @@ export interface ClusterPendingTasks extends Generic { master_timeout?: string; } +export interface ClusterPutComponentTemplate extends Generic { + name: string; + create?: boolean; + timeout?: string; + master_timeout?: string; + body: T; +} + export interface ClusterPutSettings extends Generic { flat_settings?: boolean; master_timeout?: string; @@ -2274,6 +2294,19 @@ export interface SqlTranslate extends Generic { export interface SslCertificates extends Generic { } +export interface TransformCatTransform extends Generic { + transform_id?: string; + from?: number; + size?: number; + allow_no_match?: boolean; + format?: string; + h?: string | string[]; + help?: boolean; + s?: string | string[]; + time?: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)'; + v?: boolean; +} + export interface TransformDeleteTransform extends Generic { transform_id: string; force?: boolean; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 3076e542f..d14b2a2ff 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1085,6 +1085,54 @@ link:{ref}/cluster-allocation-explain.html[Documentation] + |=== +=== cluster.deleteComponentTemplate + +[source,ts] +---- +client.cluster.deleteComponentTemplate({ + name: string, + timeout: string, + master_timeout: string +}) +---- +link:{ref}/indices-component-templates.html[Documentation] + +[cols=2*] +|=== +|`name` +|`string` - The name of the template + +|`timeout` +|`string` - Explicit operation timeout + +|`master_timeout` or `masterTimeout` +|`string` - Specify timeout for connection to master + +|=== + +=== cluster.getComponentTemplate + +[source,ts] +---- +client.cluster.getComponentTemplate({ + name: string | string[], + master_timeout: string, + local: boolean +}) +---- +link:{ref}/indices-component-templates.html[Documentation] + +[cols=2*] +|=== +|`name` +|`string \| string[]` - The comma separated names of the component templates + +|`master_timeout` or `masterTimeout` +|`string` - Explicit operation timeout for connection to master node + +|`local` +|`boolean` - Return local information, do not retrieve the state from master node (default: false) + +|=== + === cluster.getSettings [source,ts] @@ -1195,6 +1243,38 @@ link:{ref}/cluster-pending.html[Documentation] + |=== +=== cluster.putComponentTemplate + +[source,ts] +---- +client.cluster.putComponentTemplate({ + name: string, + create: boolean, + timeout: string, + master_timeout: string, + body: object +}) +---- +link:{ref}/indices-component-templates.html[Documentation] + +[cols=2*] +|=== +|`name` +|`string` - The name of the template + +|`create` +|`boolean` - Whether the index template should only be added if new or can also replace an existing one + +|`timeout` +|`string` - Explicit operation timeout + +|`master_timeout` or `masterTimeout` +|`string` - Specify timeout for connection to master + +|`body` +|`object` - The template definition + +|=== + === cluster.putSettings [source,ts] @@ -9078,6 +9158,58 @@ client.ssl.certificates() link:{ref}/security-api-ssl.html[Documentation] + +=== transform.catTransform + +[source,ts] +---- +client.transform.catTransform({ + transform_id: string, + from: number, + size: number, + allow_no_match: boolean, + format: string, + h: string | string[], + help: boolean, + s: string | string[], + time: 'd (Days)' | 'h (Hours)' | 'm (Minutes)' | 's (Seconds)' | 'ms (Milliseconds)' | 'micros (Microseconds)' | 'nanos (Nanoseconds)', + v: boolean +}) +---- +link:{ref}/cat-transform.html[Documentation] + +[cols=2*] +|=== +|`transform_id` or `transformId` +|`string` - The id of the transform for which to get stats. '_all' or '*' implies all transforms + +|`from` +|`number` - skips a number of transform configs, defaults to 0 + +|`size` +|`number` - specifies a max number of transforms to get, defaults to 100 + +|`allow_no_match` or `allowNoMatch` +|`boolean` - Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified) + +|`format` +|`string` - a short version of the Accept header, e.g. json, yaml + +|`h` +|`string \| string[]` - Comma-separated list of column names to display + +|`help` +|`boolean` - Return help information + +|`s` +|`string \| string[]` - Comma-separated list of column names or column aliases to sort by + +|`time` +|`'d (Days)' \| 'h (Hours)' \| 'm (Minutes)' \| 's (Seconds)' \| 'ms (Milliseconds)' \| 'micros (Microseconds)' \| 'nanos (Nanoseconds)'` - The unit in which to display time values + +|`v` +|`boolean` - Verbose mode. Display column headers + +|=== + === transform.deleteTransform [source,ts] diff --git a/index.d.ts b/index.d.ts index 44a298e71..11043c8b2 100644 --- a/index.d.ts +++ b/index.d.ts @@ -192,11 +192,17 @@ declare class Client extends EventEmitter { cluster: { allocation_explain: ApiMethod allocationExplain: ApiMethod + delete_component_template: ApiMethod + deleteComponentTemplate: ApiMethod + get_component_template: ApiMethod + getComponentTemplate: ApiMethod get_settings: ApiMethod getSettings: ApiMethod health: ApiMethod pending_tasks: ApiMethod pendingTasks: ApiMethod + put_component_template: ApiMethod + putComponentTemplate: ApiMethod put_settings: ApiMethod putSettings: ApiMethod remote_info: ApiMethod @@ -666,6 +672,8 @@ declare class Client extends EventEmitter { } termvectors: ApiMethod transform: { + cat_transform: ApiMethod + catTransform: ApiMethod delete_transform: ApiMethod deleteTransform: ApiMethod get_transform: ApiMethod