diff --git a/api/api/security.js b/api/api/security.js index 66f61ac17..a0aed418b 100644 --- a/api/api/security.js +++ b/api/api/security.js @@ -594,6 +594,33 @@ SecurityApi.prototype.getUserPrivileges = function securityGetUserPrivilegesApi return this.transport.request(request, options, callback) } +SecurityApi.prototype.grantApiKey = function securityGrantApiKeyApi (params, options, callback) { + ;[params, options, callback] = normalizeArguments(params, options, callback) + + // check required parameters + if (params['body'] == null) { + const err = new this[kConfigurationError]('Missing required parameter: body') + return handleError(err, callback) + } + + var { method, body, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) + + var path = '' + if (method == null) method = 'POST' + path = '/' + '_security' + '/' + 'api_key' + '/' + 'grant' + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + return this.transport.request(request, options, callback) +} + SecurityApi.prototype.hasPrivileges = function securityHasPrivilegesApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) @@ -821,6 +848,7 @@ Object.defineProperties(SecurityApi.prototype, { get_token: { get () { return this.getToken } }, get_user: { get () { return this.getUser } }, get_user_privileges: { get () { return this.getUserPrivileges } }, + grant_api_key: { get () { return this.grantApiKey } }, has_privileges: { get () { return this.hasPrivileges } }, invalidate_api_key: { get () { return this.invalidateApiKey } }, invalidate_token: { get () { return this.invalidateToken } }, diff --git a/api/api/snapshot.js b/api/api/snapshot.js index 377fd016b..6f2c5ce21 100644 --- a/api/api/snapshot.js +++ b/api/api/snapshot.js @@ -58,6 +58,54 @@ SnapshotApi.prototype.cleanupRepository = function snapshotCleanupRepositoryApi return this.transport.request(request, options, callback) } +SnapshotApi.prototype.clone = function snapshotCloneApi (params, options, callback) { + ;[params, options, callback] = normalizeArguments(params, options, callback) + + // check required parameters + if (params['repository'] == null) { + const err = new this[kConfigurationError]('Missing required parameter: repository') + return handleError(err, callback) + } + if (params['snapshot'] == null) { + const err = new this[kConfigurationError]('Missing required parameter: snapshot') + return handleError(err, callback) + } + if (params['target_snapshot'] == null && params['targetSnapshot'] == null) { + const err = new this[kConfigurationError]('Missing required parameter: target_snapshot or targetSnapshot') + return handleError(err, callback) + } + if (params['body'] == null) { + const err = new this[kConfigurationError]('Missing required parameter: body') + return handleError(err, callback) + } + + // check required url components + if ((params['target_snapshot'] != null || params['targetSnapshot'] != null) && (params['snapshot'] == null || params['repository'] == null)) { + const err = new this[kConfigurationError]('Missing required parameter of the url: snapshot, repository') + return handleError(err, callback) + } else if (params['snapshot'] != null && (params['repository'] == null)) { + const err = new this[kConfigurationError]('Missing required parameter of the url: repository') + return handleError(err, callback) + } + + var { method, body, repository, snapshot, targetSnapshot, target_snapshot, ...querystring } = params + querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) + + var path = '' + if (method == null) method = 'PUT' + path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot) + '/' + '_clone' + '/' + encodeURIComponent(target_snapshot || targetSnapshot) + + // build request object + const request = { + method, + path, + body: body || '', + querystring + } + + return this.transport.request(request, options, callback) +} + SnapshotApi.prototype.create = function snapshotCreateApi (params, options, callback) { ;[params, options, callback] = normalizeArguments(params, options, callback) diff --git a/api/kibana.d.ts b/api/kibana.d.ts index 7fc7a7ff1..de4ece420 100644 --- a/api/kibana.d.ts +++ b/api/kibana.d.ts @@ -397,6 +397,7 @@ interface KibanaClient { getToken, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SecurityGetToken, options?: TransportRequestOptions): TransportRequestPromise> getUser, TContext = Context>(params?: RequestParams.SecurityGetUser, options?: TransportRequestOptions): TransportRequestPromise> getUserPrivileges, TContext = Context>(params?: RequestParams.SecurityGetUserPrivileges, options?: TransportRequestOptions): TransportRequestPromise> + grantApiKey, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SecurityGrantApiKey, options?: TransportRequestOptions): TransportRequestPromise> hasPrivileges, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SecurityHasPrivileges, options?: TransportRequestOptions): TransportRequestPromise> invalidateApiKey, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SecurityInvalidateApiKey, options?: TransportRequestOptions): TransportRequestPromise> invalidateToken, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SecurityInvalidateToken, options?: TransportRequestOptions): TransportRequestPromise> @@ -418,6 +419,7 @@ interface KibanaClient { } snapshot: { cleanupRepository, TContext = Context>(params?: RequestParams.SnapshotCleanupRepository, options?: TransportRequestOptions): TransportRequestPromise> + clone, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SnapshotClone, options?: TransportRequestOptions): TransportRequestPromise> create, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SnapshotCreate, options?: TransportRequestOptions): TransportRequestPromise> createRepository, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SnapshotCreateRepository, options?: TransportRequestOptions): TransportRequestPromise> delete, TContext = Context>(params?: RequestParams.SnapshotDelete, options?: TransportRequestOptions): TransportRequestPromise> diff --git a/api/requestParams.d.ts b/api/requestParams.d.ts index 4cfc84684..089e954f3 100644 --- a/api/requestParams.d.ts +++ b/api/requestParams.d.ts @@ -2220,11 +2220,11 @@ export interface SecurityGetPrivileges extends Generic { } export interface SecurityGetRole extends Generic { - name?: string; + name?: string | string[]; } export interface SecurityGetRoleMapping extends Generic { - name?: string; + name?: string | string[]; } export interface SecurityGetToken extends Generic { @@ -2238,6 +2238,11 @@ export interface SecurityGetUser extends Generic { export interface SecurityGetUserPrivileges extends Generic { } +export interface SecurityGrantApiKey extends Generic { + refresh?: 'wait_for' | boolean; + body: T; +} + export interface SecurityHasPrivileges extends Generic { user?: string; body: T; @@ -2312,6 +2317,14 @@ export interface SnapshotCleanupRepository extends Generic { timeout?: string; } +export interface SnapshotClone extends Generic { + repository: string; + snapshot: string; + target_snapshot: string; + master_timeout?: string; + body: T; +} + export interface SnapshotCreate extends Generic { repository: string; snapshot: string; diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index 05f233d17..bc6e0c276 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -9259,14 +9259,14 @@ link:{ref}/security-api-get-privileges.html[Documentation] + [source,ts] ---- client.security.getRole({ - name: string + name: string | string[] }) ---- link:{ref}/security-api-get-role.html[Documentation] + [cols=2*] |=== |`name` -|`string` - Role name +|`string \| string[]` - A comma-separated list of role names |=== @@ -9276,14 +9276,14 @@ link:{ref}/security-api-get-role.html[Documentation] + [source,ts] ---- client.security.getRoleMapping({ - name: string + name: string | string[] }) ---- link:{ref}/security-api-get-role-mapping.html[Documentation] + [cols=2*] |=== |`name` -|`string` - Role-Mapping name +|`string \| string[]` - A comma-separated list of role-mapping names |=== @@ -9331,6 +9331,27 @@ client.security.getUserPrivileges() link:{ref}/security-api-get-privileges.html[Documentation] + +[discrete] +=== security.grantApiKey + +[source,ts] +---- +client.security.grantApiKey({ + refresh: 'true' | 'false' | 'wait_for', + body: object +}) +---- +link:{ref}/security-api-grant-api-key.html[Documentation] + +[cols=2*] +|=== +|`refresh` +|`'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. + +|`body` +|`object` - The api key request to create an API key + +|=== + [discrete] === security.hasPrivileges @@ -9629,6 +9650,39 @@ link:{ref}/clean-up-snapshot-repo-api.html[Documentation] + |=== +[discrete] +=== snapshot.clone + +[source,ts] +---- +client.snapshot.clone({ + repository: string, + snapshot: string, + target_snapshot: string, + master_timeout: string, + body: object +}) +---- +link:{ref}/modules-snapshots.html[Documentation] + +[cols=2*] +|=== +|`repository` +|`string` - A repository name + +|`snapshot` +|`string` - The name of the snapshot to clone from + +|`target_snapshot` or `targetSnapshot` +|`string` - The name of the cloned snapshot to create + +|`master_timeout` or `masterTimeout` +|`string` - Explicit operation timeout for connection to master node + +|`body` +|`object` - The snapshot clone definition + +|=== + [discrete] === snapshot.create diff --git a/index.d.ts b/index.d.ts index ddbb621aa..87e120883 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2156,6 +2156,14 @@ declare class Client { getUserPrivileges, TContext = Context>(callback: callbackFn): TransportRequestCallback getUserPrivileges, TContext = Context>(params: RequestParams.SecurityGetUserPrivileges, callback: callbackFn): TransportRequestCallback getUserPrivileges, TContext = Context>(params: RequestParams.SecurityGetUserPrivileges, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + grant_api_key, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SecurityGrantApiKey, options?: TransportRequestOptions): TransportRequestPromise> + grant_api_key, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback + grant_api_key, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.SecurityGrantApiKey, callback: callbackFn): TransportRequestCallback + grant_api_key, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.SecurityGrantApiKey, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + grantApiKey, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SecurityGrantApiKey, options?: TransportRequestOptions): TransportRequestPromise> + grantApiKey, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback + grantApiKey, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.SecurityGrantApiKey, callback: callbackFn): TransportRequestCallback + grantApiKey, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.SecurityGrantApiKey, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback has_privileges, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SecurityHasPrivileges, options?: TransportRequestOptions): TransportRequestPromise> has_privileges, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback has_privileges, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.SecurityHasPrivileges, callback: callbackFn): TransportRequestCallback @@ -2288,6 +2296,10 @@ declare class Client { cleanupRepository, TContext = Context>(callback: callbackFn): TransportRequestCallback cleanupRepository, TContext = Context>(params: RequestParams.SnapshotCleanupRepository, callback: callbackFn): TransportRequestCallback cleanupRepository, TContext = Context>(params: RequestParams.SnapshotCleanupRepository, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback + clone, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SnapshotClone, options?: TransportRequestOptions): TransportRequestPromise> + clone, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback + clone, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.SnapshotClone, callback: callbackFn): TransportRequestCallback + clone, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.SnapshotClone, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback create, TRequestBody extends RequestBody = Record, TContext = Context>(params?: RequestParams.SnapshotCreate, options?: TransportRequestOptions): TransportRequestPromise> create, TRequestBody extends RequestBody = Record, TContext = Context>(callback: callbackFn): TransportRequestCallback create, TRequestBody extends RequestBody = Record, TContext = Context>(params: RequestParams.SnapshotCreate, callback: callbackFn): TransportRequestCallback