diff --git a/api/api/nodes.js b/api/api/nodes.js index 97bde5114..aa6f4473f 100644 --- a/api/api/nodes.js +++ b/api/api/nodes.js @@ -23,14 +23,78 @@ /* eslint no-unused-vars: 0 */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') -const acceptedQuerystring = ['interval', 'snapshots', 'threads', 'ignore_idle_threads', 'type', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'flat_settings', 'completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments'] -const snakeCase = { ignoreIdleThreads: 'ignore_idle_threads', errorTrace: 'error_trace', filterPath: 'filter_path', flatSettings: 'flat_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments' } +const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'interval', 'snapshots', 'threads', 'ignore_idle_threads', 'type', 'timeout', 'flat_settings', 'completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments'] +const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', ignoreIdleThreads: 'ignore_idle_threads', flatSettings: 'flat_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments' } function NodesApi (transport, ConfigurationError) { this.transport = transport this[kConfigurationError] = ConfigurationError } +NodesApi.prototype.clearMeteringArchive = function nodesClearMeteringArchiveApi (params, options, callback) { + ;[params, options, callback] = normalizeArguments(params, options, callback) + + // check required parameters + if (params.node_id == null && params.nodeId == null) { + const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId') + return handleError(err, callback) + } + if (params.max_archive_version == null && params.maxArchiveVersion == null) { + const err = new this[kConfigurationError]('Missing required parameter: max_archive_version or maxArchiveVersion') + return handleError(err, callback) + } + + // check required url components + if ((params.max_archive_version != null || params.maxArchiveVersion != null) && ((params.node_id == null && params.nodeId == null))) { + const err = new this[kConfigurationError]('Missing required parameter of the url: node_id') + return handleError(err, callback) + } + + let { method, body, nodeId, node_id, maxArchiveVersion, max_archive_version, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) + + let path = '' + if (method == null) method = 'DELETE' + path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + '_repositories_metering' + '/' + encodeURIComponent(max_archive_version || maxArchiveVersion) + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + return this.transport.request(request, options, callback) +} + +NodesApi.prototype.getMeteringInfo = function nodesGetMeteringInfoApi (params, options, callback) { + ;[params, options, callback] = normalizeArguments(params, options, callback) + + // check required parameters + if (params.node_id == null && params.nodeId == null) { + const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId') + return handleError(err, callback) + } + + let { method, body, nodeId, node_id, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) + + let path = '' + if (method == null) method = 'GET' + path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + '_repositories_metering' + + // build request object + const request = { + method, + path, + body: null, + querystring + } + + return this.transport.request(request, options, callback) +} + NodesApi.prototype.hotThreads = function nodesHotThreadsApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) @@ -195,6 +259,8 @@ NodesApi.prototype.usage = function nodesUsageApi (params, options, callback) { } Object.defineProperties(NodesApi.prototype, { + clear_metering_archive: { get () { return this.clearMeteringArchive } }, + get_metering_info: { get () { return this.getMeteringInfo } }, hot_threads: { get () { return this.hotThreads } }, reload_secure_settings: { get () { return this.reloadSecureSettings } } }) diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 4dffe376a..f8036f850 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -2025,6 +2025,15 @@ export interface Mtermvectors extends Generic { body?: T; } +export interface NodesClearMeteringArchive extends Generic { + node_id: string | string[]; + max_archive_version: number; +} + +export interface NodesGetMeteringInfo extends Generic { + node_id: string | string[]; +} + export interface NodesHotThreads extends Generic { node_id?: string | string[]; interval?: string; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 5d9ab959d..2b6ed7bb0 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -4465,7 +4465,7 @@ client.indices.fieldUsageStats({ expand_wildcards: 'open' | 'closed' | 'hidden' | 'none' | 'all' }) ---- -link:{ref}/indices-field-usage-stats.html[Documentation] + +link:{ref}/field-usage-stats.html[Documentation] + [cols=2*] |=== |`index` @@ -8368,6 +8368,44 @@ _Default:_ `true` |=== +[discrete] +=== nodes.clearMeteringArchive +*Stability:* experimental +[source,ts] +---- +client.nodes.clearMeteringArchive({ + node_id: string | string[], + max_archive_version: number +}) +---- +link:{ref}/clear-repositories-metering-archive-api.html[Documentation] + +[cols=2*] +|=== +|`node_id` or `nodeId` +|`string \| string[]` - Comma-separated list of node IDs or names used to limit returned information. + +|`max_archive_version` or `maxArchiveVersion` +|`number` - Specifies the maximum archive_version to be cleared from the archive. + +|=== + +[discrete] +=== nodes.getMeteringInfo +*Stability:* experimental +[source,ts] +---- +client.nodes.getMeteringInfo({ + node_id: string | string[] +}) +---- +link:{ref}/get-repositories-metering-api.html[Documentation] + +[cols=2*] +|=== +|`node_id` or `nodeId` +|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information. + +|=== + [discrete] === nodes.hotThreads diff --git a/index.d.ts b/index.d.ts index ae9b70251..061fec764 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1925,6 +1925,22 @@ declare class Client { mtermvectors, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.Mtermvectors, callback: callbackFn): TransportRequestCallback mtermvectors, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.Mtermvectors, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback nodes: { + clear_metering_archive, TContext = Context>(params?: RequestParams.NodesClearMeteringArchive, options?: TransportRequestOptions): TransportRequestPromise> + clear_metering_archive, TContext = Context>(callback: callbackFn): TransportRequestCallback + clear_metering_archive, TContext = Context>(params: RequestParams.NodesClearMeteringArchive, callback: callbackFn): TransportRequestCallback + clear_metering_archive, TContext = Context>(params: RequestParams.NodesClearMeteringArchive, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + clearMeteringArchive, TContext = Context>(params?: RequestParams.NodesClearMeteringArchive, options?: TransportRequestOptions): TransportRequestPromise> + clearMeteringArchive, TContext = Context>(callback: callbackFn): TransportRequestCallback + clearMeteringArchive, TContext = Context>(params: RequestParams.NodesClearMeteringArchive, callback: callbackFn): TransportRequestCallback + clearMeteringArchive, TContext = Context>(params: RequestParams.NodesClearMeteringArchive, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + get_metering_info, TContext = Context>(params?: RequestParams.NodesGetMeteringInfo, options?: TransportRequestOptions): TransportRequestPromise> + get_metering_info, TContext = Context>(callback: callbackFn): TransportRequestCallback + get_metering_info, TContext = Context>(params: RequestParams.NodesGetMeteringInfo, callback: callbackFn): TransportRequestCallback + get_metering_info, TContext = Context>(params: RequestParams.NodesGetMeteringInfo, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + getMeteringInfo, TContext = Context>(params?: RequestParams.NodesGetMeteringInfo, options?: TransportRequestOptions): TransportRequestPromise> + getMeteringInfo, TContext = Context>(callback: callbackFn): TransportRequestCallback + getMeteringInfo, TContext = Context>(params: RequestParams.NodesGetMeteringInfo, callback: callbackFn): TransportRequestCallback + getMeteringInfo, TContext = Context>(params: RequestParams.NodesGetMeteringInfo, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback hot_threads, TContext = Context>(params?: RequestParams.NodesHotThreads, options?: TransportRequestOptions): TransportRequestPromise> hot_threads, TContext = Context>(callback: callbackFn): TransportRequestCallback hot_threads, TContext = Context>(params: RequestParams.NodesHotThreads, callback: callbackFn): TransportRequestCallback