Skip to content

Commit c1dfb01

Browse files
committed
API generation
1 parent c901c78 commit c1dfb01

File tree

8 files changed

+194
-17
lines changed

8 files changed

+194
-17
lines changed

api/api/ml.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 = ['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', 'verbose', 'allow_no_datafeeds', 'influencer_score', 'top_n', 'bucket_span', 'overall_score', 'record_score', 'include', 'include_model_definition', 'decompress_definition', 'tags', 'for_export', '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', 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', forExport: 'for_export', 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

Lines changed: 28 additions & 0 deletions
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

Lines changed: 48 additions & 0 deletions
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

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 = ['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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ interface KibanaClient {
397397
getToken<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGetToken<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
398398
getUser<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGetUser, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
399399
getUserPrivileges<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGetUserPrivileges, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
400+
grantApiKey<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGrantApiKey<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
400401
hasPrivileges<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityHasPrivileges<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
401402
invalidateApiKey<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityInvalidateApiKey<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
402403
invalidateToken<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityInvalidateToken<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
@@ -418,6 +419,7 @@ interface KibanaClient {
418419
}
419420
snapshot: {
420421
cleanupRepository<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotCleanupRepository, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
422+
clone<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotClone<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
421423
create<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotCreate<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
422424
createRepository<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotCreateRepository<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
423425
delete<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotDelete, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>

api/requestParams.d.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,7 @@ export interface MlGetDataFrameAnalytics extends Generic {
15941594
allow_no_match?: boolean;
15951595
from?: number;
15961596
size?: number;
1597+
exclude_generated?: boolean;
15971598
}
15981599

15991600
export interface MlGetDataFrameAnalyticsStats extends Generic {
@@ -1614,6 +1615,7 @@ export interface MlGetDatafeeds extends Generic {
16141615
datafeed_id?: string;
16151616
allow_no_match?: boolean;
16161617
allow_no_datafeeds?: boolean;
1618+
exclude_generated?: boolean;
16171619
}
16181620

16191621
export interface MlGetFilters extends Generic {
@@ -1645,6 +1647,7 @@ export interface MlGetJobs extends Generic {
16451647
job_id?: string;
16461648
allow_no_match?: boolean;
16471649
allow_no_jobs?: boolean;
1650+
exclude_generated?: boolean;
16481651
}
16491652

16501653
export interface MlGetModelSnapshots<T = RequestBody> extends Generic {
@@ -1694,7 +1697,7 @@ export interface MlGetTrainedModels extends Generic {
16941697
from?: number;
16951698
size?: number;
16961699
tags?: string | string[];
1697-
for_export?: boolean;
1700+
exclude_generated?: boolean;
16981701
}
16991702

17001703
export interface MlGetTrainedModelsStats extends Generic {
@@ -2220,11 +2223,11 @@ export interface SecurityGetPrivileges extends Generic {
22202223
}
22212224

22222225
export interface SecurityGetRole extends Generic {
2223-
name?: string;
2226+
name?: string | string[];
22242227
}
22252228

22262229
export interface SecurityGetRoleMapping extends Generic {
2227-
name?: string;
2230+
name?: string | string[];
22282231
}
22292232

22302233
export interface SecurityGetToken<T = RequestBody> extends Generic {
@@ -2238,6 +2241,11 @@ export interface SecurityGetUser extends Generic {
22382241
export interface SecurityGetUserPrivileges extends Generic {
22392242
}
22402243

2244+
export interface SecurityGrantApiKey<T = RequestBody> extends Generic {
2245+
refresh?: 'wait_for' | boolean;
2246+
body: T;
2247+
}
2248+
22412249
export interface SecurityHasPrivileges<T = RequestBody> extends Generic {
22422250
user?: string;
22432251
body: T;
@@ -2312,6 +2320,14 @@ export interface SnapshotCleanupRepository extends Generic {
23122320
timeout?: string;
23132321
}
23142322

2323+
export interface SnapshotClone<T = RequestBody> extends Generic {
2324+
repository: string;
2325+
snapshot: string;
2326+
target_snapshot: string;
2327+
master_timeout?: string;
2328+
body: T;
2329+
}
2330+
23152331
export interface SnapshotCreate<T = RequestBody> extends Generic {
23162332
repository: string;
23172333
snapshot: string;
@@ -2443,6 +2459,7 @@ export interface TransformGetTransform extends Generic {
24432459
from?: number;
24442460
size?: number;
24452461
allow_no_match?: boolean;
2462+
exclude_generated?: boolean;
24462463
}
24472464

24482465
export interface TransformGetTransformStats extends Generic {

0 commit comments

Comments
 (0)