Skip to content

Commit 11c11e4

Browse files
committed
API generation
1 parent 27a4e90 commit 11c11e4

File tree

6 files changed

+163
-6
lines changed

6 files changed

+163
-6
lines changed

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/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: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,11 +2220,11 @@ export interface SecurityGetPrivileges extends Generic {
22202220
}
22212221

22222222
export interface SecurityGetRole extends Generic {
2223-
name?: string;
2223+
name?: string | string[];
22242224
}
22252225

22262226
export interface SecurityGetRoleMapping extends Generic {
2227-
name?: string;
2227+
name?: string | string[];
22282228
}
22292229

22302230
export interface SecurityGetToken<T = RequestBody> extends Generic {
@@ -2238,6 +2238,11 @@ export interface SecurityGetUser extends Generic {
22382238
export interface SecurityGetUserPrivileges extends Generic {
22392239
}
22402240

2241+
export interface SecurityGrantApiKey<T = RequestBody> extends Generic {
2242+
refresh?: 'wait_for' | boolean;
2243+
body: T;
2244+
}
2245+
22412246
export interface SecurityHasPrivileges<T = RequestBody> extends Generic {
22422247
user?: string;
22432248
body: T;
@@ -2312,6 +2317,14 @@ export interface SnapshotCleanupRepository extends Generic {
23122317
timeout?: string;
23132318
}
23142319

2320+
export interface SnapshotClone<T = RequestBody> extends Generic {
2321+
repository: string;
2322+
snapshot: string;
2323+
target_snapshot: string;
2324+
master_timeout?: string;
2325+
body: T;
2326+
}
2327+
23152328
export interface SnapshotCreate<T = RequestBody> extends Generic {
23162329
repository: string;
23172330
snapshot: string;

docs/reference.asciidoc

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9259,14 +9259,14 @@ link:{ref}/security-api-get-privileges.html[Documentation] +
92599259
[source,ts]
92609260
----
92619261
client.security.getRole({
9262-
name: string
9262+
name: string | string[]
92639263
})
92649264
----
92659265
link:{ref}/security-api-get-role.html[Documentation] +
92669266
[cols=2*]
92679267
|===
92689268
|`name`
9269-
|`string` - Role name
9269+
|`string \| string[]` - A comma-separated list of role names
92709270

92719271
|===
92729272

@@ -9276,14 +9276,14 @@ link:{ref}/security-api-get-role.html[Documentation] +
92769276
[source,ts]
92779277
----
92789278
client.security.getRoleMapping({
9279-
name: string
9279+
name: string | string[]
92809280
})
92819281
----
92829282
link:{ref}/security-api-get-role-mapping.html[Documentation] +
92839283
[cols=2*]
92849284
|===
92859285
|`name`
9286-
|`string` - Role-Mapping name
9286+
|`string \| string[]` - A comma-separated list of role-mapping names
92879287

92889288
|===
92899289

@@ -9331,6 +9331,27 @@ client.security.getUserPrivileges()
93319331
link:{ref}/security-api-get-privileges.html[Documentation] +
93329332

93339333

9334+
[discrete]
9335+
=== security.grantApiKey
9336+
9337+
[source,ts]
9338+
----
9339+
client.security.grantApiKey({
9340+
refresh: 'true' | 'false' | 'wait_for',
9341+
body: object
9342+
})
9343+
----
9344+
link:{ref}/security-api-grant-api-key.html[Documentation] +
9345+
[cols=2*]
9346+
|===
9347+
|`refresh`
9348+
|`'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.
9349+
9350+
|`body`
9351+
|`object` - The api key request to create an API key
9352+
9353+
|===
9354+
93349355
[discrete]
93359356
=== security.hasPrivileges
93369357

@@ -9629,6 +9650,39 @@ link:{ref}/clean-up-snapshot-repo-api.html[Documentation] +
96299650

96309651
|===
96319652

9653+
[discrete]
9654+
=== snapshot.clone
9655+
9656+
[source,ts]
9657+
----
9658+
client.snapshot.clone({
9659+
repository: string,
9660+
snapshot: string,
9661+
target_snapshot: string,
9662+
master_timeout: string,
9663+
body: object
9664+
})
9665+
----
9666+
link:{ref}/modules-snapshots.html[Documentation] +
9667+
[cols=2*]
9668+
|===
9669+
|`repository`
9670+
|`string` - A repository name
9671+
9672+
|`snapshot`
9673+
|`string` - The name of the snapshot to clone from
9674+
9675+
|`target_snapshot` or `targetSnapshot`
9676+
|`string` - The name of the cloned snapshot to create
9677+
9678+
|`master_timeout` or `masterTimeout`
9679+
|`string` - Explicit operation timeout for connection to master node
9680+
9681+
|`body`
9682+
|`object` - The snapshot clone definition
9683+
9684+
|===
9685+
96329686
[discrete]
96339687
=== snapshot.create
96349688

index.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,6 +2156,14 @@ declare class Client {
21562156
getUserPrivileges<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
21572157
getUserPrivileges<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SecurityGetUserPrivileges, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
21582158
getUserPrivileges<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SecurityGetUserPrivileges, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
2159+
grant_api_key<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGrantApiKey<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
2160+
grant_api_key<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
2161+
grant_api_key<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityGrantApiKey<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
2162+
grant_api_key<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityGrantApiKey<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
2163+
grantApiKey<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityGrantApiKey<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
2164+
grantApiKey<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
2165+
grantApiKey<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityGrantApiKey<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
2166+
grantApiKey<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityGrantApiKey<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
21592167
has_privileges<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityHasPrivileges<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
21602168
has_privileges<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
21612169
has_privileges<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityHasPrivileges<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
@@ -2288,6 +2296,10 @@ declare class Client {
22882296
cleanupRepository<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
22892297
cleanupRepository<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotCleanupRepository, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
22902298
cleanupRepository<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotCleanupRepository, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
2299+
clone<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotClone<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
2300+
clone<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
2301+
clone<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotClone<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
2302+
clone<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotClone<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
22912303
create<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotCreate<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
22922304
create<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
22932305
create<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotCreate<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback

0 commit comments

Comments
 (0)