Skip to content

Commit afa2161

Browse files
committed
API generation
1 parent fe6a73b commit afa2161

File tree

9 files changed

+630
-27
lines changed

9 files changed

+630
-27
lines changed

api/api/fleet.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 = ['wait_for_advance', 'wait_for_index', 'checkpoints', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27+
const snakeCase = { waitForAdvance: 'wait_for_advance', waitForIndex: 'wait_for_index', errorTrace: 'error_trace', filterPath: 'filter_path' }
28+
29+
function FleetApi (transport, ConfigurationError) {
30+
this.transport = transport
31+
this[kConfigurationError] = ConfigurationError
32+
}
33+
34+
FleetApi.prototype.globalCheckpoints = function fleetGlobalCheckpointsApi (params, options, callback) {
35+
;[params, options, callback] = normalizeArguments(params, options, callback)
36+
37+
// check required parameters
38+
if (params.index == null) {
39+
const err = new this[kConfigurationError]('Missing required parameter: index')
40+
return handleError(err, callback)
41+
}
42+
43+
let { method, body, index, ...querystring } = params
44+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45+
46+
let path = ''
47+
if (method == null) method = 'GET'
48+
path = '/' + encodeURIComponent(index) + '/' + '_fleet' + '/' + 'global_checkpoints'
49+
50+
// build request object
51+
const request = {
52+
method,
53+
path,
54+
body: null,
55+
querystring
56+
}
57+
58+
return this.transport.request(request, options, callback)
59+
}
60+
61+
Object.defineProperties(FleetApi.prototype, {
62+
global_checkpoints: { get () { return this.globalCheckpoints } }
63+
})
64+
65+
module.exports = FleetApi

api/api/monitoring.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ MonitoringApi.prototype.bulk = function monitoringBulkApi (params, options, call
5656
const request = {
5757
method,
5858
path,
59-
body: body || '',
59+
bulkBody: body,
6060
querystring
6161
}
6262

api/api/searchable_snapshots.js

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

2525
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26-
const acceptedQuerystring = ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'master_timeout', 'wait_for_completion', 'storage', 'level']
27-
const snakeCase = { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', waitForCompletion: 'wait_for_completion' }
26+
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'master_timeout', 'wait_for_completion', 'storage', 'level']
27+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', masterTimeout: 'master_timeout', waitForCompletion: 'wait_for_completion' }
2828

2929
function SearchableSnapshotsApi (transport, ConfigurationError) {
3030
this.transport = transport
3131
this[kConfigurationError] = ConfigurationError
3232
}
3333

34+
SearchableSnapshotsApi.prototype.cacheStats = function searchableSnapshotsCacheStatsApi (params, options, callback) {
35+
;[params, options, callback] = normalizeArguments(params, options, callback)
36+
37+
let { method, body, nodeId, node_id, ...querystring } = params
38+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
39+
40+
let path = ''
41+
if ((node_id || nodeId) != null) {
42+
if (method == null) method = 'GET'
43+
path = '/' + '_searchable_snapshots' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'cache' + '/' + 'stats'
44+
} else {
45+
if (method == null) method = 'GET'
46+
path = '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'stats'
47+
}
48+
49+
// build request object
50+
const request = {
51+
method,
52+
path,
53+
body: null,
54+
querystring
55+
}
56+
57+
return this.transport.request(request, options, callback)
58+
}
59+
3460
SearchableSnapshotsApi.prototype.clearCache = function searchableSnapshotsClearCacheApi (params, options, callback) {
3561
;[params, options, callback] = normalizeArguments(params, options, callback)
3662

@@ -152,6 +178,7 @@ SearchableSnapshotsApi.prototype.stats = function searchableSnapshotsStatsApi (p
152178
}
153179

154180
Object.defineProperties(SearchableSnapshotsApi.prototype, {
181+
cache_stats: { get () { return this.cacheStats } },
155182
clear_cache: { get () { return this.clearCache } },
156183
repository_stats: { get () { return this.repositoryStats } }
157184
})

api/api/security.js

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,50 @@ SecurityApi.prototype.clearCachedRoles = function securityClearCachedRolesApi (p
192192
return this.transport.request(request, options, callback)
193193
}
194194

195+
SecurityApi.prototype.clearCachedServiceTokens = function securityClearCachedServiceTokensApi (params, options, callback) {
196+
;[params, options, callback] = normalizeArguments(params, options, callback)
197+
198+
// check required parameters
199+
if (params.namespace == null) {
200+
const err = new this[kConfigurationError]('Missing required parameter: namespace')
201+
return handleError(err, callback)
202+
}
203+
if (params.service == null) {
204+
const err = new this[kConfigurationError]('Missing required parameter: service')
205+
return handleError(err, callback)
206+
}
207+
if (params.name == null) {
208+
const err = new this[kConfigurationError]('Missing required parameter: name')
209+
return handleError(err, callback)
210+
}
211+
212+
// check required url components
213+
if (params.name != null && (params.service == null || params.namespace == null)) {
214+
const err = new this[kConfigurationError]('Missing required parameter of the url: service, namespace')
215+
return handleError(err, callback)
216+
} else if (params.service != null && (params.namespace == null)) {
217+
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace')
218+
return handleError(err, callback)
219+
}
220+
221+
let { method, body, namespace, service, name, ...querystring } = params
222+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
223+
224+
let path = ''
225+
if (method == null) method = 'POST'
226+
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' + '/' + encodeURIComponent(name) + '/' + '_clear_cache'
227+
228+
// build request object
229+
const request = {
230+
method,
231+
path,
232+
body: body || '',
233+
querystring
234+
}
235+
236+
return this.transport.request(request, options, callback)
237+
}
238+
195239
SecurityApi.prototype.createApiKey = function securityCreateApiKeyApi (params, options, callback) {
196240
;[params, options, callback] = normalizeArguments(params, options, callback)
197241

@@ -219,6 +263,51 @@ SecurityApi.prototype.createApiKey = function securityCreateApiKeyApi (params, o
219263
return this.transport.request(request, options, callback)
220264
}
221265

266+
SecurityApi.prototype.createServiceToken = function securityCreateServiceTokenApi (params, options, callback) {
267+
;[params, options, callback] = normalizeArguments(params, options, callback)
268+
269+
// check required parameters
270+
if (params.namespace == null) {
271+
const err = new this[kConfigurationError]('Missing required parameter: namespace')
272+
return handleError(err, callback)
273+
}
274+
if (params.service == null) {
275+
const err = new this[kConfigurationError]('Missing required parameter: service')
276+
return handleError(err, callback)
277+
}
278+
279+
// check required url components
280+
if (params.name != null && (params.service == null || params.namespace == null)) {
281+
const err = new this[kConfigurationError]('Missing required parameter of the url: service, namespace')
282+
return handleError(err, callback)
283+
} else if (params.service != null && (params.namespace == null)) {
284+
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace')
285+
return handleError(err, callback)
286+
}
287+
288+
let { method, body, namespace, service, name, ...querystring } = params
289+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
290+
291+
let path = ''
292+
if ((namespace) != null && (service) != null && (name) != null) {
293+
if (method == null) method = 'PUT'
294+
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' + '/' + encodeURIComponent(name)
295+
} else {
296+
if (method == null) method = 'POST'
297+
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token'
298+
}
299+
300+
// build request object
301+
const request = {
302+
method,
303+
path,
304+
body: body || '',
305+
querystring
306+
}
307+
308+
return this.transport.request(request, options, callback)
309+
}
310+
222311
SecurityApi.prototype.deletePrivileges = function securityDeletePrivilegesApi (params, options, callback) {
223312
;[params, options, callback] = normalizeArguments(params, options, callback)
224313

@@ -310,6 +399,50 @@ SecurityApi.prototype.deleteRoleMapping = function securityDeleteRoleMappingApi
310399
return this.transport.request(request, options, callback)
311400
}
312401

402+
SecurityApi.prototype.deleteServiceToken = function securityDeleteServiceTokenApi (params, options, callback) {
403+
;[params, options, callback] = normalizeArguments(params, options, callback)
404+
405+
// check required parameters
406+
if (params.namespace == null) {
407+
const err = new this[kConfigurationError]('Missing required parameter: namespace')
408+
return handleError(err, callback)
409+
}
410+
if (params.service == null) {
411+
const err = new this[kConfigurationError]('Missing required parameter: service')
412+
return handleError(err, callback)
413+
}
414+
if (params.name == null) {
415+
const err = new this[kConfigurationError]('Missing required parameter: name')
416+
return handleError(err, callback)
417+
}
418+
419+
// check required url components
420+
if (params.name != null && (params.service == null || params.namespace == null)) {
421+
const err = new this[kConfigurationError]('Missing required parameter of the url: service, namespace')
422+
return handleError(err, callback)
423+
} else if (params.service != null && (params.namespace == null)) {
424+
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace')
425+
return handleError(err, callback)
426+
}
427+
428+
let { method, body, namespace, service, name, ...querystring } = params
429+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
430+
431+
let path = ''
432+
if (method == null) method = 'DELETE'
433+
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' + '/' + encodeURIComponent(name)
434+
435+
// build request object
436+
const request = {
437+
method,
438+
path,
439+
body: body || '',
440+
querystring
441+
}
442+
443+
return this.transport.request(request, options, callback)
444+
}
445+
313446
SecurityApi.prototype.deleteUser = function securityDeleteUserApi (params, options, callback) {
314447
;[params, options, callback] = normalizeArguments(params, options, callback)
315448

@@ -520,6 +653,78 @@ SecurityApi.prototype.getRoleMapping = function securityGetRoleMappingApi (param
520653
return this.transport.request(request, options, callback)
521654
}
522655

656+
SecurityApi.prototype.getServiceAccounts = function securityGetServiceAccountsApi (params, options, callback) {
657+
;[params, options, callback] = normalizeArguments(params, options, callback)
658+
659+
// check required url components
660+
if (params.service != null && (params.namespace == null)) {
661+
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace')
662+
return handleError(err, callback)
663+
}
664+
665+
let { method, body, namespace, service, ...querystring } = params
666+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
667+
668+
let path = ''
669+
if ((namespace) != null && (service) != null) {
670+
if (method == null) method = 'GET'
671+
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service)
672+
} else if ((namespace) != null) {
673+
if (method == null) method = 'GET'
674+
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace)
675+
} else {
676+
if (method == null) method = 'GET'
677+
path = '/' + '_security' + '/' + 'service'
678+
}
679+
680+
// build request object
681+
const request = {
682+
method,
683+
path,
684+
body: null,
685+
querystring
686+
}
687+
688+
return this.transport.request(request, options, callback)
689+
}
690+
691+
SecurityApi.prototype.getServiceCredentials = function securityGetServiceCredentialsApi (params, options, callback) {
692+
;[params, options, callback] = normalizeArguments(params, options, callback)
693+
694+
// check required parameters
695+
if (params.namespace == null) {
696+
const err = new this[kConfigurationError]('Missing required parameter: namespace')
697+
return handleError(err, callback)
698+
}
699+
if (params.service == null) {
700+
const err = new this[kConfigurationError]('Missing required parameter: service')
701+
return handleError(err, callback)
702+
}
703+
704+
// check required url components
705+
if (params.service != null && (params.namespace == null)) {
706+
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace')
707+
return handleError(err, callback)
708+
}
709+
710+
let { method, body, namespace, service, ...querystring } = params
711+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
712+
713+
let path = ''
714+
if (method == null) method = 'GET'
715+
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential'
716+
717+
// build request object
718+
const request = {
719+
method,
720+
path,
721+
body: null,
722+
querystring
723+
}
724+
725+
return this.transport.request(request, options, callback)
726+
}
727+
523728
SecurityApi.prototype.getToken = function securityGetTokenApi (params, options, callback) {
524729
;[params, options, callback] = normalizeArguments(params, options, callback)
525730

@@ -833,10 +1038,13 @@ Object.defineProperties(SecurityApi.prototype, {
8331038
clear_cached_privileges: { get () { return this.clearCachedPrivileges } },
8341039
clear_cached_realms: { get () { return this.clearCachedRealms } },
8351040
clear_cached_roles: { get () { return this.clearCachedRoles } },
1041+
clear_cached_service_tokens: { get () { return this.clearCachedServiceTokens } },
8361042
create_api_key: { get () { return this.createApiKey } },
1043+
create_service_token: { get () { return this.createServiceToken } },
8371044
delete_privileges: { get () { return this.deletePrivileges } },
8381045
delete_role: { get () { return this.deleteRole } },
8391046
delete_role_mapping: { get () { return this.deleteRoleMapping } },
1047+
delete_service_token: { get () { return this.deleteServiceToken } },
8401048
delete_user: { get () { return this.deleteUser } },
8411049
disable_user: { get () { return this.disableUser } },
8421050
enable_user: { get () { return this.enableUser } },
@@ -845,6 +1053,8 @@ Object.defineProperties(SecurityApi.prototype, {
8451053
get_privileges: { get () { return this.getPrivileges } },
8461054
get_role: { get () { return this.getRole } },
8471055
get_role_mapping: { get () { return this.getRoleMapping } },
1056+
get_service_accounts: { get () { return this.getServiceAccounts } },
1057+
get_service_credentials: { get () { return this.getServiceCredentials } },
8481058
get_token: { get () { return this.getToken } },
8491059
get_user: { get () { return this.getUser } },
8501060
get_user_privileges: { get () { return this.getUserPrivileges } },

api/api/snapshot.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 = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'verbose', 'local']
27-
const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable' }
26+
const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'index_details', 'verbose', 'local']
27+
const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable', indexDetails: 'index_details' }
2828

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

0 commit comments

Comments
 (0)