Skip to content

Commit 87805fc

Browse files
committed
API generation
1 parent 3d664de commit 87805fc

File tree

8 files changed

+179
-17
lines changed

8 files changed

+179
-17
lines changed

api/api/ml.js

+2-2
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', 'for_export', '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', forExport: 'for_export', 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', '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' }
2828

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

api/api/security.js

+28
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,33 @@ SecurityApi.prototype.getUserPrivileges = function securityGetUserPrivilegesApi
594594
return this.transport.request(request, options, callback)
595595
}
596596

597+
SecurityApi.prototype.grantApiKey = function securityGrantApiKeyApi (params, options, callback) {
598+
;[params, options, callback] = normalizeArguments(params, options, callback)
599+
600+
// check required parameters
601+
if (params['body'] == null) {
602+
const err = new this[kConfigurationError]('Missing required parameter: body')
603+
return handleError(err, callback)
604+
}
605+
606+
var { method, body, ...querystring } = params
607+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
608+
609+
var path = ''
610+
if (method == null) method = 'POST'
611+
path = '/' + '_security' + '/' + 'api_key' + '/' + 'grant'
612+
613+
// build request object
614+
const request = {
615+
method,
616+
path,
617+
body: body || '',
618+
querystring
619+
}
620+
621+
return this.transport.request(request, options, callback)
622+
}
623+
597624
SecurityApi.prototype.hasPrivileges = function securityHasPrivilegesApi (params, options, callback) {
598625
;[params, options, callback] = normalizeArguments(params, options, callback)
599626

@@ -821,6 +848,7 @@ Object.defineProperties(SecurityApi.prototype, {
821848
get_token: { get () { return this.getToken } },
822849
get_user: { get () { return this.getUser } },
823850
get_user_privileges: { get () { return this.getUserPrivileges } },
851+
grant_api_key: { get () { return this.grantApiKey } },
824852
has_privileges: { get () { return this.hasPrivileges } },
825853
invalidate_api_key: { get () { return this.invalidateApiKey } },
826854
invalidate_token: { get () { return this.invalidateToken } },

api/api/snapshot.js

+48
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,54 @@ SnapshotApi.prototype.cleanupRepository = function snapshotCleanupRepositoryApi
5858
return this.transport.request(request, options, callback)
5959
}
6060

61+
SnapshotApi.prototype.clone = function snapshotCloneApi (params, options, callback) {
62+
;[params, options, callback] = normalizeArguments(params, options, callback)
63+
64+
// check required parameters
65+
if (params['repository'] == null) {
66+
const err = new this[kConfigurationError]('Missing required parameter: repository')
67+
return handleError(err, callback)
68+
}
69+
if (params['snapshot'] == null) {
70+
const err = new this[kConfigurationError]('Missing required parameter: snapshot')
71+
return handleError(err, callback)
72+
}
73+
if (params['target_snapshot'] == null && params['targetSnapshot'] == null) {
74+
const err = new this[kConfigurationError]('Missing required parameter: target_snapshot or targetSnapshot')
75+
return handleError(err, callback)
76+
}
77+
if (params['body'] == null) {
78+
const err = new this[kConfigurationError]('Missing required parameter: body')
79+
return handleError(err, callback)
80+
}
81+
82+
// check required url components
83+
if ((params['target_snapshot'] != null || params['targetSnapshot'] != null) && (params['snapshot'] == null || params['repository'] == null)) {
84+
const err = new this[kConfigurationError]('Missing required parameter of the url: snapshot, repository')
85+
return handleError(err, callback)
86+
} else if (params['snapshot'] != null && (params['repository'] == null)) {
87+
const err = new this[kConfigurationError]('Missing required parameter of the url: repository')
88+
return handleError(err, callback)
89+
}
90+
91+
var { method, body, repository, snapshot, targetSnapshot, target_snapshot, ...querystring } = params
92+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
93+
94+
var path = ''
95+
if (method == null) method = 'PUT'
96+
path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot) + '/' + '_clone' + '/' + encodeURIComponent(target_snapshot || targetSnapshot)
97+
98+
// build request object
99+
const request = {
100+
method,
101+
path,
102+
body: body || '',
103+
querystring
104+
}
105+
106+
return this.transport.request(request, options, callback)
107+
}
108+
61109
SnapshotApi.prototype.create = function snapshotCreateApi (params, options, callback) {
62110
;[params, options, callback] = normalizeArguments(params, options, callback)
63111

api/api/transform.js

+2-2
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 = ['force', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'from', 'size', 'allow_no_match', 'defer_validation', 'timeout', 'wait_for_completion', 'wait_for_checkpoint']
27-
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', allowNoMatch: 'allow_no_match', deferValidation: 'defer_validation', waitForCompletion: 'wait_for_completion', waitForCheckpoint: 'wait_for_checkpoint' }
26+
const acceptedQuerystring = ['force', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'from', 'size', 'allow_no_match', 'exclude_generated', 'defer_validation', 'timeout', 'wait_for_completion', 'wait_for_checkpoint']
27+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', allowNoMatch: 'allow_no_match', excludeGenerated: 'exclude_generated', deferValidation: 'defer_validation', waitForCompletion: 'wait_for_completion', waitForCheckpoint: 'wait_for_checkpoint' }
2828

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

api/kibana.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ interface KibanaClient {
395395
getToken<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGetToken<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
396396
getUser<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGetUser, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
397397
getUserPrivileges<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGetUserPrivileges, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
398+
grantApiKey<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGrantApiKey<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
398399
hasPrivileges<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityHasPrivileges<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
399400
invalidateApiKey<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityInvalidateApiKey<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
400401
invalidateToken<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityInvalidateToken<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
@@ -416,6 +417,7 @@ interface KibanaClient {
416417
}
417418
snapshot: {
418419
cleanupRepository<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotCleanupRepository, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
420+
clone<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotClone<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
419421
create<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotCreate<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
420422
createRepository<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotCreateRepository<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
421423
delete<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotDelete, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>

api/requestParams.d.ts

+18-4
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,7 @@ export interface MlGetDataFrameAnalytics extends Generic {
15811581
allow_no_match?: boolean;
15821582
from?: number;
15831583
size?: number;
1584-
for_export?: boolean;
1584+
exclude_generated?: boolean;
15851585
}
15861586

15871587
export interface MlGetDataFrameAnalyticsStats extends Generic {
@@ -1602,7 +1602,7 @@ export interface MlGetDatafeeds extends Generic {
16021602
datafeed_id?: string;
16031603
allow_no_match?: boolean;
16041604
allow_no_datafeeds?: boolean;
1605-
for_export?: boolean;
1605+
exclude_generated?: boolean;
16061606
}
16071607

16081608
export interface MlGetFilters extends Generic {
@@ -1634,7 +1634,7 @@ export interface MlGetJobs extends Generic {
16341634
job_id?: string;
16351635
allow_no_match?: boolean;
16361636
allow_no_jobs?: boolean;
1637-
for_export?: boolean;
1637+
exclude_generated?: boolean;
16381638
}
16391639

16401640
export interface MlGetModelSnapshots<T = RequestBody> extends Generic {
@@ -1684,7 +1684,7 @@ export interface MlGetTrainedModels extends Generic {
16841684
from?: number;
16851685
size?: number;
16861686
tags?: string | string[];
1687-
for_export?: boolean;
1687+
exclude_generated?: boolean;
16881688
}
16891689

16901690
export interface MlGetTrainedModelsStats extends Generic {
@@ -2221,6 +2221,11 @@ export interface SecurityGetUser extends Generic {
22212221
export interface SecurityGetUserPrivileges extends Generic {
22222222
}
22232223

2224+
export interface SecurityGrantApiKey<T = RequestBody> extends Generic {
2225+
refresh?: 'wait_for' | boolean;
2226+
body: T;
2227+
}
2228+
22242229
export interface SecurityHasPrivileges<T = RequestBody> extends Generic {
22252230
user?: string;
22262231
body: T;
@@ -2295,6 +2300,14 @@ export interface SnapshotCleanupRepository extends Generic {
22952300
timeout?: string;
22962301
}
22972302

2303+
export interface SnapshotClone<T = RequestBody> extends Generic {
2304+
repository: string;
2305+
snapshot: string;
2306+
target_snapshot: string;
2307+
master_timeout?: string;
2308+
body: T;
2309+
}
2310+
22982311
export interface SnapshotCreate<T = RequestBody> extends Generic {
22992312
repository: string;
23002313
snapshot: string;
@@ -2425,6 +2438,7 @@ export interface TransformGetTransform extends Generic {
24252438
from?: number;
24262439
size?: number;
24272440
allow_no_match?: boolean;
2441+
exclude_generated?: boolean;
24282442
}
24292443

24302444
export interface TransformGetTransformStats extends Generic {

docs/reference.asciidoc

+67-9
Original file line numberDiff line numberDiff line change
@@ -6462,7 +6462,7 @@ client.ml.getDataFrameAnalytics({
64626462
allow_no_match: boolean,
64636463
from: number,
64646464
size: number,
6465-
for_export: boolean
6465+
exclude_generated: boolean
64666466
})
64676467
----
64686468
link:{ref}/get-dfanalytics.html[Documentation] +
@@ -6482,7 +6482,7 @@ _Default:_ `true`
64826482
|`number` - specifies a max number of analytics to get +
64836483
_Default:_ `100`
64846484

6485-
|`for_export` or `forExport`
6485+
|`exclude_generated` or `excludeGenerated`
64866486
|`boolean` - Omits fields that are illegal to set on data frame analytics PUT
64876487

64886488
|===
@@ -6558,7 +6558,7 @@ client.ml.getDatafeeds({
65586558
datafeed_id: string,
65596559
allow_no_match: boolean,
65606560
allow_no_datafeeds: boolean,
6561-
for_export: boolean
6561+
exclude_generated: boolean
65626562
})
65636563
----
65646564
link:{ref}/ml-get-datafeed.html[Documentation] +
@@ -6575,7 +6575,7 @@ link:{ref}/ml-get-datafeed.html[Documentation] +
65756575

65766576
WARNING: This parameter has been deprecated.
65776577

6578-
|`for_export` or `forExport`
6578+
|`exclude_generated` or `excludeGenerated`
65796579
|`boolean` - Omits fields that are illegal to set on datafeed PUT
65806580

65816581
|===
@@ -6694,7 +6694,7 @@ client.ml.getJobs({
66946694
job_id: string,
66956695
allow_no_match: boolean,
66966696
allow_no_jobs: boolean,
6697-
for_export: boolean
6697+
exclude_generated: boolean
66986698
})
66996699
----
67006700
link:{ref}/ml-get-job.html[Documentation] +
@@ -6711,7 +6711,7 @@ link:{ref}/ml-get-job.html[Documentation] +
67116711

67126712
WARNING: This parameter has been deprecated.
67136713

6714-
|`for_export` or `forExport`
6714+
|`exclude_generated` or `excludeGenerated`
67156715
|`boolean` - Omits fields that are illegal to set on job PUT
67166716

67176717
|===
@@ -6887,7 +6887,7 @@ client.ml.getTrainedModels({
68876887
from: number,
68886888
size: number,
68896889
tags: string | string[],
6890-
for_export: boolean
6890+
exclude_generated: boolean
68916891
})
68926892
----
68936893
link:{ref}/get-trained-models.html[Documentation] +
@@ -6922,7 +6922,7 @@ _Default:_ `100`
69226922
|`tags`
69236923
|`string \| string[]` - A comma-separated list of tags that the model must have.
69246924

6925-
|`for_export` or `forExport`
6925+
|`exclude_generated` or `excludeGenerated`
69266926
|`boolean` - Omits fields that are illegal to set on model PUT
69276927

69286928
|===
@@ -9158,6 +9158,27 @@ client.security.getUserPrivileges()
91589158
link:{ref}/security-api-get-privileges.html[Documentation] +
91599159

91609160

9161+
[discrete]
9162+
=== security.grantApiKey
9163+
9164+
[source,ts]
9165+
----
9166+
client.security.grantApiKey({
9167+
refresh: 'true' | 'false' | 'wait_for',
9168+
body: object
9169+
})
9170+
----
9171+
link:{ref}/security-api-grant-api-key.html[Documentation] +
9172+
[cols=2*]
9173+
|===
9174+
|`refresh`
9175+
|`'true' \| 'false' \| 'wait_for'` - If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes.
9176+
9177+
|`body`
9178+
|`object` - The api key request to create an API key
9179+
9180+
|===
9181+
91619182
[discrete]
91629183
=== security.hasPrivileges
91639184

@@ -9456,6 +9477,39 @@ link:{ref}/clean-up-snapshot-repo-api.html[Documentation] +
94569477

94579478
|===
94589479

9480+
[discrete]
9481+
=== snapshot.clone
9482+
9483+
[source,ts]
9484+
----
9485+
client.snapshot.clone({
9486+
repository: string,
9487+
snapshot: string,
9488+
target_snapshot: string,
9489+
master_timeout: string,
9490+
body: object
9491+
})
9492+
----
9493+
link:{ref}/modules-snapshots.html[Documentation] +
9494+
[cols=2*]
9495+
|===
9496+
|`repository`
9497+
|`string` - A repository name
9498+
9499+
|`snapshot`
9500+
|`string` - The name of the snapshot to clone from
9501+
9502+
|`target_snapshot` or `targetSnapshot`
9503+
|`string` - The name of the cloned snapshot to create
9504+
9505+
|`master_timeout` or `masterTimeout`
9506+
|`string` - Explicit operation timeout for connection to master node
9507+
9508+
|`body`
9509+
|`object` - The snapshot clone definition
9510+
9511+
|===
9512+
94599513
[discrete]
94609514
=== snapshot.create
94619515

@@ -9986,7 +10040,8 @@ client.transform.getTransform({
998610040
transform_id: string,
998710041
from: number,
998810042
size: number,
9989-
allow_no_match: boolean
10043+
allow_no_match: boolean,
10044+
exclude_generated: boolean
999010045
})
999110046
----
999210047
link:{ref}/get-transform.html[Documentation] +
@@ -10004,6 +10059,9 @@ link:{ref}/get-transform.html[Documentation] +
1000410059
|`allow_no_match` or `allowNoMatch`
1000510060
|`boolean` - Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)
1000610061

10062+
|`exclude_generated` or `excludeGenerated`
10063+
|`boolean` - Omits fields that are illegal to set on transform PUT
10064+
1000710065
|===
1000810066

1000910067
[discrete]

0 commit comments

Comments
 (0)