Skip to content

Commit d10e8bb

Browse files
committed
API generation
1 parent 27a8e2a commit d10e8bb

File tree

5 files changed

+110
-3
lines changed

5 files changed

+110
-3
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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 buildAutoscalingGetAutoscalingPolicy (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 autoscaling.get_autoscaling_policy request
24+
* https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-policy.html
25+
*/
26+
return function autoscalingGetAutoscalingPolicy (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+
// check required parameters
39+
if (params['name'] == null) {
40+
const err = new ConfigurationError('Missing required parameter: name')
41+
return handleError(err, callback)
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, name, ...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 (method == null) method = 'GET'
62+
path = '/' + '_autoscaling' + '/' + 'policy' + '/' + encodeURIComponent(name)
63+
64+
// build request object
65+
const request = {
66+
method,
67+
path,
68+
body: null,
69+
querystring
70+
}
71+
72+
options.warnings = warnings.length === 0 ? null : warnings
73+
return makeRequest(request, options, callback)
74+
}
75+
}
76+
77+
module.exports = buildAutoscalingGetAutoscalingPolicy

api/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ function ESAPI (opts) {
3131
deleteAutoscalingPolicy: lazyLoad('autoscaling.delete_autoscaling_policy', opts),
3232
get_autoscaling_decision: lazyLoad('autoscaling.get_autoscaling_decision', opts),
3333
getAutoscalingDecision: lazyLoad('autoscaling.get_autoscaling_decision', opts),
34+
get_autoscaling_policy: lazyLoad('autoscaling.get_autoscaling_policy', opts),
35+
getAutoscalingPolicy: lazyLoad('autoscaling.get_autoscaling_policy', opts),
3436
put_autoscaling_policy: lazyLoad('autoscaling.put_autoscaling_policy', opts),
3537
putAutoscalingPolicy: lazyLoad('autoscaling.put_autoscaling_policy', opts)
3638
},

api/requestParams.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ export interface IndicesGetAlias extends Generic {
723723
}
724724

725725
export interface IndicesGetDataStreams extends Generic {
726-
name?: string | string[];
726+
name?: string;
727727
}
728728

729729
export interface IndicesGetFieldMapping extends Generic {
@@ -1437,6 +1437,10 @@ export interface AutoscalingDeleteAutoscalingPolicy extends Generic {
14371437
export interface AutoscalingGetAutoscalingDecision extends Generic {
14381438
}
14391439

1440+
export interface AutoscalingGetAutoscalingPolicy extends Generic {
1441+
name: string;
1442+
}
1443+
14401444
export interface AutoscalingPutAutoscalingPolicy<T = RequestBody> extends Generic {
14411445
name: string;
14421446
body: T;

docs/reference.asciidoc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2905,14 +2905,14 @@ _Default:_ `all`
29052905
[source,ts]
29062906
----
29072907
client.indices.getDataStreams({
2908-
name: string | string[]
2908+
name: string
29092909
})
29102910
----
29112911
link:{ref}/data-streams.html[Documentation] +
29122912
[cols=2*]
29132913
|===
29142914
|`name`
2915-
|`string \| string[]` - The comma separated names of data streams
2915+
|`string` - The name or wildcard expression of the requested data streams
29162916

29172917
|===
29182918

@@ -5779,6 +5779,22 @@ client.autoscaling.getAutoscalingDecision()
57795779
link:{ref}/autoscaling-get-autoscaling-decision.html[Documentation] +
57805780

57815781

5782+
=== autoscaling.getAutoscalingPolicy
5783+
*Stability:* experimental
5784+
[source,ts]
5785+
----
5786+
client.autoscaling.getAutoscalingPolicy({
5787+
name: string
5788+
})
5789+
----
5790+
link:{ref}/autoscaling-get-autoscaling-policy.html[Documentation] +
5791+
[cols=2*]
5792+
|===
5793+
|`name`
5794+
|`string` - the name of the autoscaling policy
5795+
5796+
|===
5797+
57825798
=== autoscaling.putAutoscalingPolicy
57835799
*Stability:* experimental
57845800
[source,ts]

index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,14 @@ declare class Client extends EventEmitter {
158158
getAutoscalingDecision<TResponse = ResponseBody, TContext = unknown>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
159159
getAutoscalingDecision<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.AutoscalingGetAutoscalingDecision, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
160160
getAutoscalingDecision<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.AutoscalingGetAutoscalingDecision, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
161+
get_autoscaling_policy<TResponse = ResponseBody, TContext = unknown>(params?: RequestParams.AutoscalingGetAutoscalingPolicy, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
162+
get_autoscaling_policy<TResponse = ResponseBody, TContext = unknown>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
163+
get_autoscaling_policy<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.AutoscalingGetAutoscalingPolicy, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
164+
get_autoscaling_policy<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.AutoscalingGetAutoscalingPolicy, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
165+
getAutoscalingPolicy<TResponse = ResponseBody, TContext = unknown>(params?: RequestParams.AutoscalingGetAutoscalingPolicy, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
166+
getAutoscalingPolicy<TResponse = ResponseBody, TContext = unknown>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
167+
getAutoscalingPolicy<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.AutoscalingGetAutoscalingPolicy, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
168+
getAutoscalingPolicy<TResponse = ResponseBody, TContext = unknown>(params: RequestParams.AutoscalingGetAutoscalingPolicy, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
161169
put_autoscaling_policy<TRequestBody extends RequestBody, TResponse = ResponseBody, TContext = unknown>(params?: RequestParams.AutoscalingPutAutoscalingPolicy<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
162170
put_autoscaling_policy<TRequestBody extends RequestBody, TResponse = ResponseBody, TContext = unknown>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
163171
put_autoscaling_policy<TRequestBody extends RequestBody, TResponse = ResponseBody, TContext = unknown>(params: RequestParams.AutoscalingPutAutoscalingPolicy<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback

0 commit comments

Comments
 (0)