Skip to content

Commit 8522f30

Browse files
committed
API generation
1 parent f6677c0 commit 8522f30

8 files changed

+522
-1
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
'use strict'
6+
7+
/* eslint camelcase: 0 */
8+
/* eslint no-unused-vars: 0 */
9+
10+
function buildClusterExistsComponentTemplate (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
'master_timeout',
16+
'local',
17+
'pretty',
18+
'human',
19+
'error_trace',
20+
'source',
21+
'filter_path'
22+
]
23+
24+
const snakeCase = {
25+
masterTimeout: 'master_timeout',
26+
errorTrace: 'error_trace',
27+
filterPath: 'filter_path'
28+
}
29+
30+
/**
31+
* Perform a cluster.exists_component_template request
32+
* Returns information about whether a particular component template exist
33+
* https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html
34+
*/
35+
return function clusterExistsComponentTemplate (params, options, callback) {
36+
options = options || {}
37+
if (typeof options === 'function') {
38+
callback = options
39+
options = {}
40+
}
41+
if (typeof params === 'function' || params == null) {
42+
callback = params
43+
params = {}
44+
options = {}
45+
}
46+
47+
// check required parameters
48+
if (params['name'] == null) {
49+
const err = new ConfigurationError('Missing required parameter: name')
50+
return handleError(err, callback)
51+
}
52+
53+
// validate headers object
54+
if (options.headers != null && typeof options.headers !== 'object') {
55+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
56+
return handleError(err, callback)
57+
}
58+
59+
var warnings = []
60+
var { method, body, name, ...querystring } = params
61+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
62+
63+
var ignore = options.ignore
64+
if (typeof ignore === 'number') {
65+
options.ignore = [ignore]
66+
}
67+
68+
var path = ''
69+
70+
if (method == null) method = 'HEAD'
71+
path = '/' + '_component_template' + '/' + encodeURIComponent(name)
72+
73+
// build request object
74+
const request = {
75+
method,
76+
path,
77+
body: null,
78+
querystring
79+
}
80+
81+
options.warnings = warnings.length === 0 ? null : warnings
82+
return makeRequest(request, options, callback)
83+
}
84+
}
85+
86+
module.exports = buildClusterExistsComponentTemplate
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
'use strict'
6+
7+
/* eslint camelcase: 0 */
8+
/* eslint no-unused-vars: 0 */
9+
10+
function buildSearchableSnapshotsClearCache (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
'ignore_unavailable',
16+
'allow_no_indices',
17+
'expand_wildcards',
18+
'index'
19+
]
20+
21+
const snakeCase = {
22+
ignoreUnavailable: 'ignore_unavailable',
23+
allowNoIndices: 'allow_no_indices',
24+
expandWildcards: 'expand_wildcards'
25+
26+
}
27+
28+
/**
29+
* Perform a searchable_snapshots.clear_cache request
30+
* https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-clear-cache.html
31+
*/
32+
return function searchableSnapshotsClearCache (params, options, callback) {
33+
options = options || {}
34+
if (typeof options === 'function') {
35+
callback = options
36+
options = {}
37+
}
38+
if (typeof params === 'function' || params == null) {
39+
callback = params
40+
params = {}
41+
options = {}
42+
}
43+
44+
// validate headers object
45+
if (options.headers != null && typeof options.headers !== 'object') {
46+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
47+
return handleError(err, callback)
48+
}
49+
50+
var warnings = []
51+
var { method, body, index, ...querystring } = params
52+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
53+
54+
var ignore = options.ignore
55+
if (typeof ignore === 'number') {
56+
options.ignore = [ignore]
57+
}
58+
59+
var path = ''
60+
61+
if ((index) != null) {
62+
if (method == null) method = 'POST'
63+
path = '/' + encodeURIComponent(index) + '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'clear'
64+
} else {
65+
if (method == null) method = 'POST'
66+
path = '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'clear'
67+
}
68+
69+
// build request object
70+
const request = {
71+
method,
72+
path,
73+
body: body || '',
74+
querystring
75+
}
76+
77+
options.warnings = warnings.length === 0 ? null : warnings
78+
return makeRequest(request, options, callback)
79+
}
80+
}
81+
82+
module.exports = buildSearchableSnapshotsClearCache

api/api/searchable_snapshots.mount.js

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
'use strict'
6+
7+
/* eslint camelcase: 0 */
8+
/* eslint no-unused-vars: 0 */
9+
10+
function buildSearchableSnapshotsMount (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
'master_timeout',
16+
'wait_for_completion'
17+
]
18+
19+
const snakeCase = {
20+
masterTimeout: 'master_timeout',
21+
waitForCompletion: 'wait_for_completion'
22+
}
23+
24+
/**
25+
* Perform a searchable_snapshots.mount request
26+
* https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-mount-snapshot
27+
*/
28+
return function searchableSnapshotsMount (params, options, callback) {
29+
options = options || {}
30+
if (typeof options === 'function') {
31+
callback = options
32+
options = {}
33+
}
34+
if (typeof params === 'function' || params == null) {
35+
callback = params
36+
params = {}
37+
options = {}
38+
}
39+
40+
// check required parameters
41+
if (params['repository'] == null) {
42+
const err = new ConfigurationError('Missing required parameter: repository')
43+
return handleError(err, callback)
44+
}
45+
if (params['snapshot'] == null) {
46+
const err = new ConfigurationError('Missing required parameter: snapshot')
47+
return handleError(err, callback)
48+
}
49+
if (params['body'] == null) {
50+
const err = new ConfigurationError('Missing required parameter: body')
51+
return handleError(err, callback)
52+
}
53+
54+
// check required url components
55+
if (params['snapshot'] != null && (params['repository'] == null)) {
56+
const err = new ConfigurationError('Missing required parameter of the url: repository')
57+
return handleError(err, callback)
58+
}
59+
60+
// validate headers object
61+
if (options.headers != null && typeof options.headers !== 'object') {
62+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
63+
return handleError(err, callback)
64+
}
65+
66+
var warnings = []
67+
var { method, body, repository, snapshot, ...querystring } = params
68+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
69+
70+
var ignore = options.ignore
71+
if (typeof ignore === 'number') {
72+
options.ignore = [ignore]
73+
}
74+
75+
var path = ''
76+
77+
if (method == null) method = 'POST'
78+
path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot) + '/' + '_mount'
79+
80+
// build request object
81+
const request = {
82+
method,
83+
path,
84+
body: body || '',
85+
querystring
86+
}
87+
88+
options.warnings = warnings.length === 0 ? null : warnings
89+
return makeRequest(request, options, callback)
90+
}
91+
}
92+
93+
module.exports = buildSearchableSnapshotsMount

api/api/searchable_snapshots.stats.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
'use strict'
6+
7+
/* eslint camelcase: 0 */
8+
/* eslint no-unused-vars: 0 */
9+
10+
function buildSearchableSnapshotsStats (opts) {
11+
// eslint-disable-next-line no-unused-vars
12+
const { makeRequest, ConfigurationError, handleError, snakeCaseKeys } = opts
13+
14+
const acceptedQuerystring = [
15+
16+
]
17+
18+
const snakeCase = {
19+
20+
}
21+
22+
/**
23+
* Perform a searchable_snapshots.stats request
24+
* https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-stats.html
25+
*/
26+
return function searchableSnapshotsStats (params, options, callback) {
27+
options = options || {}
28+
if (typeof options === 'function') {
29+
callback = options
30+
options = {}
31+
}
32+
if (typeof params === 'function' || params == null) {
33+
callback = params
34+
params = {}
35+
options = {}
36+
}
37+
38+
// validate headers object
39+
if (options.headers != null && typeof options.headers !== 'object') {
40+
const err = new ConfigurationError(`Headers should be an object, instead got: ${typeof options.headers}`)
41+
return handleError(err, callback)
42+
}
43+
44+
var warnings = []
45+
var { method, body, index, ...querystring } = params
46+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring, warnings)
47+
48+
var ignore = options.ignore
49+
if (typeof ignore === 'number') {
50+
options.ignore = [ignore]
51+
}
52+
53+
var path = ''
54+
55+
if ((index) != null) {
56+
if (method == null) method = 'GET'
57+
path = '/' + encodeURIComponent(index) + '/' + '_searchable_snapshots' + '/' + 'stats'
58+
} else {
59+
if (method == null) method = 'GET'
60+
path = '/' + '_searchable_snapshots' + '/' + 'stats'
61+
}
62+
63+
// build request object
64+
const request = {
65+
method,
66+
path,
67+
body: null,
68+
querystring
69+
}
70+
71+
options.warnings = warnings.length === 0 ? null : warnings
72+
return makeRequest(request, options, callback)
73+
}
74+
}
75+
76+
module.exports = buildSearchableSnapshotsStats

api/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ function ESAPI (opts) {
102102
allocationExplain: lazyLoad('cluster.allocation_explain', opts),
103103
delete_component_template: lazyLoad('cluster.delete_component_template', opts),
104104
deleteComponentTemplate: lazyLoad('cluster.delete_component_template', opts),
105+
exists_component_template: lazyLoad('cluster.exists_component_template', opts),
106+
existsComponentTemplate: lazyLoad('cluster.exists_component_template', opts),
105107
get_component_template: lazyLoad('cluster.get_component_template', opts),
106108
getComponentTemplate: lazyLoad('cluster.get_component_template', opts),
107109
get_settings: lazyLoad('cluster.get_settings', opts),
@@ -488,6 +490,18 @@ function ESAPI (opts) {
488490
searchShards: lazyLoad('search_shards', opts),
489491
search_template: lazyLoad('search_template', opts),
490492
searchTemplate: lazyLoad('search_template', opts),
493+
searchable_snapshots: {
494+
clear_cache: lazyLoad('searchable_snapshots.clear_cache', opts),
495+
clearCache: lazyLoad('searchable_snapshots.clear_cache', opts),
496+
mount: lazyLoad('searchable_snapshots.mount', opts),
497+
stats: lazyLoad('searchable_snapshots.stats', opts)
498+
},
499+
searchableSnapshots: {
500+
clear_cache: lazyLoad('searchable_snapshots.clear_cache', opts),
501+
clearCache: lazyLoad('searchable_snapshots.clear_cache', opts),
502+
mount: lazyLoad('searchable_snapshots.mount', opts),
503+
stats: lazyLoad('searchable_snapshots.stats', opts)
504+
},
491505
security: {
492506
authenticate: lazyLoad('security.authenticate', opts),
493507
change_password: lazyLoad('security.change_password', opts),

0 commit comments

Comments
 (0)