Skip to content

Commit 4102a28

Browse files
committed
API generation
1 parent 7fdfa48 commit 4102a28

File tree

10 files changed

+1016
-595
lines changed

10 files changed

+1016
-595
lines changed

api/api/cat.js

Lines changed: 91 additions & 91 deletions
Large diffs are not rendered by default.

api/api/indices.js

Lines changed: 243 additions & 243 deletions
Large diffs are not rendered by default.

api/api/ingest.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,27 @@ IngestApi.prototype.deletePipeline = function ingestDeletePipelineApi (params, o
5858
return this.transport.request(request, options, callback)
5959
}
6060

61+
IngestApi.prototype.geoIpStats = function ingestGeoIpStatsApi (params, options, callback) {
62+
;[params, options, callback] = normalizeArguments(params, options, callback)
63+
64+
let { method, body, ...querystring } = params
65+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
66+
67+
let path = ''
68+
if (method == null) method = 'GET'
69+
path = '/' + '_ingest' + '/' + 'geoip' + '/' + 'stats'
70+
71+
// build request object
72+
const request = {
73+
method,
74+
path,
75+
body: null,
76+
querystring
77+
}
78+
79+
return this.transport.request(request, options, callback)
80+
}
81+
6182
IngestApi.prototype.getPipeline = function ingestGetPipelineApi (params, options, callback) {
6283
;[params, options, callback] = normalizeArguments(params, options, callback)
6384

@@ -170,6 +191,7 @@ IngestApi.prototype.simulate = function ingestSimulateApi (params, options, call
170191

171192
Object.defineProperties(IngestApi.prototype, {
172193
delete_pipeline: { get () { return this.deletePipeline } },
194+
geo_ip_stats: { get () { return this.geoIpStats } },
173195
get_pipeline: { get () { return this.getPipeline } },
174196
processor_grok: { get () { return this.processorGrok } },
175197
put_pipeline: { get () { return this.putPipeline } }

api/api/ml.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,24 +1187,23 @@ MlApi.prototype.previewDataFrameAnalytics = function mlPreviewDataFrameAnalytics
11871187
MlApi.prototype.previewDatafeed = function mlPreviewDatafeedApi (params, options, callback) {
11881188
;[params, options, callback] = normalizeArguments(params, options, callback)
11891189

1190-
// check required parameters
1191-
if (params.datafeed_id == null && params.datafeedId == null) {
1192-
const err = new this[kConfigurationError]('Missing required parameter: datafeed_id or datafeedId')
1193-
return handleError(err, callback)
1194-
}
1195-
11961190
let { method, body, datafeedId, datafeed_id, ...querystring } = params
11971191
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
11981192

11991193
let path = ''
1200-
if (method == null) method = 'GET'
1201-
path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_preview'
1194+
if ((datafeed_id || datafeedId) != null) {
1195+
if (method == null) method = body == null ? 'GET' : 'POST'
1196+
path = '/' + '_ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) + '/' + '_preview'
1197+
} else {
1198+
if (method == null) method = body == null ? 'GET' : 'POST'
1199+
path = '/' + '_ml' + '/' + 'datafeeds' + '/' + '_preview'
1200+
}
12021201

12031202
// build request object
12041203
const request = {
12051204
method,
12061205
path,
1207-
body: null,
1206+
body: body || '',
12081207
querystring
12091208
}
12101209

api/api/shutdown.js

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
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 = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
27+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
28+
29+
function ShutdownApi (transport, ConfigurationError) {
30+
this.transport = transport
31+
this[kConfigurationError] = ConfigurationError
32+
}
33+
34+
ShutdownApi.prototype.deleteNode = function shutdownDeleteNodeApi (params, options, callback) {
35+
;[params, options, callback] = normalizeArguments(params, options, callback)
36+
37+
// check required parameters
38+
if (params.node_id == null && params.nodeId == null) {
39+
const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId')
40+
return handleError(err, callback)
41+
}
42+
43+
let { method, body, nodeId, node_id, ...querystring } = params
44+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45+
46+
let path = ''
47+
if (method == null) method = 'DELETE'
48+
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'shutdown'
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+
ShutdownApi.prototype.getNode = function shutdownGetNodeApi (params, options, callback) {
62+
;[params, options, callback] = normalizeArguments(params, options, callback)
63+
64+
let { method, body, nodeId, node_id, ...querystring } = params
65+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
66+
67+
let path = ''
68+
if ((node_id || nodeId) != null) {
69+
if (method == null) method = 'GET'
70+
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'shutdown'
71+
} else {
72+
if (method == null) method = 'GET'
73+
path = '/' + '_nodes' + '/' + 'shutdown'
74+
}
75+
76+
// build request object
77+
const request = {
78+
method,
79+
path,
80+
body: null,
81+
querystring
82+
}
83+
84+
return this.transport.request(request, options, callback)
85+
}
86+
87+
ShutdownApi.prototype.putNode = function shutdownPutNodeApi (params, options, callback) {
88+
;[params, options, callback] = normalizeArguments(params, options, callback)
89+
90+
// check required parameters
91+
if (params.node_id == null && params.nodeId == null) {
92+
const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId')
93+
return handleError(err, callback)
94+
}
95+
if (params.body == null) {
96+
const err = new this[kConfigurationError]('Missing required parameter: body')
97+
return handleError(err, callback)
98+
}
99+
100+
let { method, body, nodeId, node_id, ...querystring } = params
101+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
102+
103+
let path = ''
104+
if (method == null) method = 'PUT'
105+
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'shutdown'
106+
107+
// build request object
108+
const request = {
109+
method,
110+
path,
111+
body: body || '',
112+
querystring
113+
}
114+
115+
return this.transport.request(request, options, callback)
116+
}
117+
118+
Object.defineProperties(ShutdownApi.prototype, {
119+
delete_node: { get () { return this.deleteNode } },
120+
get_node: { get () { return this.getNode } },
121+
put_node: { get () { return this.putNode } }
122+
})
123+
124+
module.exports = ShutdownApi

0 commit comments

Comments
 (0)