Skip to content

Commit 2be23c0

Browse files
committed
API generation
1 parent 86660dd commit 2be23c0

File tree

11 files changed

+300
-154
lines changed

11 files changed

+300
-154
lines changed

api/api/cat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
/* eslint no-unused-vars: 0 */
2424

2525
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26-
const acceptedQuerystring = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'full_id', 'active_only', 'detailed', 'index', 'ignore_unavailable', 'node_id', 'actions', 'parent_task', 'size', 'allow_no_match', 'allow_no_datafeeds', 'allow_no_jobs', 'from']
27-
const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', fullId: 'full_id', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable', nodeId: 'node_id', parentTask: 'parent_task', allowNoMatch: 'allow_no_match', allowNoDatafeeds: 'allow_no_datafeeds', allowNoJobs: 'allow_no_jobs' }
26+
const acceptedQuerystring = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'full_id', 'include_bootstrap', 'active_only', 'detailed', 'index', 'ignore_unavailable', 'nodes', 'actions', 'parent_task_id', 'size', 'allow_no_match', 'allow_no_datafeeds', 'allow_no_jobs', 'from']
27+
const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', fullId: 'full_id', includeBootstrap: 'include_bootstrap', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable', parentTaskId: 'parent_task_id', allowNoMatch: 'allow_no_match', allowNoDatafeeds: 'allow_no_datafeeds', allowNoJobs: 'allow_no_jobs' }
2828

2929
function CatApi (transport, ConfigurationError) {
3030
this.transport = transport

api/api/indices.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,33 @@ IndicesApi.prototype.getDataStream = function indicesGetDataStreamApi (params, o
15481548
return this.transport.request(request, options, callback)
15491549
}
15501550

1551+
IndicesApi.prototype.migrateToDataStream = function indicesMigrateToDataStreamApi (params, options, callback) {
1552+
;[params, options, callback] = normalizeArguments(params, options, callback)
1553+
1554+
// check required parameters
1555+
if (params['name'] == null) {
1556+
const err = new this[kConfigurationError]('Missing required parameter: name')
1557+
return handleError(err, callback)
1558+
}
1559+
1560+
var { method, body, name, ...querystring } = params
1561+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
1562+
1563+
var path = ''
1564+
if (method == null) method = 'POST'
1565+
path = '/' + '_data_stream' + '/' + '_migrate' + '/' + encodeURIComponent(name)
1566+
1567+
// build request object
1568+
const request = {
1569+
method,
1570+
path,
1571+
body: body || '',
1572+
querystring
1573+
}
1574+
1575+
return this.transport.request(request, options, callback)
1576+
}
1577+
15511578
IndicesApi.prototype.promoteDataStream = function indicesPromoteDataStreamApi (params, options, callback) {
15521579
;[params, options, callback] = normalizeArguments(params, options, callback)
15531580

@@ -1662,6 +1689,7 @@ Object.defineProperties(IndicesApi.prototype, {
16621689
data_streams_stats: { get () { return this.dataStreamsStats } },
16631690
delete_data_stream: { get () { return this.deleteDataStream } },
16641691
get_data_stream: { get () { return this.getDataStream } },
1692+
migrate_to_data_stream: { get () { return this.migrateToDataStream } },
16651693
promote_data_stream: { get () { return this.promoteDataStream } },
16661694
reload_search_analyzers: { get () { return this.reloadSearchAnalyzers } }
16671695
})

api/api/ml.js

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
/* eslint no-unused-vars: 0 */
2424

2525
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26-
const acceptedQuerystring = ['allow_no_match', 'allow_no_jobs', 'force', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'requests_per_second', 'allow_no_forecasts', 'wait_for_completion', 'lines_to_sample', 'line_merge_size_limit', 'charset', 'format', 'has_header_row', 'column_names', 'delimiter', 'quote', 'should_trim_fields', 'grok_pattern', 'timestamp_field', 'timestamp_format', 'explain', 'calc_interim', 'start', 'end', 'advance_time', 'skip_time', 'duration', 'expires_in', 'max_model_memory', 'expand', 'exclude_interim', 'from', 'size', 'anomaly_score', 'sort', 'desc', 'job_id', 'partition_field_value', 'exclude_generated', 'verbose', 'allow_no_datafeeds', 'influencer_score', 'top_n', 'bucket_span', 'overall_score', 'record_score', 'include', 'include_model_definition', 'decompress_definition', 'tags', 'reset_start', 'reset_end', 'ignore_unavailable', 'allow_no_indices', 'ignore_throttled', 'expand_wildcards', 'delete_intervening_results', 'enabled']
27-
const snakeCase = { allowNoMatch: 'allow_no_match', allowNoJobs: 'allow_no_jobs', errorTrace: 'error_trace', filterPath: 'filter_path', requestsPerSecond: 'requests_per_second', allowNoForecasts: 'allow_no_forecasts', waitForCompletion: 'wait_for_completion', linesToSample: 'lines_to_sample', lineMergeSizeLimit: 'line_merge_size_limit', hasHeaderRow: 'has_header_row', columnNames: 'column_names', shouldTrimFields: 'should_trim_fields', grokPattern: 'grok_pattern', timestampField: 'timestamp_field', timestampFormat: 'timestamp_format', calcInterim: 'calc_interim', advanceTime: 'advance_time', skipTime: 'skip_time', expiresIn: 'expires_in', maxModelMemory: 'max_model_memory', excludeInterim: 'exclude_interim', anomalyScore: 'anomaly_score', jobId: 'job_id', partitionFieldValue: 'partition_field_value', excludeGenerated: 'exclude_generated', allowNoDatafeeds: 'allow_no_datafeeds', influencerScore: 'influencer_score', topN: 'top_n', bucketSpan: 'bucket_span', overallScore: 'overall_score', recordScore: 'record_score', includeModelDefinition: 'include_model_definition', decompressDefinition: 'decompress_definition', resetStart: 'reset_start', resetEnd: 'reset_end', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', ignoreThrottled: 'ignore_throttled', expandWildcards: 'expand_wildcards', deleteInterveningResults: 'delete_intervening_results' }
26+
const acceptedQuerystring = ['allow_no_match', 'allow_no_jobs', 'force', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'requests_per_second', 'allow_no_forecasts', 'wait_for_completion', 'calc_interim', 'start', 'end', 'advance_time', 'skip_time', 'duration', 'expires_in', 'max_model_memory', 'expand', 'exclude_interim', 'from', 'size', 'anomaly_score', 'sort', 'desc', 'job_id', 'partition_field_value', 'exclude_generated', 'verbose', 'allow_no_datafeeds', 'influencer_score', 'top_n', 'bucket_span', 'overall_score', 'record_score', 'include', 'include_model_definition', 'decompress_definition', 'tags', 'reset_start', 'reset_end', 'ignore_unavailable', 'allow_no_indices', 'ignore_throttled', 'expand_wildcards', 'delete_intervening_results', 'enabled']
27+
const snakeCase = { allowNoMatch: 'allow_no_match', allowNoJobs: 'allow_no_jobs', errorTrace: 'error_trace', filterPath: 'filter_path', requestsPerSecond: 'requests_per_second', allowNoForecasts: 'allow_no_forecasts', waitForCompletion: 'wait_for_completion', calcInterim: 'calc_interim', advanceTime: 'advance_time', skipTime: 'skip_time', expiresIn: 'expires_in', maxModelMemory: 'max_model_memory', excludeInterim: 'exclude_interim', anomalyScore: 'anomaly_score', jobId: 'job_id', partitionFieldValue: 'partition_field_value', excludeGenerated: 'exclude_generated', allowNoDatafeeds: 'allow_no_datafeeds', influencerScore: 'influencer_score', topN: 'top_n', bucketSpan: 'bucket_span', overallScore: 'overall_score', recordScore: 'record_score', includeModelDefinition: 'include_model_definition', decompressDefinition: 'decompress_definition', resetStart: 'reset_start', resetEnd: 'reset_end', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', ignoreThrottled: 'ignore_throttled', expandWildcards: 'expand_wildcards', deleteInterveningResults: 'delete_intervening_results' }
2828

2929
function MlApi (transport, ConfigurationError) {
3030
this.transport = transport
@@ -475,33 +475,6 @@ MlApi.prototype.explainDataFrameAnalytics = function mlExplainDataFrameAnalytics
475475
return this.transport.request(request, options, callback)
476476
}
477477

478-
MlApi.prototype.findFileStructure = function mlFindFileStructureApi (params, options, callback) {
479-
;[params, options, callback] = normalizeArguments(params, options, callback)
480-
481-
// check required parameters
482-
if (params['body'] == null) {
483-
const err = new this[kConfigurationError]('Missing required parameter: body')
484-
return handleError(err, callback)
485-
}
486-
487-
var { method, body, ...querystring } = params
488-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
489-
490-
var path = ''
491-
if (method == null) method = 'POST'
492-
path = '/' + '_ml' + '/' + 'find_file_structure'
493-
494-
// build request object
495-
const request = {
496-
method,
497-
path,
498-
bulkBody: body,
499-
querystring
500-
}
501-
502-
return this.transport.request(request, options, callback)
503-
}
504-
505478
MlApi.prototype.flushJob = function mlFlushJobApi (params, options, callback) {
506479
;[params, options, callback] = normalizeArguments(params, options, callback)
507480

@@ -1832,7 +1805,6 @@ Object.defineProperties(MlApi.prototype, {
18321805
estimate_model_memory: { get () { return this.estimateModelMemory } },
18331806
evaluate_data_frame: { get () { return this.evaluateDataFrame } },
18341807
explain_data_frame_analytics: { get () { return this.explainDataFrameAnalytics } },
1835-
find_file_structure: { get () { return this.findFileStructure } },
18361808
flush_job: { get () { return this.flushJob } },
18371809
get_buckets: { get () { return this.getBuckets } },
18381810
get_calendar_events: { get () { return this.getCalendarEvents } },

api/api/rollup.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,17 +176,27 @@ RollupApi.prototype.rollup = function rollupRollupApi (params, options, callback
176176
const err = new this[kConfigurationError]('Missing required parameter: index')
177177
return handleError(err, callback)
178178
}
179+
if (params['rollup_index'] == null && params['rollupIndex'] == null) {
180+
const err = new this[kConfigurationError]('Missing required parameter: rollup_index or rollupIndex')
181+
return handleError(err, callback)
182+
}
179183
if (params['body'] == null) {
180184
const err = new this[kConfigurationError]('Missing required parameter: body')
181185
return handleError(err, callback)
182186
}
183187

184-
var { method, body, index, ...querystring } = params
188+
// check required url components
189+
if ((params['rollup_index'] != null || params['rollupIndex'] != null) && (params['index'] == null)) {
190+
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
191+
return handleError(err, callback)
192+
}
193+
194+
var { method, body, index, rollupIndex, rollup_index, ...querystring } = params
185195
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
186196

187197
var path = ''
188198
if (method == null) method = 'POST'
189-
path = '/' + encodeURIComponent(index) + '/' + '_rollup'
199+
path = '/' + encodeURIComponent(index) + '/' + '_rollup' + '/' + encodeURIComponent(rollup_index || rollupIndex)
190200

191201
// build request object
192202
const request = {

api/api/search.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
/* eslint no-unused-vars: 0 */
2424

2525
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26-
const acceptedQuerystring = ['analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27-
const snakeCase = { analyzeWildcard: 'analyze_wildcard', ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', defaultOperator: 'default_operator', storedFields: 'stored_fields', docvalueFields: 'docvalue_fields', ignoreUnavailable: 'ignore_unavailable', ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', suggestSize: 'suggest_size', suggestText: 'suggest_text', trackScores: 'track_scores', trackTotalHits: 'track_total_hits', allowPartialSearchResults: 'allow_partial_search_results', typedKeys: 'typed_keys', seqNoPrimaryTerm: 'seq_no_primary_term', requestCache: 'request_cache', batchedReduceSize: 'batched_reduce_size', maxConcurrentShardRequests: 'max_concurrent_shard_requests', preFilterShardSize: 'pre_filter_shard_size', restTotalHitsAsInt: 'rest_total_hits_as_int', errorTrace: 'error_trace', filterPath: 'filter_path' }
26+
const acceptedQuerystring = ['analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'rest_total_hits_as_int', 'min_compatible_shard_node', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27+
const snakeCase = { analyzeWildcard: 'analyze_wildcard', ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', defaultOperator: 'default_operator', storedFields: 'stored_fields', docvalueFields: 'docvalue_fields', ignoreUnavailable: 'ignore_unavailable', ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', suggestSize: 'suggest_size', suggestText: 'suggest_text', trackScores: 'track_scores', trackTotalHits: 'track_total_hits', allowPartialSearchResults: 'allow_partial_search_results', typedKeys: 'typed_keys', seqNoPrimaryTerm: 'seq_no_primary_term', requestCache: 'request_cache', batchedReduceSize: 'batched_reduce_size', maxConcurrentShardRequests: 'max_concurrent_shard_requests', preFilterShardSize: 'pre_filter_shard_size', restTotalHitsAsInt: 'rest_total_hits_as_int', minCompatibleShardNode: 'min_compatible_shard_node', errorTrace: 'error_trace', filterPath: 'filter_path' }
2828

2929
function searchApi (params, options, callback) {
3030
;[params, options, callback] = normalizeArguments(params, options, callback)

api/api/text_structure.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
'use strict'
21+
22+
/* eslint camelcase: 0 */
23+
/* eslint no-unused-vars: 0 */
24+
25+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26+
const acceptedQuerystring = ['lines_to_sample', 'line_merge_size_limit', 'timeout', 'charset', 'format', 'has_header_row', 'column_names', 'delimiter', 'quote', 'should_trim_fields', 'grok_pattern', 'timestamp_field', 'timestamp_format', 'explain', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27+
const snakeCase = { linesToSample: 'lines_to_sample', lineMergeSizeLimit: 'line_merge_size_limit', hasHeaderRow: 'has_header_row', columnNames: 'column_names', shouldTrimFields: 'should_trim_fields', grokPattern: 'grok_pattern', timestampField: 'timestamp_field', timestampFormat: 'timestamp_format', errorTrace: 'error_trace', filterPath: 'filter_path' }
28+
29+
function TextStructureApi (transport, ConfigurationError) {
30+
this.transport = transport
31+
this[kConfigurationError] = ConfigurationError
32+
}
33+
34+
TextStructureApi.prototype.findStructure = function textStructureFindStructureApi (params, options, callback) {
35+
;[params, options, callback] = normalizeArguments(params, options, callback)
36+
37+
// check required parameters
38+
if (params['body'] == null) {
39+
const err = new this[kConfigurationError]('Missing required parameter: body')
40+
return handleError(err, callback)
41+
}
42+
43+
var { method, body, ...querystring } = params
44+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45+
46+
var path = ''
47+
if (method == null) method = 'POST'
48+
path = '/' + '_text_structure' + '/' + 'find_structure'
49+
50+
// build request object
51+
const request = {
52+
method,
53+
path,
54+
body: body || '',
55+
querystring
56+
}
57+
58+
return this.transport.request(request, options, callback)
59+
}
60+
61+
Object.defineProperties(TextStructureApi.prototype, {
62+
find_structure: { get () { return this.findStructure } }
63+
})
64+
65+
module.exports = TextStructureApi

api/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const SecurityApi = require('./api/security')
8484
const SlmApi = require('./api/slm')
8585
const SqlApi = require('./api/sql')
8686
const SslApi = require('./api/ssl')
87+
const TextStructureApi = require('./api/text_structure')
8788
const TransformApi = require('./api/transform')
8889
const WatcherApi = require('./api/watcher')
8990
const XpackApi = require('./api/xpack')
@@ -114,6 +115,7 @@ const kSecurity = Symbol('Security')
114115
const kSlm = Symbol('Slm')
115116
const kSql = Symbol('Sql')
116117
const kSsl = Symbol('Ssl')
118+
const kTextStructure = Symbol('TextStructure')
117119
const kTransform = Symbol('Transform')
118120
const kWatcher = Symbol('Watcher')
119121
const kXpack = Symbol('Xpack')
@@ -145,6 +147,7 @@ function ESAPI (opts) {
145147
this[kSlm] = null
146148
this[kSql] = null
147149
this[kSsl] = null
150+
this[kTextStructure] = null
148151
this[kTransform] = null
149152
this[kWatcher] = null
150153
this[kXpack] = null
@@ -417,6 +420,15 @@ Object.defineProperties(ESAPI.prototype, {
417420
return this[kSsl]
418421
}
419422
},
423+
textStructure: {
424+
get () {
425+
if (this[kTextStructure] === null) {
426+
this[kTextStructure] = new TextStructureApi(this.transport, this[kConfigurationError])
427+
}
428+
return this[kTextStructure]
429+
}
430+
},
431+
text_structure: { get () { return this.textStructure } },
420432
transform: {
421433
get () {
422434
if (this[kTransform] === null) {

0 commit comments

Comments
 (0)