mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
Move and rename legacy elasticsearch client (#69797)
* move last snapshot to inline * move legacy files to legacy subfolder * move request types out of legacy * export Headers from http instead of elasticsearch * renaming - first pass * renaming - second pass * fix core mocks * adapt new calls * update generated doc * fix IT test mocks * fix new usages
This commit is contained in:
parent
3347c8b9df
commit
fe1c508d8d
303 changed files with 1668 additions and 1543 deletions
|
@ -1,21 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CallAPIOptions](./kibana-plugin-core-server.callapioptions.md)
|
||||
|
||||
## CallAPIOptions interface
|
||||
|
||||
The set of options that defines how API call should be made and result be processed.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface CallAPIOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [signal](./kibana-plugin-core-server.callapioptions.signal.md) | <code>AbortSignal</code> | A signal object that allows you to abort the request via an AbortController object. |
|
||||
| [wrap401Errors](./kibana-plugin-core-server.callapioptions.wrap401errors.md) | <code>boolean</code> | Indicates whether <code>401 Unauthorized</code> errors returned from the Elasticsearch API should be wrapped into <code>Boom</code> error instances with properly set <code>WWW-Authenticate</code> header that could have been returned by the API itself. If API didn't specify that then <code>Basic realm="Authorization Required"</code> is used as <code>WWW-Authenticate</code>. |
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ClusterClient](./kibana-plugin-core-server.clusterclient.md) > [(constructor)](./kibana-plugin-core-server.clusterclient._constructor_.md)
|
||||
|
||||
## ClusterClient.(constructor)
|
||||
|
||||
Constructs a new instance of the `ClusterClient` class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
constructor(config: ElasticsearchClientConfig, log: Logger, getAuthHeaders?: GetAuthHeaders);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| config | <code>ElasticsearchClientConfig</code> | |
|
||||
| log | <code>Logger</code> | |
|
||||
| getAuthHeaders | <code>GetAuthHeaders</code> | |
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ClusterClient](./kibana-plugin-core-server.clusterclient.md) > [asScoped](./kibana-plugin-core-server.clusterclient.asscoped.md)
|
||||
|
||||
## ClusterClient.asScoped() method
|
||||
|
||||
Creates an instance of [IScopedClusterClient](./kibana-plugin-core-server.iscopedclusterclient.md) based on the configuration the current cluster client that exposes additional `callAsCurrentUser` method scoped to the provided req. Consumers shouldn't worry about closing scoped client instances, these will be automatically closed as soon as the original cluster client isn't needed anymore and closed.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
asScoped(request?: ScopeableRequest): IScopedClusterClient;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| request | <code>ScopeableRequest</code> | Request the <code>IScopedClusterClient</code> instance will be scoped to. Supports request optionality, Legacy.Request & FakeRequest for BWC with LegacyPlatform |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`IScopedClusterClient`
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ClusterClient](./kibana-plugin-core-server.clusterclient.md) > [callAsInternalUser](./kibana-plugin-core-server.clusterclient.callasinternaluser.md)
|
||||
|
||||
## ClusterClient.callAsInternalUser property
|
||||
|
||||
Calls specified endpoint with provided clientParams on behalf of the Kibana internal user. See [APICaller](./kibana-plugin-core-server.apicaller.md)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
callAsInternalUser: APICaller;
|
||||
```
|
|
@ -1,35 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ClusterClient](./kibana-plugin-core-server.clusterclient.md)
|
||||
|
||||
## ClusterClient class
|
||||
|
||||
Represents an Elasticsearch cluster API client created by the platform. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via `asScoped(...)`<!-- -->).
|
||||
|
||||
See [ClusterClient](./kibana-plugin-core-server.clusterclient.md)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class ClusterClient implements IClusterClient
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(config, log, getAuthHeaders)](./kibana-plugin-core-server.clusterclient._constructor_.md) | | Constructs a new instance of the <code>ClusterClient</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [callAsInternalUser](./kibana-plugin-core-server.clusterclient.callasinternaluser.md) | | <code>APICaller</code> | Calls specified endpoint with provided clientParams on behalf of the Kibana internal user. See [APICaller](./kibana-plugin-core-server.apicaller.md)<!-- -->. |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [asScoped(request)](./kibana-plugin-core-server.clusterclient.asscoped.md) | | Creates an instance of [IScopedClusterClient](./kibana-plugin-core-server.iscopedclusterclient.md) based on the configuration the current cluster client that exposes additional <code>callAsCurrentUser</code> method scoped to the provided req. Consumers shouldn't worry about closing scoped client instances, these will be automatically closed as soon as the original cluster client isn't needed anymore and closed. |
|
||||
| [close()](./kibana-plugin-core-server.clusterclient.close.md) | | Closes the cluster client. After that client cannot be used and one should create a new client instance to be able to interact with Elasticsearch API. |
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchError](./kibana-plugin-core-server.elasticsearcherror.md) > [\[code\]](./kibana-plugin-core-server.elasticsearcherror._code_.md)
|
||||
|
||||
## ElasticsearchError.\[code\] property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
[code]?: string;
|
||||
```
|
|
@ -1,19 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchError](./kibana-plugin-core-server.elasticsearcherror.md)
|
||||
|
||||
## ElasticsearchError interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface ElasticsearchError extends Boom
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [\[code\]](./kibana-plugin-core-server.elasticsearcherror._code_.md) | <code>string</code> | |
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchErrorHelpers](./kibana-plugin-core-server.elasticsearcherrorhelpers.md) > [isNotAuthorizedError](./kibana-plugin-core-server.elasticsearcherrorhelpers.isnotauthorizederror.md)
|
||||
|
||||
## ElasticsearchErrorHelpers.isNotAuthorizedError() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
static isNotAuthorizedError(error: any): error is ElasticsearchError;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| error | <code>any</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`error is ElasticsearchError`
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
```typescript
|
||||
legacy: {
|
||||
readonly createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient;
|
||||
readonly client: IClusterClient;
|
||||
readonly createClient: (type: string, clientConfig?: Partial<LegacyElasticsearchClientConfig>) => ILegacyCustomClusterClient;
|
||||
readonly client: ILegacyClusterClient;
|
||||
};
|
||||
```
|
||||
|
|
|
@ -15,5 +15,5 @@ export interface ElasticsearchServiceSetup
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [legacy](./kibana-plugin-core-server.elasticsearchservicesetup.legacy.md) | <code>{</code><br/><code> readonly createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient;</code><br/><code> readonly client: IClusterClient;</code><br/><code> }</code> | |
|
||||
| [legacy](./kibana-plugin-core-server.elasticsearchservicesetup.legacy.md) | <code>{</code><br/><code> readonly createClient: (type: string, clientConfig?: Partial<LegacyElasticsearchClientConfig>) => ILegacyCustomClusterClient;</code><br/><code> readonly client: ILegacyClusterClient;</code><br/><code> }</code> | |
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
```typescript
|
||||
legacy: {
|
||||
readonly createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient;
|
||||
readonly client: IClusterClient;
|
||||
readonly createClient: (type: string, clientConfig?: Partial<LegacyElasticsearchClientConfig>) => ILegacyCustomClusterClient;
|
||||
readonly client: ILegacyClusterClient;
|
||||
};
|
||||
```
|
||||
|
|
|
@ -15,5 +15,5 @@ export interface ElasticsearchServiceStart
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [legacy](./kibana-plugin-core-server.elasticsearchservicestart.legacy.md) | <code>{</code><br/><code> readonly createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient;</code><br/><code> readonly client: IClusterClient;</code><br/><code> }</code> | |
|
||||
| [legacy](./kibana-plugin-core-server.elasticsearchservicestart.legacy.md) | <code>{</code><br/><code> readonly createClient: (type: string, clientConfig?: Partial<LegacyElasticsearchClientConfig>) => ILegacyCustomClusterClient;</code><br/><code> readonly client: ILegacyClusterClient;</code><br/><code> }</code> | |
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [IClusterClient](./kibana-plugin-core-server.iclusterclient.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ILegacyClusterClient](./kibana-plugin-core-server.ilegacyclusterclient.md)
|
||||
|
||||
## IClusterClient type
|
||||
## ILegacyClusterClient type
|
||||
|
||||
Represents an Elasticsearch cluster API client created by the platform. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via `asScoped(...)`<!-- -->).
|
||||
|
||||
See [ClusterClient](./kibana-plugin-core-server.clusterclient.md)<!-- -->.
|
||||
See [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type IClusterClient = Pick<ClusterClient, 'callAsInternalUser' | 'asScoped'>;
|
||||
export declare type ILegacyClusterClient = Pick<LegacyClusterClient, 'callAsInternalUser' | 'asScoped'>;
|
||||
```
|
|
@ -1,15 +1,15 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ICustomClusterClient](./kibana-plugin-core-server.icustomclusterclient.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ILegacyCustomClusterClient](./kibana-plugin-core-server.ilegacycustomclusterclient.md)
|
||||
|
||||
## ICustomClusterClient type
|
||||
## ILegacyCustomClusterClient type
|
||||
|
||||
Represents an Elasticsearch cluster API client created by a plugin. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via `asScoped(...)`<!-- -->).
|
||||
|
||||
See [ClusterClient](./kibana-plugin-core-server.clusterclient.md)<!-- -->.
|
||||
See [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type ICustomClusterClient = Pick<ClusterClient, 'callAsInternalUser' | 'close' | 'asScoped'>;
|
||||
export declare type ILegacyCustomClusterClient = Pick<LegacyClusterClient, 'callAsInternalUser' | 'close' | 'asScoped'>;
|
||||
```
|
|
@ -1,15 +1,15 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [IScopedClusterClient](./kibana-plugin-core-server.iscopedclusterclient.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ILegacyScopedClusterClient](./kibana-plugin-core-server.ilegacyscopedclusterclient.md)
|
||||
|
||||
## IScopedClusterClient type
|
||||
## ILegacyScopedClusterClient type
|
||||
|
||||
Serves the same purpose as "normal" `ClusterClient` but exposes additional `callAsCurrentUser` method that doesn't use credentials of the Kibana internal user (as `callAsInternalUser` does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API.
|
||||
|
||||
See [ScopedClusterClient](./kibana-plugin-core-server.scopedclusterclient.md)<!-- -->.
|
||||
See [LegacyScopedClusterClient](./kibana-plugin-core-server.legacyscopedclusterclient.md)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type IScopedClusterClient = Pick<ScopedClusterClient, 'callAsCurrentUser' | 'callAsInternalUser'>;
|
||||
export declare type ILegacyScopedClusterClient = Pick<LegacyScopedClusterClient, 'callAsCurrentUser' | 'callAsInternalUser'>;
|
||||
```
|
|
@ -1,12 +1,12 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [APICaller](./kibana-plugin-core-server.apicaller.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)
|
||||
|
||||
## APICaller interface
|
||||
## LegacyAPICaller interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface APICaller
|
||||
export interface LegacyAPICaller
|
||||
```
|
|
@ -0,0 +1,21 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyCallAPIOptions](./kibana-plugin-core-server.legacycallapioptions.md)
|
||||
|
||||
## LegacyCallAPIOptions interface
|
||||
|
||||
The set of options that defines how API call should be made and result be processed.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface LegacyCallAPIOptions
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [signal](./kibana-plugin-core-server.legacycallapioptions.signal.md) | <code>AbortSignal</code> | A signal object that allows you to abort the request via an AbortController object. |
|
||||
| [wrap401Errors](./kibana-plugin-core-server.legacycallapioptions.wrap401errors.md) | <code>boolean</code> | Indicates whether <code>401 Unauthorized</code> errors returned from the Elasticsearch API should be wrapped into <code>Boom</code> error instances with properly set <code>WWW-Authenticate</code> header that could have been returned by the API itself. If API didn't specify that then <code>Basic realm="Authorization Required"</code> is used as <code>WWW-Authenticate</code>. |
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CallAPIOptions](./kibana-plugin-core-server.callapioptions.md) > [signal](./kibana-plugin-core-server.callapioptions.signal.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyCallAPIOptions](./kibana-plugin-core-server.legacycallapioptions.md) > [signal](./kibana-plugin-core-server.legacycallapioptions.signal.md)
|
||||
|
||||
## CallAPIOptions.signal property
|
||||
## LegacyCallAPIOptions.signal property
|
||||
|
||||
A signal object that allows you to abort the request via an AbortController object.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [CallAPIOptions](./kibana-plugin-core-server.callapioptions.md) > [wrap401Errors](./kibana-plugin-core-server.callapioptions.wrap401errors.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyCallAPIOptions](./kibana-plugin-core-server.legacycallapioptions.md) > [wrap401Errors](./kibana-plugin-core-server.legacycallapioptions.wrap401errors.md)
|
||||
|
||||
## CallAPIOptions.wrap401Errors property
|
||||
## LegacyCallAPIOptions.wrap401Errors property
|
||||
|
||||
Indicates whether `401 Unauthorized` errors returned from the Elasticsearch API should be wrapped into `Boom` error instances with properly set `WWW-Authenticate` header that could have been returned by the API itself. If API didn't specify that then `Basic realm="Authorization Required"` is used as `WWW-Authenticate`<!-- -->.
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md) > [(constructor)](./kibana-plugin-core-server.legacyclusterclient._constructor_.md)
|
||||
|
||||
## LegacyClusterClient.(constructor)
|
||||
|
||||
Constructs a new instance of the `LegacyClusterClient` class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
constructor(config: LegacyElasticsearchClientConfig, log: Logger, getAuthHeaders?: GetAuthHeaders);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| config | <code>LegacyElasticsearchClientConfig</code> | |
|
||||
| log | <code>Logger</code> | |
|
||||
| getAuthHeaders | <code>GetAuthHeaders</code> | |
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md) > [asScoped](./kibana-plugin-core-server.legacyclusterclient.asscoped.md)
|
||||
|
||||
## LegacyClusterClient.asScoped() method
|
||||
|
||||
Creates an instance of [ILegacyScopedClusterClient](./kibana-plugin-core-server.ilegacyscopedclusterclient.md) based on the configuration the current cluster client that exposes additional `callAsCurrentUser` method scoped to the provided req. Consumers shouldn't worry about closing scoped client instances, these will be automatically closed as soon as the original cluster client isn't needed anymore and closed.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
asScoped(request?: ScopeableRequest): ILegacyScopedClusterClient;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| request | <code>ScopeableRequest</code> | Request the <code>IScopedClusterClient</code> instance will be scoped to. Supports request optionality, Legacy.Request & FakeRequest for BWC with LegacyPlatform |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`ILegacyScopedClusterClient`
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md) > [callAsInternalUser](./kibana-plugin-core-server.legacyclusterclient.callasinternaluser.md)
|
||||
|
||||
## LegacyClusterClient.callAsInternalUser property
|
||||
|
||||
Calls specified endpoint with provided clientParams on behalf of the Kibana internal user. See [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
callAsInternalUser: LegacyAPICaller;
|
||||
```
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ClusterClient](./kibana-plugin-core-server.clusterclient.md) > [close](./kibana-plugin-core-server.clusterclient.close.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md) > [close](./kibana-plugin-core-server.legacyclusterclient.close.md)
|
||||
|
||||
## ClusterClient.close() method
|
||||
## LegacyClusterClient.close() method
|
||||
|
||||
Closes the cluster client. After that client cannot be used and one should create a new client instance to be able to interact with Elasticsearch API.
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md)
|
||||
|
||||
## LegacyClusterClient class
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class LegacyClusterClient implements ILegacyClusterClient
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(config, log, getAuthHeaders)](./kibana-plugin-core-server.legacyclusterclient._constructor_.md) | | Constructs a new instance of the <code>LegacyClusterClient</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [callAsInternalUser](./kibana-plugin-core-server.legacyclusterclient.callasinternaluser.md) | | <code>LegacyAPICaller</code> | Calls specified endpoint with provided clientParams on behalf of the Kibana internal user. See [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)<!-- -->. |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [asScoped(request)](./kibana-plugin-core-server.legacyclusterclient.asscoped.md) | | Creates an instance of [ILegacyScopedClusterClient](./kibana-plugin-core-server.ilegacyscopedclusterclient.md) based on the configuration the current cluster client that exposes additional <code>callAsCurrentUser</code> method scoped to the provided req. Consumers shouldn't worry about closing scoped client instances, these will be automatically closed as soon as the original cluster client isn't needed anymore and closed. |
|
||||
| [close()](./kibana-plugin-core-server.legacyclusterclient.close.md) | | Closes the cluster client. After that client cannot be used and one should create a new client instance to be able to interact with Elasticsearch API. |
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchClientConfig](./kibana-plugin-core-server.elasticsearchclientconfig.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyElasticsearchClientConfig](./kibana-plugin-core-server.legacyelasticsearchclientconfig.md)
|
||||
|
||||
## ElasticsearchClientConfig type
|
||||
## LegacyElasticsearchClientConfig type
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type ElasticsearchClientConfig = Pick<ConfigOptions, 'keepAlive' | 'log' | 'plugins'> & Pick<ElasticsearchConfig, 'apiVersion' | 'customHeaders' | 'logQueries' | 'requestHeadersWhitelist' | 'sniffOnStart' | 'sniffOnConnectionFault' | 'hosts' | 'username' | 'password'> & {
|
||||
export declare type LegacyElasticsearchClientConfig = Pick<ConfigOptions, 'keepAlive' | 'log' | 'plugins'> & Pick<ElasticsearchConfig, 'apiVersion' | 'customHeaders' | 'logQueries' | 'requestHeadersWhitelist' | 'sniffOnStart' | 'sniffOnConnectionFault' | 'hosts' | 'username' | 'password'> & {
|
||||
pingTimeout?: ElasticsearchConfig['pingTimeout'] | ConfigOptions['pingTimeout'];
|
||||
requestTimeout?: ElasticsearchConfig['requestTimeout'] | ConfigOptions['requestTimeout'];
|
||||
sniffInterval?: ElasticsearchConfig['sniffInterval'] | ConfigOptions['sniffInterval'];
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyElasticsearchError](./kibana-plugin-core-server.legacyelasticsearcherror.md) > [\[code\]](./kibana-plugin-core-server.legacyelasticsearcherror._code_.md)
|
||||
|
||||
## LegacyElasticsearchError.\[code\] property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
[code]?: string;
|
||||
```
|
|
@ -0,0 +1,19 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyElasticsearchError](./kibana-plugin-core-server.legacyelasticsearcherror.md)
|
||||
|
||||
## LegacyElasticsearchError interface
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export interface LegacyElasticsearchError extends Boom
|
||||
```
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [\[code\]](./kibana-plugin-core-server.legacyelasticsearcherror._code_.md) | <code>string</code> | |
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchErrorHelpers](./kibana-plugin-core-server.elasticsearcherrorhelpers.md) > [decorateNotAuthorizedError](./kibana-plugin-core-server.elasticsearcherrorhelpers.decoratenotauthorizederror.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyElasticsearchErrorHelpers](./kibana-plugin-core-server.legacyelasticsearcherrorhelpers.md) > [decorateNotAuthorizedError](./kibana-plugin-core-server.legacyelasticsearcherrorhelpers.decoratenotauthorizederror.md)
|
||||
|
||||
## ElasticsearchErrorHelpers.decorateNotAuthorizedError() method
|
||||
## LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
static decorateNotAuthorizedError(error: Error, reason?: string): ElasticsearchError;
|
||||
static decorateNotAuthorizedError(error: Error, reason?: string): LegacyElasticsearchError;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
@ -19,5 +19,5 @@ static decorateNotAuthorizedError(error: Error, reason?: string): ElasticsearchE
|
|||
|
||||
<b>Returns:</b>
|
||||
|
||||
`ElasticsearchError`
|
||||
`LegacyElasticsearchError`
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyElasticsearchErrorHelpers](./kibana-plugin-core-server.legacyelasticsearcherrorhelpers.md) > [isNotAuthorizedError](./kibana-plugin-core-server.legacyelasticsearcherrorhelpers.isnotauthorizederror.md)
|
||||
|
||||
## LegacyElasticsearchErrorHelpers.isNotAuthorizedError() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
static isNotAuthorizedError(error: any): error is LegacyElasticsearchError;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| error | <code>any</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`error is LegacyElasticsearchError`
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchErrorHelpers](./kibana-plugin-core-server.elasticsearcherrorhelpers.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyElasticsearchErrorHelpers](./kibana-plugin-core-server.legacyelasticsearcherrorhelpers.md)
|
||||
|
||||
## ElasticsearchErrorHelpers class
|
||||
## LegacyElasticsearchErrorHelpers class
|
||||
|
||||
Helpers for working with errors returned from the Elasticsearch service.Since the internal data of errors are subject to change, consumers of the Elasticsearch service should always use these helpers to classify errors instead of checking error internals such as `body.error.header[WWW-Authenticate]`
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class ElasticsearchErrorHelpers
|
||||
export declare class LegacyElasticsearchErrorHelpers
|
||||
```
|
||||
|
||||
## Example
|
||||
|
@ -30,6 +30,6 @@ try {
|
|||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [decorateNotAuthorizedError(error, reason)](./kibana-plugin-core-server.elasticsearcherrorhelpers.decoratenotauthorizederror.md) | <code>static</code> | |
|
||||
| [isNotAuthorizedError(error)](./kibana-plugin-core-server.elasticsearcherrorhelpers.isnotauthorizederror.md) | <code>static</code> | |
|
||||
| [decorateNotAuthorizedError(error, reason)](./kibana-plugin-core-server.legacyelasticsearcherrorhelpers.decoratenotauthorizederror.md) | <code>static</code> | |
|
||||
| [isNotAuthorizedError(error)](./kibana-plugin-core-server.legacyelasticsearcherrorhelpers.isnotauthorizederror.md) | <code>static</code> | |
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyScopedClusterClient](./kibana-plugin-core-server.legacyscopedclusterclient.md) > [(constructor)](./kibana-plugin-core-server.legacyscopedclusterclient._constructor_.md)
|
||||
|
||||
## LegacyScopedClusterClient.(constructor)
|
||||
|
||||
Constructs a new instance of the `LegacyScopedClusterClient` class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
constructor(internalAPICaller: LegacyAPICaller, scopedAPICaller: LegacyAPICaller, headers?: Headers | undefined);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| internalAPICaller | <code>LegacyAPICaller</code> | |
|
||||
| scopedAPICaller | <code>LegacyAPICaller</code> | |
|
||||
| headers | <code>Headers | undefined</code> | |
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ScopedClusterClient](./kibana-plugin-core-server.scopedclusterclient.md) > [callAsCurrentUser](./kibana-plugin-core-server.scopedclusterclient.callascurrentuser.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyScopedClusterClient](./kibana-plugin-core-server.legacyscopedclusterclient.md) > [callAsCurrentUser](./kibana-plugin-core-server.legacyscopedclusterclient.callascurrentuser.md)
|
||||
|
||||
## ScopedClusterClient.callAsCurrentUser() method
|
||||
## LegacyScopedClusterClient.callAsCurrentUser() method
|
||||
|
||||
Calls specified `endpoint` with provided `clientParams` on behalf of the user initiated request to the Kibana server (via HTTP request headers). See [APICaller](./kibana-plugin-core-server.apicaller.md)<!-- -->.
|
||||
Calls specified `endpoint` with provided `clientParams` on behalf of the user initiated request to the Kibana server (via HTTP request headers). See [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
callAsCurrentUser(endpoint: string, clientParams?: Record<string, any>, options?: CallAPIOptions): Promise<any>;
|
||||
callAsCurrentUser(endpoint: string, clientParams?: Record<string, any>, options?: LegacyCallAPIOptions): Promise<any>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
@ -18,7 +18,7 @@ callAsCurrentUser(endpoint: string, clientParams?: Record<string, any>, options?
|
|||
| --- | --- | --- |
|
||||
| endpoint | <code>string</code> | String descriptor of the endpoint e.g. <code>cluster.getSettings</code> or <code>ping</code>. |
|
||||
| clientParams | <code>Record<string, any></code> | A dictionary of parameters that will be passed directly to the Elasticsearch JS client. |
|
||||
| options | <code>CallAPIOptions</code> | Options that affect the way we call the API and process the result. |
|
||||
| options | <code>LegacyCallAPIOptions</code> | Options that affect the way we call the API and process the result. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ScopedClusterClient](./kibana-plugin-core-server.scopedclusterclient.md) > [callAsInternalUser](./kibana-plugin-core-server.scopedclusterclient.callasinternaluser.md)
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyScopedClusterClient](./kibana-plugin-core-server.legacyscopedclusterclient.md) > [callAsInternalUser](./kibana-plugin-core-server.legacyscopedclusterclient.callasinternaluser.md)
|
||||
|
||||
## ScopedClusterClient.callAsInternalUser() method
|
||||
## LegacyScopedClusterClient.callAsInternalUser() method
|
||||
|
||||
Calls specified `endpoint` with provided `clientParams` on behalf of the Kibana internal user. See [APICaller](./kibana-plugin-core-server.apicaller.md)<!-- -->.
|
||||
Calls specified `endpoint` with provided `clientParams` on behalf of the Kibana internal user. See [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
callAsInternalUser(endpoint: string, clientParams?: Record<string, any>, options?: CallAPIOptions): Promise<any>;
|
||||
callAsInternalUser(endpoint: string, clientParams?: Record<string, any>, options?: LegacyCallAPIOptions): Promise<any>;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
@ -18,7 +18,7 @@ callAsInternalUser(endpoint: string, clientParams?: Record<string, any>, options
|
|||
| --- | --- | --- |
|
||||
| endpoint | <code>string</code> | String descriptor of the endpoint e.g. <code>cluster.getSettings</code> or <code>ping</code>. |
|
||||
| clientParams | <code>Record<string, any></code> | A dictionary of parameters that will be passed directly to the Elasticsearch JS client. |
|
||||
| options | <code>CallAPIOptions</code> | Options that affect the way we call the API and process the result. |
|
||||
| options | <code>LegacyCallAPIOptions</code> | Options that affect the way we call the API and process the result. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LegacyScopedClusterClient](./kibana-plugin-core-server.legacyscopedclusterclient.md)
|
||||
|
||||
## LegacyScopedClusterClient class
|
||||
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class LegacyScopedClusterClient implements ILegacyScopedClusterClient
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(internalAPICaller, scopedAPICaller, headers)](./kibana-plugin-core-server.legacyscopedclusterclient._constructor_.md) | | Constructs a new instance of the <code>LegacyScopedClusterClient</code> class |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [callAsCurrentUser(endpoint, clientParams, options)](./kibana-plugin-core-server.legacyscopedclusterclient.callascurrentuser.md) | | Calls specified <code>endpoint</code> with provided <code>clientParams</code> on behalf of the user initiated request to the Kibana server (via HTTP request headers). See [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)<!-- -->. |
|
||||
| [callAsInternalUser(endpoint, clientParams, options)](./kibana-plugin-core-server.legacyscopedclusterclient.callasinternaluser.md) | | Calls specified <code>endpoint</code> with provided <code>clientParams</code> on behalf of the Kibana internal user. See [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md)<!-- -->. |
|
||||
|
|
@ -17,18 +17,18 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| Class | Description |
|
||||
| --- | --- |
|
||||
| [BasePath](./kibana-plugin-core-server.basepath.md) | Access or manipulate the Kibana base path |
|
||||
| [ClusterClient](./kibana-plugin-core-server.clusterclient.md) | Represents an Elasticsearch cluster API client created by the platform. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>).<!-- -->See [ClusterClient](./kibana-plugin-core-server.clusterclient.md)<!-- -->. |
|
||||
| [CspConfig](./kibana-plugin-core-server.cspconfig.md) | CSP configuration for use in Kibana. |
|
||||
| [ElasticsearchConfig](./kibana-plugin-core-server.elasticsearchconfig.md) | Wrapper of config schema. |
|
||||
| [ElasticsearchErrorHelpers](./kibana-plugin-core-server.elasticsearcherrorhelpers.md) | Helpers for working with errors returned from the Elasticsearch service.Since the internal data of errors are subject to change, consumers of the Elasticsearch service should always use these helpers to classify errors instead of checking error internals such as <code>body.error.header[WWW-Authenticate]</code> |
|
||||
| [KibanaRequest](./kibana-plugin-core-server.kibanarequest.md) | Kibana specific abstraction for an incoming request. |
|
||||
| [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md) | |
|
||||
| [LegacyElasticsearchErrorHelpers](./kibana-plugin-core-server.legacyelasticsearcherrorhelpers.md) | Helpers for working with errors returned from the Elasticsearch service.Since the internal data of errors are subject to change, consumers of the Elasticsearch service should always use these helpers to classify errors instead of checking error internals such as <code>body.error.header[WWW-Authenticate]</code> |
|
||||
| [LegacyScopedClusterClient](./kibana-plugin-core-server.legacyscopedclusterclient.md) | |
|
||||
| [RouteValidationError](./kibana-plugin-core-server.routevalidationerror.md) | Error to return when the validation is not successful. |
|
||||
| [SavedObjectsClient](./kibana-plugin-core-server.savedobjectsclient.md) | |
|
||||
| [SavedObjectsErrorHelpers](./kibana-plugin-core-server.savedobjectserrorhelpers.md) | |
|
||||
| [SavedObjectsRepository](./kibana-plugin-core-server.savedobjectsrepository.md) | |
|
||||
| [SavedObjectsSerializer](./kibana-plugin-core-server.savedobjectsserializer.md) | A serializer that can be used to manually convert [raw](./kibana-plugin-core-server.savedobjectsrawdoc.md) or [sanitized](./kibana-plugin-core-server.savedobjectsanitizeddoc.md) documents to the other kind. |
|
||||
| [SavedObjectTypeRegistry](./kibana-plugin-core-server.savedobjecttyperegistry.md) | Registry holding information about all the registered [saved object types](./kibana-plugin-core-server.savedobjectstype.md)<!-- -->. |
|
||||
| [ScopedClusterClient](./kibana-plugin-core-server.scopedclusterclient.md) | Serves the same purpose as "normal" <code>ClusterClient</code> but exposes additional <code>callAsCurrentUser</code> method that doesn't use credentials of the Kibana internal user (as <code>callAsInternalUser</code> does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API.<!-- -->See [ScopedClusterClient](./kibana-plugin-core-server.scopedclusterclient.md)<!-- -->. |
|
||||
|
||||
## Enumerations
|
||||
|
||||
|
@ -54,7 +54,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
|
||||
| Interface | Description |
|
||||
| --- | --- |
|
||||
| [APICaller](./kibana-plugin-core-server.apicaller.md) | |
|
||||
| [AssistanceAPIResponse](./kibana-plugin-core-server.assistanceapiresponse.md) | |
|
||||
| [AssistantAPIClientParams](./kibana-plugin-core-server.assistantapiclientparams.md) | |
|
||||
| [Authenticated](./kibana-plugin-core-server.authenticated.md) | |
|
||||
|
@ -63,7 +62,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [AuthRedirectedParams](./kibana-plugin-core-server.authredirectedparams.md) | Result of auth redirection. |
|
||||
| [AuthResultParams](./kibana-plugin-core-server.authresultparams.md) | Result of successful authentication. |
|
||||
| [AuthToolkit](./kibana-plugin-core-server.authtoolkit.md) | A tool set defining an outcome of Auth interceptor for incoming request. |
|
||||
| [CallAPIOptions](./kibana-plugin-core-server.callapioptions.md) | The set of options that defines how API call should be made and result be processed. |
|
||||
| [Capabilities](./kibana-plugin-core-server.capabilities.md) | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. |
|
||||
| [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) | APIs to manage the [Capabilities](./kibana-plugin-core-server.capabilities.md) that will be used by the application.<!-- -->Plugins relying on capabilities to toggle some of their features should register them during the setup phase using the <code>registerProvider</code> method.<!-- -->Plugins having the responsibility to restrict capabilities depending on a given context should register their capabilities switcher using the <code>registerSwitcher</code> method.<!-- -->Refers to the methods documentation for complete description and examples. |
|
||||
| [CapabilitiesStart](./kibana-plugin-core-server.capabilitiesstart.md) | APIs to access the application [Capabilities](./kibana-plugin-core-server.capabilities.md)<!-- -->. |
|
||||
|
@ -78,7 +76,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [DeprecationInfo](./kibana-plugin-core-server.deprecationinfo.md) | |
|
||||
| [DeprecationSettings](./kibana-plugin-core-server.deprecationsettings.md) | UiSettings deprecation field options. |
|
||||
| [DiscoveredPlugin](./kibana-plugin-core-server.discoveredplugin.md) | Small container object used to expose information about discovered plugins that may or may not have been started. |
|
||||
| [ElasticsearchError](./kibana-plugin-core-server.elasticsearcherror.md) | |
|
||||
| [ElasticsearchServiceSetup](./kibana-plugin-core-server.elasticsearchservicesetup.md) | |
|
||||
| [ElasticsearchServiceStart](./kibana-plugin-core-server.elasticsearchservicestart.md) | |
|
||||
| [ElasticsearchStatusMeta](./kibana-plugin-core-server.elasticsearchstatusmeta.md) | |
|
||||
|
@ -104,6 +101,9 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [IUiSettingsClient](./kibana-plugin-core-server.iuisettingsclient.md) | Server-side client that provides access to the advanced settings stored in elasticsearch. The settings provide control over the behavior of the Kibana application. For example, a user can specify how to display numeric or date fields. Users can adjust the settings via Management UI. |
|
||||
| [KibanaRequestEvents](./kibana-plugin-core-server.kibanarequestevents.md) | Request events. |
|
||||
| [KibanaRequestRoute](./kibana-plugin-core-server.kibanarequestroute.md) | Request specific route information exposed to a handler. |
|
||||
| [LegacyAPICaller](./kibana-plugin-core-server.legacyapicaller.md) | |
|
||||
| [LegacyCallAPIOptions](./kibana-plugin-core-server.legacycallapioptions.md) | The set of options that defines how API call should be made and result be processed. |
|
||||
| [LegacyElasticsearchError](./kibana-plugin-core-server.legacyelasticsearcherror.md) | |
|
||||
| [LegacyRequest](./kibana-plugin-core-server.legacyrequest.md) | |
|
||||
| [LegacyServiceSetupDeps](./kibana-plugin-core-server.legacyservicesetupdeps.md) | |
|
||||
| [LegacyServiceStartDeps](./kibana-plugin-core-server.legacyservicestartdeps.md) | |
|
||||
|
@ -128,7 +128,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [PluginConfigDescriptor](./kibana-plugin-core-server.pluginconfigdescriptor.md) | Describes a plugin configuration properties. |
|
||||
| [PluginInitializerContext](./kibana-plugin-core-server.plugininitializercontext.md) | Context that's available to plugins during initialization stage. |
|
||||
| [PluginManifest](./kibana-plugin-core-server.pluginmanifest.md) | Describes the set of required and optional properties plugin can define in its mandatory JSON manifest file. |
|
||||
| [RequestHandlerContext](./kibana-plugin-core-server.requesthandlercontext.md) | Plugin specific context passed to a route handler.<!-- -->Provides the following clients and services: - [savedObjects.client](./kibana-plugin-core-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [savedObjects.typeRegistry](./kibana-plugin-core-server.isavedobjecttyperegistry.md) - Type registry containing all the registered types. - [elasticsearch.legacy.client](./kibana-plugin-core-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-core-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request |
|
||||
| [RequestHandlerContext](./kibana-plugin-core-server.requesthandlercontext.md) | Plugin specific context passed to a route handler.<!-- -->Provides the following clients and services: - [savedObjects.client](./kibana-plugin-core-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [savedObjects.typeRegistry](./kibana-plugin-core-server.isavedobjecttyperegistry.md) - Type registry containing all the registered types. - [elasticsearch.legacy.client](./kibana-plugin-core-server.legacyscopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-core-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request |
|
||||
| [RouteConfig](./kibana-plugin-core-server.routeconfig.md) | Route specific configuration. |
|
||||
| [RouteConfigOptions](./kibana-plugin-core-server.routeconfigoptions.md) | Additional route options. |
|
||||
| [RouteConfigOptionsBody](./kibana-plugin-core-server.routeconfigoptionsbody.md) | Additional body options for a route |
|
||||
|
@ -222,7 +222,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [ConfigDeprecationProvider](./kibana-plugin-core-server.configdeprecationprovider.md) | A provider that should returns a list of [ConfigDeprecation](./kibana-plugin-core-server.configdeprecation.md)<!-- -->.<!-- -->See [ConfigDeprecationFactory](./kibana-plugin-core-server.configdeprecationfactory.md) for more usage examples. |
|
||||
| [ConfigPath](./kibana-plugin-core-server.configpath.md) | |
|
||||
| [DestructiveRouteMethod](./kibana-plugin-core-server.destructiveroutemethod.md) | Set of HTTP methods changing the state of the server. |
|
||||
| [ElasticsearchClientConfig](./kibana-plugin-core-server.elasticsearchclientconfig.md) | |
|
||||
| [Freezable](./kibana-plugin-core-server.freezable.md) | |
|
||||
| [GetAuthHeaders](./kibana-plugin-core-server.getauthheaders.md) | Get headers to authenticate a user against Elasticsearch. |
|
||||
| [GetAuthState](./kibana-plugin-core-server.getauthstate.md) | Gets authentication state for a request. Returned by <code>auth</code> interceptor. |
|
||||
|
@ -234,16 +233,17 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
|
|||
| [HttpResourcesResponseOptions](./kibana-plugin-core-server.httpresourcesresponseoptions.md) | HTTP Resources response parameters |
|
||||
| [HttpResponsePayload](./kibana-plugin-core-server.httpresponsepayload.md) | Data send to the client as a response payload. |
|
||||
| [IBasePath](./kibana-plugin-core-server.ibasepath.md) | Access or manipulate the Kibana base path[BasePath](./kibana-plugin-core-server.basepath.md) |
|
||||
| [IClusterClient](./kibana-plugin-core-server.iclusterclient.md) | Represents an Elasticsearch cluster API client created by the platform. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>).<!-- -->See [ClusterClient](./kibana-plugin-core-server.clusterclient.md)<!-- -->. |
|
||||
| [IContextProvider](./kibana-plugin-core-server.icontextprovider.md) | A function that returns a context value for a specific key of given context type. |
|
||||
| [ICustomClusterClient](./kibana-plugin-core-server.icustomclusterclient.md) | Represents an Elasticsearch cluster API client created by a plugin. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>).<!-- -->See [ClusterClient](./kibana-plugin-core-server.clusterclient.md)<!-- -->. |
|
||||
| [ILegacyClusterClient](./kibana-plugin-core-server.ilegacyclusterclient.md) | Represents an Elasticsearch cluster API client created by the platform. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>).<!-- -->See [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md)<!-- -->. |
|
||||
| [ILegacyCustomClusterClient](./kibana-plugin-core-server.ilegacycustomclusterclient.md) | Represents an Elasticsearch cluster API client created by a plugin. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>).<!-- -->See [LegacyClusterClient](./kibana-plugin-core-server.legacyclusterclient.md)<!-- -->. |
|
||||
| [ILegacyScopedClusterClient](./kibana-plugin-core-server.ilegacyscopedclusterclient.md) | Serves the same purpose as "normal" <code>ClusterClient</code> but exposes additional <code>callAsCurrentUser</code> method that doesn't use credentials of the Kibana internal user (as <code>callAsInternalUser</code> does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API.<!-- -->See [LegacyScopedClusterClient](./kibana-plugin-core-server.legacyscopedclusterclient.md)<!-- -->. |
|
||||
| [IsAuthenticated](./kibana-plugin-core-server.isauthenticated.md) | Returns authentication status for a request. |
|
||||
| [ISavedObjectsRepository](./kibana-plugin-core-server.isavedobjectsrepository.md) | See [SavedObjectsRepository](./kibana-plugin-core-server.savedobjectsrepository.md) |
|
||||
| [ISavedObjectTypeRegistry](./kibana-plugin-core-server.isavedobjecttyperegistry.md) | See [SavedObjectTypeRegistry](./kibana-plugin-core-server.savedobjecttyperegistry.md) for documentation. |
|
||||
| [IScopedClusterClient](./kibana-plugin-core-server.iscopedclusterclient.md) | Serves the same purpose as "normal" <code>ClusterClient</code> but exposes additional <code>callAsCurrentUser</code> method that doesn't use credentials of the Kibana internal user (as <code>callAsInternalUser</code> does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API.<!-- -->See [ScopedClusterClient](./kibana-plugin-core-server.scopedclusterclient.md)<!-- -->. |
|
||||
| [KibanaRequestRouteOptions](./kibana-plugin-core-server.kibanarequestrouteoptions.md) | Route options: If 'GET' or 'OPTIONS' method, body options won't be returned. |
|
||||
| [KibanaResponseFactory](./kibana-plugin-core-server.kibanaresponsefactory.md) | Creates an object containing request response payload, HTTP headers, error details, and other data transmitted to the client. |
|
||||
| [KnownHeaders](./kibana-plugin-core-server.knownheaders.md) | Set of well-known HTTP headers. |
|
||||
| [LegacyElasticsearchClientConfig](./kibana-plugin-core-server.legacyelasticsearchclientconfig.md) | |
|
||||
| [LifecycleResponseFactory](./kibana-plugin-core-server.lifecycleresponsefactory.md) | Creates an object containing redirection or error response with error details, HTTP headers, and other data transmitted to the client. |
|
||||
| [LoggerConfigType](./kibana-plugin-core-server.loggerconfigtype.md) | |
|
||||
| [MIGRATION\_ASSISTANCE\_INDEX\_ACTION](./kibana-plugin-core-server.migration_assistance_index_action.md) | |
|
||||
|
|
|
@ -14,7 +14,7 @@ core: {
|
|||
};
|
||||
elasticsearch: {
|
||||
legacy: {
|
||||
client: IScopedClusterClient;
|
||||
client: ILegacyScopedClusterClient;
|
||||
};
|
||||
};
|
||||
uiSettings: {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Plugin specific context passed to a route handler.
|
||||
|
||||
Provides the following clients and services: - [savedObjects.client](./kibana-plugin-core-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [savedObjects.typeRegistry](./kibana-plugin-core-server.isavedobjecttyperegistry.md) - Type registry containing all the registered types. - [elasticsearch.legacy.client](./kibana-plugin-core-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-core-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request
|
||||
Provides the following clients and services: - [savedObjects.client](./kibana-plugin-core-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [savedObjects.typeRegistry](./kibana-plugin-core-server.isavedobjecttyperegistry.md) - Type registry containing all the registered types. - [elasticsearch.legacy.client](./kibana-plugin-core-server.legacyscopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-core-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
|
@ -18,5 +18,5 @@ export interface RequestHandlerContext
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [core](./kibana-plugin-core-server.requesthandlercontext.core.md) | <code>{</code><br/><code> savedObjects: {</code><br/><code> client: SavedObjectsClientContract;</code><br/><code> typeRegistry: ISavedObjectTypeRegistry;</code><br/><code> };</code><br/><code> elasticsearch: {</code><br/><code> legacy: {</code><br/><code> client: IScopedClusterClient;</code><br/><code> };</code><br/><code> };</code><br/><code> uiSettings: {</code><br/><code> client: IUiSettingsClient;</code><br/><code> };</code><br/><code> }</code> | |
|
||||
| [core](./kibana-plugin-core-server.requesthandlercontext.core.md) | <code>{</code><br/><code> savedObjects: {</code><br/><code> client: SavedObjectsClientContract;</code><br/><code> typeRegistry: ISavedObjectTypeRegistry;</code><br/><code> };</code><br/><code> elasticsearch: {</code><br/><code> legacy: {</code><br/><code> client: ILegacyScopedClusterClient;</code><br/><code> };</code><br/><code> };</code><br/><code> uiSettings: {</code><br/><code> client: IUiSettingsClient;</code><br/><code> };</code><br/><code> }</code> | |
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ScopedClusterClient](./kibana-plugin-core-server.scopedclusterclient.md) > [(constructor)](./kibana-plugin-core-server.scopedclusterclient._constructor_.md)
|
||||
|
||||
## ScopedClusterClient.(constructor)
|
||||
|
||||
Constructs a new instance of the `ScopedClusterClient` class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
constructor(internalAPICaller: APICaller, scopedAPICaller: APICaller, headers?: Headers | undefined);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| internalAPICaller | <code>APICaller</code> | |
|
||||
| scopedAPICaller | <code>APICaller</code> | |
|
||||
| headers | <code>Headers | undefined</code> | |
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ScopedClusterClient](./kibana-plugin-core-server.scopedclusterclient.md)
|
||||
|
||||
## ScopedClusterClient class
|
||||
|
||||
Serves the same purpose as "normal" `ClusterClient` but exposes additional `callAsCurrentUser` method that doesn't use credentials of the Kibana internal user (as `callAsInternalUser` does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API.
|
||||
|
||||
See [ScopedClusterClient](./kibana-plugin-core-server.scopedclusterclient.md)<!-- -->.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class ScopedClusterClient implements IScopedClusterClient
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(internalAPICaller, scopedAPICaller, headers)](./kibana-plugin-core-server.scopedclusterclient._constructor_.md) | | Constructs a new instance of the <code>ScopedClusterClient</code> class |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [callAsCurrentUser(endpoint, clientParams, options)](./kibana-plugin-core-server.scopedclusterclient.callascurrentuser.md) | | Calls specified <code>endpoint</code> with provided <code>clientParams</code> on behalf of the user initiated request to the Kibana server (via HTTP request headers). See [APICaller](./kibana-plugin-core-server.apicaller.md)<!-- -->. |
|
||||
| [callAsInternalUser(endpoint, clientParams, options)](./kibana-plugin-core-server.scopedclusterclient.callasinternaluser.md) | | Calls specified <code>endpoint</code> with provided <code>clientParams</code> on behalf of the Kibana internal user. See [APICaller](./kibana-plugin-core-server.apicaller.md)<!-- -->. |
|
||||
|
|
@ -9,12 +9,12 @@ Constructs a new instance of the `IndexPatternsFetcher` class
|
|||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
constructor(callDataCluster: APICaller);
|
||||
constructor(callDataCluster: LegacyAPICaller);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| callDataCluster | <code>APICaller</code> | |
|
||||
| callDataCluster | <code>LegacyAPICaller</code> | |
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`#username throws if equal to "elastic", only while running from source 1`] = `"[username]: value of \\"elastic\\" is forbidden. This is a superuser account that can obfuscate privilege-related issues. You should use the \\"kibana_system\\" user instead."`;
|
|
@ -367,6 +367,8 @@ test('#username throws if equal to "elastic", only while running from source', (
|
|||
const obj = {
|
||||
username: 'elastic',
|
||||
};
|
||||
expect(() => config.schema.validate(obj, { dist: false })).toThrowErrorMatchingSnapshot();
|
||||
expect(() => config.schema.validate(obj, { dist: false })).toThrowErrorMatchingInlineSnapshot(
|
||||
`"[username]: value of \\"elastic\\" is forbidden. This is a superuser account that can obfuscate privilege-related issues. You should use the \\"kibana_system\\" user instead."`
|
||||
);
|
||||
expect(() => config.schema.validate(obj, { dist: true })).not.toThrow();
|
||||
});
|
||||
|
|
|
@ -19,26 +19,29 @@
|
|||
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { Client } from 'elasticsearch';
|
||||
import { IClusterClient, ICustomClusterClient } from './cluster_client';
|
||||
import { IScopedClusterClient } from './scoped_cluster_client';
|
||||
import {
|
||||
ILegacyClusterClient,
|
||||
ILegacyCustomClusterClient,
|
||||
ILegacyScopedClusterClient,
|
||||
} from './legacy';
|
||||
import { ElasticsearchConfig } from './elasticsearch_config';
|
||||
import { ElasticsearchService } from './elasticsearch_service';
|
||||
import { InternalElasticsearchServiceSetup, ElasticsearchStatusMeta } from './types';
|
||||
import { NodesVersionCompatibility } from './version_check/ensure_es_version';
|
||||
import { ServiceStatus, ServiceStatusLevels } from '../status';
|
||||
|
||||
const createScopedClusterClientMock = (): jest.Mocked<IScopedClusterClient> => ({
|
||||
const createScopedClusterClientMock = (): jest.Mocked<ILegacyScopedClusterClient> => ({
|
||||
callAsInternalUser: jest.fn(),
|
||||
callAsCurrentUser: jest.fn(),
|
||||
});
|
||||
|
||||
const createCustomClusterClientMock = (): jest.Mocked<ICustomClusterClient> => ({
|
||||
const createCustomClusterClientMock = (): jest.Mocked<ILegacyCustomClusterClient> => ({
|
||||
...createClusterClientMock(),
|
||||
close: jest.fn(),
|
||||
});
|
||||
|
||||
function createClusterClientMock() {
|
||||
const client: jest.Mocked<IClusterClient> = {
|
||||
const client: jest.Mocked<ILegacyClusterClient> = {
|
||||
callAsInternalUser: jest.fn(),
|
||||
asScoped: jest.fn(),
|
||||
};
|
||||
|
@ -48,8 +51,8 @@ function createClusterClientMock() {
|
|||
|
||||
interface MockedElasticSearchServiceSetup {
|
||||
legacy: {
|
||||
createClient: jest.Mock<ICustomClusterClient, any>;
|
||||
client: jest.Mocked<IClusterClient>;
|
||||
createClient: jest.Mock<ILegacyCustomClusterClient, any>;
|
||||
client: jest.Mocked<ILegacyClusterClient>;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -81,7 +84,7 @@ const createStartContractMock = () => {
|
|||
|
||||
type MockedInternalElasticSearchServiceSetup = jest.Mocked<
|
||||
InternalElasticsearchServiceSetup & {
|
||||
legacy: { client: jest.Mocked<IClusterClient> };
|
||||
legacy: { client: jest.Mocked<ILegacyClusterClient> };
|
||||
}
|
||||
>;
|
||||
const createInternalSetupContractMock = () => {
|
||||
|
|
|
@ -18,4 +18,4 @@
|
|||
*/
|
||||
|
||||
export const MockClusterClient = jest.fn();
|
||||
jest.mock('./cluster_client', () => ({ ClusterClient: MockClusterClient }));
|
||||
jest.mock('./legacy/cluster_client', () => ({ LegacyClusterClient: MockClusterClient }));
|
||||
|
|
|
@ -34,23 +34,26 @@ import { merge } from '../../utils';
|
|||
import { CoreContext } from '../core_context';
|
||||
import { Logger } from '../logging';
|
||||
import {
|
||||
ClusterClient,
|
||||
ScopeableRequest,
|
||||
IClusterClient,
|
||||
ICustomClusterClient,
|
||||
} from './cluster_client';
|
||||
import { ElasticsearchClientConfig } from './elasticsearch_client_config';
|
||||
LegacyClusterClient,
|
||||
ILegacyClusterClient,
|
||||
ILegacyCustomClusterClient,
|
||||
LegacyElasticsearchClientConfig,
|
||||
LegacyCallAPIOptions,
|
||||
} from './legacy';
|
||||
import { ElasticsearchConfig, ElasticsearchConfigType } from './elasticsearch_config';
|
||||
import { InternalHttpServiceSetup, GetAuthHeaders } from '../http/';
|
||||
import { InternalElasticsearchServiceSetup, ElasticsearchServiceStart } from './types';
|
||||
import { CallAPIOptions } from './api_types';
|
||||
import {
|
||||
InternalElasticsearchServiceSetup,
|
||||
ElasticsearchServiceStart,
|
||||
ScopeableRequest,
|
||||
} from './types';
|
||||
import { pollEsNodesVersion } from './version_check/ensure_es_version';
|
||||
import { calculateStatus$ } from './status';
|
||||
|
||||
/** @internal */
|
||||
interface CoreClusterClients {
|
||||
config: ElasticsearchConfig;
|
||||
client: ClusterClient;
|
||||
client: LegacyClusterClient;
|
||||
}
|
||||
|
||||
interface SetupDeps {
|
||||
|
@ -67,9 +70,9 @@ export class ElasticsearchService
|
|||
private kibanaVersion: string;
|
||||
private createClient?: (
|
||||
type: string,
|
||||
clientConfig?: Partial<ElasticsearchClientConfig>
|
||||
) => ICustomClusterClient;
|
||||
private client?: IClusterClient;
|
||||
clientConfig?: Partial<LegacyElasticsearchClientConfig>
|
||||
) => ILegacyCustomClusterClient;
|
||||
private client?: ILegacyClusterClient;
|
||||
|
||||
constructor(private readonly coreContext: CoreContext) {
|
||||
this.kibanaVersion = coreContext.env.packageInfo.version;
|
||||
|
@ -123,7 +126,7 @@ export class ElasticsearchService
|
|||
async callAsInternalUser(
|
||||
endpoint: string,
|
||||
clientParams: Record<string, any> = {},
|
||||
options?: CallAPIOptions
|
||||
options?: LegacyCallAPIOptions
|
||||
) {
|
||||
const _client = await client$.pipe(take(1)).toPromise();
|
||||
return await _client.callAsInternalUser(endpoint, clientParams, options);
|
||||
|
@ -134,7 +137,7 @@ export class ElasticsearchService
|
|||
async callAsCurrentUser(
|
||||
endpoint: string,
|
||||
clientParams: Record<string, any> = {},
|
||||
options?: CallAPIOptions
|
||||
options?: LegacyCallAPIOptions
|
||||
) {
|
||||
const _client = await client$.pipe(take(1)).toPromise();
|
||||
return await _client
|
||||
|
@ -155,7 +158,10 @@ export class ElasticsearchService
|
|||
kibanaVersion: this.kibanaVersion,
|
||||
}).pipe(takeUntil(this.stop$), shareReplay({ refCount: true, bufferSize: 1 }));
|
||||
|
||||
this.createClient = (type: string, clientConfig: Partial<ElasticsearchClientConfig> = {}) => {
|
||||
this.createClient = (
|
||||
type: string,
|
||||
clientConfig: Partial<LegacyElasticsearchClientConfig> = {}
|
||||
) => {
|
||||
const finalConfig = merge({}, config, clientConfig);
|
||||
return this.createClusterClient(type, finalConfig, deps.http.getAuthHeaders);
|
||||
};
|
||||
|
@ -193,10 +199,10 @@ export class ElasticsearchService
|
|||
|
||||
private createClusterClient(
|
||||
type: string,
|
||||
config: ElasticsearchClientConfig,
|
||||
config: LegacyElasticsearchClientConfig,
|
||||
getAuthHeaders?: GetAuthHeaders
|
||||
) {
|
||||
return new ClusterClient(
|
||||
return new LegacyClusterClient(
|
||||
config,
|
||||
this.coreContext.logger.get('elasticsearch', type),
|
||||
getAuthHeaders
|
||||
|
|
|
@ -18,17 +18,14 @@
|
|||
*/
|
||||
|
||||
export { ElasticsearchService } from './elasticsearch_service';
|
||||
export {
|
||||
ClusterClient,
|
||||
FakeRequest,
|
||||
IClusterClient,
|
||||
ICustomClusterClient,
|
||||
ScopeableRequest,
|
||||
} from './cluster_client';
|
||||
export { IScopedClusterClient, ScopedClusterClient, Headers } from './scoped_cluster_client';
|
||||
export { ElasticsearchClientConfig } from './elasticsearch_client_config';
|
||||
export { config, configSchema, ElasticsearchConfig } from './elasticsearch_config';
|
||||
export { ElasticsearchError, ElasticsearchErrorHelpers } from './errors';
|
||||
export * from './api_types';
|
||||
export * from './types';
|
||||
export { NodesVersionCompatibility } from './version_check/ensure_es_version';
|
||||
export {
|
||||
ElasticsearchServiceSetup,
|
||||
ElasticsearchServiceStart,
|
||||
ElasticsearchStatusMeta,
|
||||
InternalElasticsearchServiceSetup,
|
||||
FakeRequest,
|
||||
ScopeableRequest,
|
||||
} from './types';
|
||||
export * from './legacy';
|
||||
|
|
|
@ -151,7 +151,7 @@ import {
|
|||
*
|
||||
* @public
|
||||
*/
|
||||
export interface CallAPIOptions {
|
||||
export interface LegacyCallAPIOptions {
|
||||
/**
|
||||
* Indicates whether `401 Unauthorized` errors returned from the Elasticsearch API
|
||||
* should be wrapped into `Boom` error instances with properly set `WWW-Authenticate`
|
||||
|
@ -166,154 +166,154 @@ export interface CallAPIOptions {
|
|||
}
|
||||
|
||||
/** @public */
|
||||
export interface APICaller {
|
||||
export interface LegacyAPICaller {
|
||||
/* eslint-disable */
|
||||
(endpoint: 'bulk', params: BulkIndexDocumentsParams, options?: CallAPIOptions): ReturnType<Client['bulk']>;
|
||||
(endpoint: 'clearScroll', params: ClearScrollParams, options?: CallAPIOptions): ReturnType<Client['clearScroll']>;
|
||||
(endpoint: 'count', params: CountParams, options?: CallAPIOptions): ReturnType<Client['count']>;
|
||||
(endpoint: 'create', params: CreateDocumentParams, options?: CallAPIOptions): ReturnType<Client['create']>;
|
||||
(endpoint: 'delete', params: DeleteDocumentParams, options?: CallAPIOptions): ReturnType<Client['delete']>;
|
||||
(endpoint: 'deleteByQuery', params: DeleteDocumentByQueryParams, options?: CallAPIOptions): ReturnType<Client['deleteByQuery']>;
|
||||
(endpoint: 'deleteScript', params: DeleteScriptParams, options?: CallAPIOptions): ReturnType<Client['deleteScript']>;
|
||||
(endpoint: 'deleteTemplate', params: DeleteTemplateParams, options?: CallAPIOptions): ReturnType<Client['deleteTemplate']>;
|
||||
(endpoint: 'exists', params: ExistsParams, options?: CallAPIOptions): ReturnType<Client['exists']>;
|
||||
(endpoint: 'explain', params: ExplainParams, options?: CallAPIOptions): ReturnType<Client['explain']>;
|
||||
(endpoint: 'fieldStats', params: FieldStatsParams, options?: CallAPIOptions): ReturnType<Client['fieldStats']>;
|
||||
(endpoint: 'bulk', params: BulkIndexDocumentsParams, options?: LegacyCallAPIOptions): ReturnType<Client['bulk']>;
|
||||
(endpoint: 'clearScroll', params: ClearScrollParams, options?: LegacyCallAPIOptions): ReturnType<Client['clearScroll']>;
|
||||
(endpoint: 'count', params: CountParams, options?: LegacyCallAPIOptions): ReturnType<Client['count']>;
|
||||
(endpoint: 'create', params: CreateDocumentParams, options?: LegacyCallAPIOptions): ReturnType<Client['create']>;
|
||||
(endpoint: 'delete', params: DeleteDocumentParams, options?: LegacyCallAPIOptions): ReturnType<Client['delete']>;
|
||||
(endpoint: 'deleteByQuery', params: DeleteDocumentByQueryParams, options?: LegacyCallAPIOptions): ReturnType<Client['deleteByQuery']>;
|
||||
(endpoint: 'deleteScript', params: DeleteScriptParams, options?: LegacyCallAPIOptions): ReturnType<Client['deleteScript']>;
|
||||
(endpoint: 'deleteTemplate', params: DeleteTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['deleteTemplate']>;
|
||||
(endpoint: 'exists', params: ExistsParams, options?: LegacyCallAPIOptions): ReturnType<Client['exists']>;
|
||||
(endpoint: 'explain', params: ExplainParams, options?: LegacyCallAPIOptions): ReturnType<Client['explain']>;
|
||||
(endpoint: 'fieldStats', params: FieldStatsParams, options?: LegacyCallAPIOptions): ReturnType<Client['fieldStats']>;
|
||||
// Generic types cannot be properly looked up with ReturnType. Hard code these explicitly.
|
||||
<T>(endpoint: 'get', params: GetParams, options?: CallAPIOptions): Promise<GetResponse<T>>;
|
||||
(endpoint: 'getScript', params: GetScriptParams, options?: CallAPIOptions): ReturnType<Client['getScript']>;
|
||||
(endpoint: 'getSource', params: GetSourceParams, options?: CallAPIOptions): ReturnType<Client['getSource']>;
|
||||
(endpoint: 'getTemplate', params: GetTemplateParams, options?: CallAPIOptions): ReturnType<Client['getTemplate']>;
|
||||
<T>(endpoint: 'get', params: GetParams, options?: LegacyCallAPIOptions): Promise<GetResponse<T>>;
|
||||
(endpoint: 'getScript', params: GetScriptParams, options?: LegacyCallAPIOptions): ReturnType<Client['getScript']>;
|
||||
(endpoint: 'getSource', params: GetSourceParams, options?: LegacyCallAPIOptions): ReturnType<Client['getSource']>;
|
||||
(endpoint: 'getTemplate', params: GetTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['getTemplate']>;
|
||||
// Generic types cannot be properly looked up with ReturnType. Hard code these explicitly.
|
||||
<T>(endpoint: 'index', params: IndexDocumentParams<T>, options?: CallAPIOptions): ReturnType<Client['index']>;
|
||||
(endpoint: 'info', params: InfoParams, options?: CallAPIOptions): ReturnType<Client['info']>;
|
||||
<T>(endpoint: 'index', params: IndexDocumentParams<T>, options?: LegacyCallAPIOptions): ReturnType<Client['index']>;
|
||||
(endpoint: 'info', params: InfoParams, options?: LegacyCallAPIOptions): ReturnType<Client['info']>;
|
||||
// Generic types cannot be properly looked up with ReturnType. Hard code these explicitly.
|
||||
<T>(endpoint: 'mget', params: MGetParams, options?: CallAPIOptions): Promise<MGetResponse<T>>;
|
||||
<T>(endpoint: 'msearch', params: MSearchParams, options?: CallAPIOptions): Promise<MSearchResponse<T>>;
|
||||
<T>(endpoint: 'msearchTemplate', params: MSearchTemplateParams, options?: CallAPIOptions): Promise<MSearchResponse<T>>;
|
||||
(endpoint: 'mtermvectors', params: MTermVectorsParams, options?: CallAPIOptions): ReturnType<Client['mtermvectors']>;
|
||||
(endpoint: 'ping', params: PingParams, options?: CallAPIOptions): ReturnType<Client['ping']>;
|
||||
(endpoint: 'putScript', params: PutScriptParams, options?: CallAPIOptions): ReturnType<Client['putScript']>;
|
||||
(endpoint: 'putTemplate', params: PutTemplateParams, options?: CallAPIOptions): ReturnType<Client['putTemplate']>;
|
||||
(endpoint: 'reindex', params: ReindexParams, options?: CallAPIOptions): ReturnType<Client['reindex']>;
|
||||
(endpoint: 'reindexRethrottle', params: ReindexRethrottleParams, options?: CallAPIOptions): ReturnType<Client['reindexRethrottle']>;
|
||||
(endpoint: 'renderSearchTemplate', params: RenderSearchTemplateParams, options?: CallAPIOptions): ReturnType<Client['renderSearchTemplate']>;
|
||||
<T>(endpoint: 'mget', params: MGetParams, options?: LegacyCallAPIOptions): Promise<MGetResponse<T>>;
|
||||
<T>(endpoint: 'msearch', params: MSearchParams, options?: LegacyCallAPIOptions): Promise<MSearchResponse<T>>;
|
||||
<T>(endpoint: 'msearchTemplate', params: MSearchTemplateParams, options?: LegacyCallAPIOptions): Promise<MSearchResponse<T>>;
|
||||
(endpoint: 'mtermvectors', params: MTermVectorsParams, options?: LegacyCallAPIOptions): ReturnType<Client['mtermvectors']>;
|
||||
(endpoint: 'ping', params: PingParams, options?: LegacyCallAPIOptions): ReturnType<Client['ping']>;
|
||||
(endpoint: 'putScript', params: PutScriptParams, options?: LegacyCallAPIOptions): ReturnType<Client['putScript']>;
|
||||
(endpoint: 'putTemplate', params: PutTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['putTemplate']>;
|
||||
(endpoint: 'reindex', params: ReindexParams, options?: LegacyCallAPIOptions): ReturnType<Client['reindex']>;
|
||||
(endpoint: 'reindexRethrottle', params: ReindexRethrottleParams, options?: LegacyCallAPIOptions): ReturnType<Client['reindexRethrottle']>;
|
||||
(endpoint: 'renderSearchTemplate', params: RenderSearchTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['renderSearchTemplate']>;
|
||||
// Generic types cannot be properly looked up with ReturnType. Hard code these explicitly.
|
||||
<T>(endpoint: 'scroll', params: ScrollParams, options?: CallAPIOptions): Promise<SearchResponse<T>>;
|
||||
<T>(endpoint: 'search', params: SearchParams, options?: CallAPIOptions): Promise<SearchResponse<T>>;
|
||||
(endpoint: 'searchShards', params: SearchShardsParams, options?: CallAPIOptions): ReturnType<Client['searchShards']>;
|
||||
(endpoint: 'searchTemplate', params: SearchTemplateParams, options?: CallAPIOptions): ReturnType<Client['searchTemplate']>;
|
||||
(endpoint: 'suggest', params: SuggestParams, options?: CallAPIOptions): ReturnType<Client['suggest']>;
|
||||
(endpoint: 'termvectors', params: TermvectorsParams, options?: CallAPIOptions): ReturnType<Client['termvectors']>;
|
||||
(endpoint: 'update', params: UpdateDocumentParams, options?: CallAPIOptions): ReturnType<Client['update']>;
|
||||
(endpoint: 'updateByQuery', params: UpdateDocumentByQueryParams, options?: CallAPIOptions): ReturnType<Client['updateByQuery']>;
|
||||
<T>(endpoint: 'scroll', params: ScrollParams, options?: LegacyCallAPIOptions): Promise<SearchResponse<T>>;
|
||||
<T>(endpoint: 'search', params: SearchParams, options?: LegacyCallAPIOptions): Promise<SearchResponse<T>>;
|
||||
(endpoint: 'searchShards', params: SearchShardsParams, options?: LegacyCallAPIOptions): ReturnType<Client['searchShards']>;
|
||||
(endpoint: 'searchTemplate', params: SearchTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['searchTemplate']>;
|
||||
(endpoint: 'suggest', params: SuggestParams, options?: LegacyCallAPIOptions): ReturnType<Client['suggest']>;
|
||||
(endpoint: 'termvectors', params: TermvectorsParams, options?: LegacyCallAPIOptions): ReturnType<Client['termvectors']>;
|
||||
(endpoint: 'update', params: UpdateDocumentParams, options?: LegacyCallAPIOptions): ReturnType<Client['update']>;
|
||||
(endpoint: 'updateByQuery', params: UpdateDocumentByQueryParams, options?: LegacyCallAPIOptions): ReturnType<Client['updateByQuery']>;
|
||||
|
||||
// cat namespace
|
||||
(endpoint: 'cat.aliases', params: CatAliasesParams, options?: CallAPIOptions): ReturnType<Client['cat']['aliases']>;
|
||||
(endpoint: 'cat.allocation', params: CatAllocationParams, options?: CallAPIOptions): ReturnType<Client['cat']['allocation']>;
|
||||
(endpoint: 'cat.count', params: CatAllocationParams, options?: CallAPIOptions): ReturnType<Client['cat']['count']>;
|
||||
(endpoint: 'cat.fielddata', params: CatFielddataParams, options?: CallAPIOptions): ReturnType<Client['cat']['fielddata']>;
|
||||
(endpoint: 'cat.health', params: CatHealthParams, options?: CallAPIOptions): ReturnType<Client['cat']['health']>;
|
||||
(endpoint: 'cat.help', params: CatHelpParams, options?: CallAPIOptions): ReturnType<Client['cat']['help']>;
|
||||
(endpoint: 'cat.indices', params: CatIndicesParams, options?: CallAPIOptions): ReturnType<Client['cat']['indices']>;
|
||||
(endpoint: 'cat.master', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['master']>;
|
||||
(endpoint: 'cat.nodeattrs', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['nodeattrs']>;
|
||||
(endpoint: 'cat.nodes', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['nodes']>;
|
||||
(endpoint: 'cat.pendingTasks', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['pendingTasks']>;
|
||||
(endpoint: 'cat.plugins', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['plugins']>;
|
||||
(endpoint: 'cat.recovery', params: CatRecoveryParams, options?: CallAPIOptions): ReturnType<Client['cat']['recovery']>;
|
||||
(endpoint: 'cat.repositories', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['repositories']>;
|
||||
(endpoint: 'cat.segments', params: CatSegmentsParams, options?: CallAPIOptions): ReturnType<Client['cat']['segments']>;
|
||||
(endpoint: 'cat.shards', params: CatShardsParams, options?: CallAPIOptions): ReturnType<Client['cat']['shards']>;
|
||||
(endpoint: 'cat.snapshots', params: CatSnapshotsParams, options?: CallAPIOptions): ReturnType<Client['cat']['snapshots']>;
|
||||
(endpoint: 'cat.tasks', params: CatTasksParams, options?: CallAPIOptions): ReturnType<Client['cat']['tasks']>;
|
||||
(endpoint: 'cat.threadPool', params: CatThreadPoolParams, options?: CallAPIOptions): ReturnType<Client['cat']['threadPool']>;
|
||||
(endpoint: 'cat.aliases', params: CatAliasesParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['aliases']>;
|
||||
(endpoint: 'cat.allocation', params: CatAllocationParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['allocation']>;
|
||||
(endpoint: 'cat.count', params: CatAllocationParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['count']>;
|
||||
(endpoint: 'cat.fielddata', params: CatFielddataParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['fielddata']>;
|
||||
(endpoint: 'cat.health', params: CatHealthParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['health']>;
|
||||
(endpoint: 'cat.help', params: CatHelpParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['help']>;
|
||||
(endpoint: 'cat.indices', params: CatIndicesParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['indices']>;
|
||||
(endpoint: 'cat.master', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['master']>;
|
||||
(endpoint: 'cat.nodeattrs', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['nodeattrs']>;
|
||||
(endpoint: 'cat.nodes', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['nodes']>;
|
||||
(endpoint: 'cat.pendingTasks', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['pendingTasks']>;
|
||||
(endpoint: 'cat.plugins', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['plugins']>;
|
||||
(endpoint: 'cat.recovery', params: CatRecoveryParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['recovery']>;
|
||||
(endpoint: 'cat.repositories', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['repositories']>;
|
||||
(endpoint: 'cat.segments', params: CatSegmentsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['segments']>;
|
||||
(endpoint: 'cat.shards', params: CatShardsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['shards']>;
|
||||
(endpoint: 'cat.snapshots', params: CatSnapshotsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['snapshots']>;
|
||||
(endpoint: 'cat.tasks', params: CatTasksParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['tasks']>;
|
||||
(endpoint: 'cat.threadPool', params: CatThreadPoolParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['threadPool']>;
|
||||
|
||||
// cluster namespace
|
||||
(endpoint: 'cluster.allocationExplain', params: ClusterAllocationExplainParams, options?: CallAPIOptions): ReturnType<Client['cluster']['allocationExplain']>;
|
||||
(endpoint: 'cluster.getSettings', params: ClusterGetSettingsParams, options?: CallAPIOptions): ReturnType<Client['cluster']['getSettings']>;
|
||||
(endpoint: 'cluster.health', params: ClusterHealthParams, options?: CallAPIOptions): ReturnType<Client['cluster']['health']>;
|
||||
(endpoint: 'cluster.pendingTasks', params: ClusterPendingTasksParams, options?: CallAPIOptions): ReturnType<Client['cluster']['pendingTasks']>;
|
||||
(endpoint: 'cluster.putSettings', params: ClusterPutSettingsParams, options?: CallAPIOptions): ReturnType<Client['cluster']['putSettings']>;
|
||||
(endpoint: 'cluster.reroute', params: ClusterRerouteParams, options?: CallAPIOptions): ReturnType<Client['cluster']['reroute']>;
|
||||
(endpoint: 'cluster.state', params: ClusterStateParams, options?: CallAPIOptions): ReturnType<Client['cluster']['state']>;
|
||||
(endpoint: 'cluster.stats', params: ClusterStatsParams, options?: CallAPIOptions): ReturnType<Client['cluster']['stats']>;
|
||||
(endpoint: 'cluster.allocationExplain', params: ClusterAllocationExplainParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['allocationExplain']>;
|
||||
(endpoint: 'cluster.getSettings', params: ClusterGetSettingsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['getSettings']>;
|
||||
(endpoint: 'cluster.health', params: ClusterHealthParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['health']>;
|
||||
(endpoint: 'cluster.pendingTasks', params: ClusterPendingTasksParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['pendingTasks']>;
|
||||
(endpoint: 'cluster.putSettings', params: ClusterPutSettingsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['putSettings']>;
|
||||
(endpoint: 'cluster.reroute', params: ClusterRerouteParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['reroute']>;
|
||||
(endpoint: 'cluster.state', params: ClusterStateParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['state']>;
|
||||
(endpoint: 'cluster.stats', params: ClusterStatsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['stats']>;
|
||||
|
||||
// indices namespace
|
||||
(endpoint: 'indices.analyze', params: IndicesAnalyzeParams, options?: CallAPIOptions): ReturnType<Client['indices']['analyze']>;
|
||||
(endpoint: 'indices.clearCache', params: IndicesClearCacheParams, options?: CallAPIOptions): ReturnType<Client['indices']['clearCache']>;
|
||||
(endpoint: 'indices.close', params: IndicesCloseParams, options?: CallAPIOptions): ReturnType<Client['indices']['close']>;
|
||||
(endpoint: 'indices.create', params: IndicesCreateParams, options?: CallAPIOptions): ReturnType<Client['indices']['create']>;
|
||||
(endpoint: 'indices.delete', params: IndicesDeleteParams, options?: CallAPIOptions): ReturnType<Client['indices']['delete']>;
|
||||
(endpoint: 'indices.deleteAlias', params: IndicesDeleteAliasParams, options?: CallAPIOptions): ReturnType<Client['indices']['deleteAlias']>;
|
||||
(endpoint: 'indices.deleteTemplate', params: IndicesDeleteTemplateParams, options?: CallAPIOptions): ReturnType<Client['indices']['deleteTemplate']>;
|
||||
(endpoint: 'indices.exists', params: IndicesExistsParams, options?: CallAPIOptions): ReturnType<Client['indices']['exists']>;
|
||||
(endpoint: 'indices.existsAlias', params: IndicesExistsAliasParams, options?: CallAPIOptions): ReturnType<Client['indices']['existsAlias']>;
|
||||
(endpoint: 'indices.existsTemplate', params: IndicesExistsTemplateParams, options?: CallAPIOptions): ReturnType<Client['indices']['existsTemplate']>;
|
||||
(endpoint: 'indices.existsType', params: IndicesExistsTypeParams, options?: CallAPIOptions): ReturnType<Client['indices']['existsType']>;
|
||||
(endpoint: 'indices.flush', params: IndicesFlushParams, options?: CallAPIOptions): ReturnType<Client['indices']['flush']>;
|
||||
(endpoint: 'indices.flushSynced', params: IndicesFlushSyncedParams, options?: CallAPIOptions): ReturnType<Client['indices']['flushSynced']>;
|
||||
(endpoint: 'indices.forcemerge', params: IndicesForcemergeParams, options?: CallAPIOptions): ReturnType<Client['indices']['forcemerge']>;
|
||||
(endpoint: 'indices.get', params: IndicesGetParams, options?: CallAPIOptions): ReturnType<Client['indices']['get']>;
|
||||
(endpoint: 'indices.getAlias', params: IndicesGetAliasParams, options?: CallAPIOptions): ReturnType<Client['indices']['getAlias']>;
|
||||
(endpoint: 'indices.getFieldMapping', params: IndicesGetFieldMappingParams, options?: CallAPIOptions): ReturnType<Client['indices']['getFieldMapping']>;
|
||||
(endpoint: 'indices.getMapping', params: IndicesGetMappingParams, options?: CallAPIOptions): ReturnType<Client['indices']['getMapping']>;
|
||||
(endpoint: 'indices.getSettings', params: IndicesGetSettingsParams, options?: CallAPIOptions): ReturnType<Client['indices']['getSettings']>;
|
||||
(endpoint: 'indices.getTemplate', params: IndicesGetTemplateParams, options?: CallAPIOptions): ReturnType<Client['indices']['getTemplate']>;
|
||||
(endpoint: 'indices.getUpgrade', params: IndicesGetUpgradeParams, options?: CallAPIOptions): ReturnType<Client['indices']['getUpgrade']>;
|
||||
(endpoint: 'indices.open', params: IndicesOpenParams, options?: CallAPIOptions): ReturnType<Client['indices']['open']>;
|
||||
(endpoint: 'indices.putAlias', params: IndicesPutAliasParams, options?: CallAPIOptions): ReturnType<Client['indices']['putAlias']>;
|
||||
(endpoint: 'indices.putMapping', params: IndicesPutMappingParams, options?: CallAPIOptions): ReturnType<Client['indices']['putMapping']>;
|
||||
(endpoint: 'indices.putSettings', params: IndicesPutSettingsParams, options?: CallAPIOptions): ReturnType<Client['indices']['putSettings']>;
|
||||
(endpoint: 'indices.putTemplate', params: IndicesPutTemplateParams, options?: CallAPIOptions): ReturnType<Client['indices']['putTemplate']>;
|
||||
(endpoint: 'indices.recovery', params: IndicesRecoveryParams, options?: CallAPIOptions): ReturnType<Client['indices']['recovery']>;
|
||||
(endpoint: 'indices.refresh', params: IndicesRefreshParams, options?: CallAPIOptions): ReturnType<Client['indices']['refresh']>;
|
||||
(endpoint: 'indices.rollover', params: IndicesRolloverParams, options?: CallAPIOptions): ReturnType<Client['indices']['rollover']>;
|
||||
(endpoint: 'indices.segments', params: IndicesSegmentsParams, options?: CallAPIOptions): ReturnType<Client['indices']['segments']>;
|
||||
(endpoint: 'indices.shardStores', params: IndicesShardStoresParams, options?: CallAPIOptions): ReturnType<Client['indices']['shardStores']>;
|
||||
(endpoint: 'indices.shrink', params: IndicesShrinkParams, options?: CallAPIOptions): ReturnType<Client['indices']['shrink']>;
|
||||
(endpoint: 'indices.stats', params: IndicesStatsParams, options?: CallAPIOptions): ReturnType<Client['indices']['stats']>;
|
||||
(endpoint: 'indices.updateAliases', params: IndicesUpdateAliasesParams, options?: CallAPIOptions): ReturnType<Client['indices']['updateAliases']>;
|
||||
(endpoint: 'indices.upgrade', params: IndicesUpgradeParams, options?: CallAPIOptions): ReturnType<Client['indices']['upgrade']>;
|
||||
(endpoint: 'indices.validateQuery', params: IndicesValidateQueryParams, options?: CallAPIOptions): ReturnType<Client['indices']['validateQuery']>;
|
||||
(endpoint: 'indices.analyze', params: IndicesAnalyzeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['analyze']>;
|
||||
(endpoint: 'indices.clearCache', params: IndicesClearCacheParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['clearCache']>;
|
||||
(endpoint: 'indices.close', params: IndicesCloseParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['close']>;
|
||||
(endpoint: 'indices.create', params: IndicesCreateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['create']>;
|
||||
(endpoint: 'indices.delete', params: IndicesDeleteParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['delete']>;
|
||||
(endpoint: 'indices.deleteAlias', params: IndicesDeleteAliasParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['deleteAlias']>;
|
||||
(endpoint: 'indices.deleteTemplate', params: IndicesDeleteTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['deleteTemplate']>;
|
||||
(endpoint: 'indices.exists', params: IndicesExistsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['exists']>;
|
||||
(endpoint: 'indices.existsAlias', params: IndicesExistsAliasParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['existsAlias']>;
|
||||
(endpoint: 'indices.existsTemplate', params: IndicesExistsTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['existsTemplate']>;
|
||||
(endpoint: 'indices.existsType', params: IndicesExistsTypeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['existsType']>;
|
||||
(endpoint: 'indices.flush', params: IndicesFlushParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['flush']>;
|
||||
(endpoint: 'indices.flushSynced', params: IndicesFlushSyncedParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['flushSynced']>;
|
||||
(endpoint: 'indices.forcemerge', params: IndicesForcemergeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['forcemerge']>;
|
||||
(endpoint: 'indices.get', params: IndicesGetParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['get']>;
|
||||
(endpoint: 'indices.getAlias', params: IndicesGetAliasParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getAlias']>;
|
||||
(endpoint: 'indices.getFieldMapping', params: IndicesGetFieldMappingParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getFieldMapping']>;
|
||||
(endpoint: 'indices.getMapping', params: IndicesGetMappingParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getMapping']>;
|
||||
(endpoint: 'indices.getSettings', params: IndicesGetSettingsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getSettings']>;
|
||||
(endpoint: 'indices.getTemplate', params: IndicesGetTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getTemplate']>;
|
||||
(endpoint: 'indices.getUpgrade', params: IndicesGetUpgradeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getUpgrade']>;
|
||||
(endpoint: 'indices.open', params: IndicesOpenParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['open']>;
|
||||
(endpoint: 'indices.putAlias', params: IndicesPutAliasParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['putAlias']>;
|
||||
(endpoint: 'indices.putMapping', params: IndicesPutMappingParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['putMapping']>;
|
||||
(endpoint: 'indices.putSettings', params: IndicesPutSettingsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['putSettings']>;
|
||||
(endpoint: 'indices.putTemplate', params: IndicesPutTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['putTemplate']>;
|
||||
(endpoint: 'indices.recovery', params: IndicesRecoveryParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['recovery']>;
|
||||
(endpoint: 'indices.refresh', params: IndicesRefreshParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['refresh']>;
|
||||
(endpoint: 'indices.rollover', params: IndicesRolloverParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['rollover']>;
|
||||
(endpoint: 'indices.segments', params: IndicesSegmentsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['segments']>;
|
||||
(endpoint: 'indices.shardStores', params: IndicesShardStoresParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['shardStores']>;
|
||||
(endpoint: 'indices.shrink', params: IndicesShrinkParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['shrink']>;
|
||||
(endpoint: 'indices.stats', params: IndicesStatsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['stats']>;
|
||||
(endpoint: 'indices.updateAliases', params: IndicesUpdateAliasesParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['updateAliases']>;
|
||||
(endpoint: 'indices.upgrade', params: IndicesUpgradeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['upgrade']>;
|
||||
(endpoint: 'indices.validateQuery', params: IndicesValidateQueryParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['validateQuery']>;
|
||||
|
||||
// ingest namepsace
|
||||
(endpoint: 'ingest.deletePipeline', params: IngestDeletePipelineParams, options?: CallAPIOptions): ReturnType<Client['ingest']['deletePipeline']>;
|
||||
(endpoint: 'ingest.getPipeline', params: IngestGetPipelineParams, options?: CallAPIOptions): ReturnType<Client['ingest']['getPipeline']>;
|
||||
(endpoint: 'ingest.putPipeline', params: IngestPutPipelineParams, options?: CallAPIOptions): ReturnType<Client['ingest']['putPipeline']>;
|
||||
(endpoint: 'ingest.simulate', params: IngestSimulateParams, options?: CallAPIOptions): ReturnType<Client['ingest']['simulate']>;
|
||||
(endpoint: 'ingest.deletePipeline', params: IngestDeletePipelineParams, options?: LegacyCallAPIOptions): ReturnType<Client['ingest']['deletePipeline']>;
|
||||
(endpoint: 'ingest.getPipeline', params: IngestGetPipelineParams, options?: LegacyCallAPIOptions): ReturnType<Client['ingest']['getPipeline']>;
|
||||
(endpoint: 'ingest.putPipeline', params: IngestPutPipelineParams, options?: LegacyCallAPIOptions): ReturnType<Client['ingest']['putPipeline']>;
|
||||
(endpoint: 'ingest.simulate', params: IngestSimulateParams, options?: LegacyCallAPIOptions): ReturnType<Client['ingest']['simulate']>;
|
||||
|
||||
// nodes namespace
|
||||
(endpoint: 'nodes.hotThreads', params: NodesHotThreadsParams, options?: CallAPIOptions): ReturnType<Client['nodes']['hotThreads']>;
|
||||
(endpoint: 'nodes.info', params: NodesInfoParams, options?: CallAPIOptions): ReturnType<Client['nodes']['info']>;
|
||||
(endpoint: 'nodes.stats', params: NodesStatsParams, options?: CallAPIOptions): ReturnType<Client['nodes']['stats']>;
|
||||
(endpoint: 'nodes.hotThreads', params: NodesHotThreadsParams, options?: LegacyCallAPIOptions): ReturnType<Client['nodes']['hotThreads']>;
|
||||
(endpoint: 'nodes.info', params: NodesInfoParams, options?: LegacyCallAPIOptions): ReturnType<Client['nodes']['info']>;
|
||||
(endpoint: 'nodes.stats', params: NodesStatsParams, options?: LegacyCallAPIOptions): ReturnType<Client['nodes']['stats']>;
|
||||
|
||||
// snapshot namespace
|
||||
(endpoint: 'snapshot.create', params: SnapshotCreateParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['create']>;
|
||||
(endpoint: 'snapshot.createRepository', params: SnapshotCreateRepositoryParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['createRepository']>;
|
||||
(endpoint: 'snapshot.delete', params: SnapshotDeleteParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['delete']>;
|
||||
(endpoint: 'snapshot.deleteRepository', params: SnapshotDeleteRepositoryParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['deleteRepository']>;
|
||||
(endpoint: 'snapshot.get', params: SnapshotGetParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['get']>;
|
||||
(endpoint: 'snapshot.getRepository', params: SnapshotGetRepositoryParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['getRepository']>;
|
||||
(endpoint: 'snapshot.restore', params: SnapshotRestoreParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['restore']>;
|
||||
(endpoint: 'snapshot.status', params: SnapshotStatusParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['status']>;
|
||||
(endpoint: 'snapshot.verifyRepository', params: SnapshotVerifyRepositoryParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['verifyRepository']>;
|
||||
(endpoint: 'snapshot.create', params: SnapshotCreateParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['create']>;
|
||||
(endpoint: 'snapshot.createRepository', params: SnapshotCreateRepositoryParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['createRepository']>;
|
||||
(endpoint: 'snapshot.delete', params: SnapshotDeleteParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['delete']>;
|
||||
(endpoint: 'snapshot.deleteRepository', params: SnapshotDeleteRepositoryParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['deleteRepository']>;
|
||||
(endpoint: 'snapshot.get', params: SnapshotGetParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['get']>;
|
||||
(endpoint: 'snapshot.getRepository', params: SnapshotGetRepositoryParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['getRepository']>;
|
||||
(endpoint: 'snapshot.restore', params: SnapshotRestoreParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['restore']>;
|
||||
(endpoint: 'snapshot.status', params: SnapshotStatusParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['status']>;
|
||||
(endpoint: 'snapshot.verifyRepository', params: SnapshotVerifyRepositoryParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['verifyRepository']>;
|
||||
|
||||
// tasks namespace
|
||||
(endpoint: 'tasks.cancel', params: TasksCancelParams, options?: CallAPIOptions): ReturnType<Client['tasks']['cancel']>;
|
||||
(endpoint: 'tasks.get', params: TasksGetParams, options?: CallAPIOptions): ReturnType<Client['tasks']['get']>;
|
||||
(endpoint: 'tasks.list', params: TasksListParams, options?: CallAPIOptions): ReturnType<Client['tasks']['list']>;
|
||||
(endpoint: 'tasks.cancel', params: TasksCancelParams, options?: LegacyCallAPIOptions): ReturnType<Client['tasks']['cancel']>;
|
||||
(endpoint: 'tasks.get', params: TasksGetParams, options?: LegacyCallAPIOptions): ReturnType<Client['tasks']['get']>;
|
||||
(endpoint: 'tasks.list', params: TasksListParams, options?: LegacyCallAPIOptions): ReturnType<Client['tasks']['list']>;
|
||||
|
||||
// other APIs accessed via transport.request
|
||||
(endpoint: 'transport.request', clientParams: AssistantAPIClientParams, options?: CallAPIOptions): Promise<
|
||||
(endpoint: 'transport.request', clientParams: AssistantAPIClientParams, options?: LegacyCallAPIOptions): Promise<
|
||||
AssistanceAPIResponse
|
||||
>;
|
||||
(endpoint: 'transport.request', clientParams: DeprecationAPIClientParams, options?: CallAPIOptions): Promise<
|
||||
(endpoint: 'transport.request', clientParams: DeprecationAPIClientParams, options?: LegacyCallAPIOptions): Promise<
|
||||
DeprecationAPIResponse
|
||||
>;
|
||||
|
||||
// Catch-all definition
|
||||
<T = any>(endpoint: string, clientParams?: Record<string, any>, options?: CallAPIOptions): Promise<T>;
|
||||
<T = any>(endpoint: string, clientParams?: Record<string, any>, options?: LegacyCallAPIOptions): Promise<T>;
|
||||
/* eslint-enable */
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ jest.mock('elasticsearch', () => {
|
|||
|
||||
export const MockScopedClusterClient = jest.fn();
|
||||
jest.mock('./scoped_cluster_client', () => ({
|
||||
ScopedClusterClient: MockScopedClusterClient,
|
||||
LegacyScopedClusterClient: MockScopedClusterClient,
|
||||
}));
|
||||
|
||||
export const mockParseElasticsearchClientConfig = jest.fn();
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { ElasticsearchConfig } from './elasticsearch_config';
|
||||
import { ElasticsearchConfig } from '../elasticsearch_config';
|
||||
|
||||
import {
|
||||
MockClient,
|
||||
|
@ -27,10 +27,10 @@ import {
|
|||
|
||||
import { errors } from 'elasticsearch';
|
||||
import { get } from 'lodash';
|
||||
import { Logger } from '../logging';
|
||||
import { loggingSystemMock } from '../logging/logging_system.mock';
|
||||
import { httpServerMock } from '../http/http_server.mocks';
|
||||
import { ClusterClient } from './cluster_client';
|
||||
import { Logger } from '../../logging';
|
||||
import { loggingSystemMock } from '../../logging/logging_system.mock';
|
||||
import { httpServerMock } from '../../http/http_server.mocks';
|
||||
import { LegacyClusterClient } from './cluster_client';
|
||||
|
||||
const logger = loggingSystemMock.create();
|
||||
afterEach(() => jest.clearAllMocks());
|
||||
|
@ -42,7 +42,7 @@ test('#constructor creates client with parsed config', () => {
|
|||
const mockEsConfig = { apiVersion: 'es-version' } as any;
|
||||
const mockLogger = logger.get();
|
||||
|
||||
const clusterClient = new ClusterClient(mockEsConfig, mockLogger);
|
||||
const clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger);
|
||||
expect(clusterClient).toBeDefined();
|
||||
|
||||
expect(mockParseElasticsearchClientConfig).toHaveBeenCalledTimes(1);
|
||||
|
@ -58,7 +58,7 @@ describe('#callAsInternalUser', () => {
|
|||
ping: jest.Mock;
|
||||
security: { authenticate: jest.Mock };
|
||||
};
|
||||
let clusterClient: ClusterClient;
|
||||
let clusterClient: LegacyClusterClient;
|
||||
|
||||
beforeEach(() => {
|
||||
mockEsClientInstance = {
|
||||
|
@ -68,7 +68,7 @@ describe('#callAsInternalUser', () => {
|
|||
};
|
||||
MockClient.mockImplementation(() => mockEsClientInstance);
|
||||
|
||||
clusterClient = new ClusterClient({ apiVersion: 'es-version' } as any, logger.get());
|
||||
clusterClient = new LegacyClusterClient({ apiVersion: 'es-version' } as any, logger.get());
|
||||
});
|
||||
|
||||
test('fails if cluster client is closed', async () => {
|
||||
|
@ -220,7 +220,7 @@ describe('#asScoped', () => {
|
|||
let mockEsClientInstance: { ping: jest.Mock; close: jest.Mock };
|
||||
let mockScopedEsClientInstance: { ping: jest.Mock; close: jest.Mock };
|
||||
|
||||
let clusterClient: ClusterClient;
|
||||
let clusterClient: LegacyClusterClient;
|
||||
let mockLogger: Logger;
|
||||
let mockEsConfig: ElasticsearchConfig;
|
||||
|
||||
|
@ -237,7 +237,7 @@ describe('#asScoped', () => {
|
|||
requestHeadersWhitelist: ['one', 'two'],
|
||||
} as any;
|
||||
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger);
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
|
@ -272,7 +272,7 @@ describe('#asScoped', () => {
|
|||
|
||||
test('properly configures `ignoreCertAndKey` for various configurations', () => {
|
||||
// Config without SSL.
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger);
|
||||
|
||||
mockParseElasticsearchClientConfig.mockClear();
|
||||
clusterClient.asScoped(httpServerMock.createRawRequest({ headers: { one: '1' } }));
|
||||
|
@ -285,7 +285,7 @@ describe('#asScoped', () => {
|
|||
|
||||
// Config ssl.alwaysPresentCertificate === false
|
||||
mockEsConfig = { ...mockEsConfig, ssl: { alwaysPresentCertificate: false } } as any;
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger);
|
||||
|
||||
mockParseElasticsearchClientConfig.mockClear();
|
||||
clusterClient.asScoped(httpServerMock.createRawRequest({ headers: { one: '1' } }));
|
||||
|
@ -298,7 +298,7 @@ describe('#asScoped', () => {
|
|||
|
||||
// Config ssl.alwaysPresentCertificate === true
|
||||
mockEsConfig = { ...mockEsConfig, ssl: { alwaysPresentCertificate: true } } as any;
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger);
|
||||
|
||||
mockParseElasticsearchClientConfig.mockClear();
|
||||
clusterClient.asScoped(httpServerMock.createRawRequest({ headers: { one: '1' } }));
|
||||
|
@ -341,7 +341,7 @@ describe('#asScoped', () => {
|
|||
});
|
||||
|
||||
test('does not fail when scope to not defined request', async () => {
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient.asScoped();
|
||||
expect(MockScopedClusterClient).toHaveBeenCalledTimes(1);
|
||||
expect(MockScopedClusterClient).toHaveBeenCalledWith(
|
||||
|
@ -352,7 +352,7 @@ describe('#asScoped', () => {
|
|||
});
|
||||
|
||||
test('does not fail when scope to a request without headers', async () => {
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient.asScoped({} as any);
|
||||
expect(MockScopedClusterClient).toHaveBeenCalledTimes(1);
|
||||
expect(MockScopedClusterClient).toHaveBeenCalledWith(
|
||||
|
@ -363,7 +363,10 @@ describe('#asScoped', () => {
|
|||
});
|
||||
|
||||
test('calls getAuthHeaders and filters results for a real request', async () => {
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger, () => ({ one: '1', three: '3' }));
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger, () => ({
|
||||
one: '1',
|
||||
three: '3',
|
||||
}));
|
||||
clusterClient.asScoped(httpServerMock.createRawRequest({ headers: { two: '2' } }));
|
||||
expect(MockScopedClusterClient).toHaveBeenCalledTimes(1);
|
||||
expect(MockScopedClusterClient).toHaveBeenCalledWith(
|
||||
|
@ -374,7 +377,7 @@ describe('#asScoped', () => {
|
|||
});
|
||||
|
||||
test('getAuthHeaders results rewrite extends a request headers', async () => {
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger, () => ({ one: 'foo' }));
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger, () => ({ one: 'foo' }));
|
||||
clusterClient.asScoped(httpServerMock.createRawRequest({ headers: { one: '1', two: '2' } }));
|
||||
expect(MockScopedClusterClient).toHaveBeenCalledTimes(1);
|
||||
expect(MockScopedClusterClient).toHaveBeenCalledWith(
|
||||
|
@ -386,14 +389,14 @@ describe('#asScoped', () => {
|
|||
|
||||
test("doesn't call getAuthHeaders for a fake request", async () => {
|
||||
const getAuthHeaders = jest.fn();
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger, getAuthHeaders);
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger, getAuthHeaders);
|
||||
clusterClient.asScoped({ headers: { one: '1', two: '2', three: '3' } });
|
||||
|
||||
expect(getAuthHeaders).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('filters a fake request headers', async () => {
|
||||
clusterClient = new ClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient = new LegacyClusterClient(mockEsConfig, mockLogger);
|
||||
clusterClient.asScoped({ headers: { one: '1', two: '2', three: '3' } });
|
||||
|
||||
expect(MockScopedClusterClient).toHaveBeenCalledTimes(1);
|
||||
|
@ -409,7 +412,7 @@ describe('#close', () => {
|
|||
let mockEsClientInstance: { close: jest.Mock };
|
||||
let mockScopedEsClientInstance: { close: jest.Mock };
|
||||
|
||||
let clusterClient: ClusterClient;
|
||||
let clusterClient: LegacyClusterClient;
|
||||
|
||||
beforeEach(() => {
|
||||
mockEsClientInstance = { close: jest.fn() };
|
||||
|
@ -418,7 +421,7 @@ describe('#close', () => {
|
|||
() => mockScopedEsClientInstance
|
||||
);
|
||||
|
||||
clusterClient = new ClusterClient(
|
||||
clusterClient = new LegacyClusterClient(
|
||||
{ apiVersion: 'es-version', requestHeadersWhitelist: [] } as any,
|
||||
logger.get()
|
||||
);
|
|
@ -19,16 +19,17 @@
|
|||
import { Client } from 'elasticsearch';
|
||||
import { get } from 'lodash';
|
||||
|
||||
import { ElasticsearchErrorHelpers } from './errors';
|
||||
import { GetAuthHeaders, isRealRequest, LegacyRequest } from '../http';
|
||||
import { filterHeaders, Headers, KibanaRequest, ensureRawRequest } from '../http/router';
|
||||
import { Logger } from '../logging';
|
||||
import { LegacyElasticsearchErrorHelpers } from './errors';
|
||||
import { GetAuthHeaders, isRealRequest } from '../../http';
|
||||
import { filterHeaders, ensureRawRequest } from '../../http/router';
|
||||
import { Logger } from '../../logging';
|
||||
import { ScopeableRequest } from '../types';
|
||||
import {
|
||||
ElasticsearchClientConfig,
|
||||
LegacyElasticsearchClientConfig,
|
||||
parseElasticsearchClientConfig,
|
||||
} from './elasticsearch_client_config';
|
||||
import { ScopedClusterClient, IScopedClusterClient } from './scoped_cluster_client';
|
||||
import { CallAPIOptions, APICaller } from './api_types';
|
||||
import { LegacyScopedClusterClient, ILegacyScopedClusterClient } from './scoped_cluster_client';
|
||||
import { LegacyCallAPIOptions, LegacyAPICaller } from './api_types';
|
||||
|
||||
/**
|
||||
* Support Legacy platform request for the period of migration.
|
||||
|
@ -50,7 +51,7 @@ const callAPI = async (
|
|||
client: Client,
|
||||
endpoint: string,
|
||||
clientParams: Record<string, any> = {},
|
||||
options: CallAPIOptions = { wrap401Errors: true }
|
||||
options: LegacyCallAPIOptions = { wrap401Errors: true }
|
||||
) => {
|
||||
const clientPath = endpoint.split('.');
|
||||
const api: any = get(client, clientPath);
|
||||
|
@ -75,55 +76,40 @@ const callAPI = async (
|
|||
throw err;
|
||||
}
|
||||
|
||||
throw ElasticsearchErrorHelpers.decorateNotAuthorizedError(err);
|
||||
throw LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError(err);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fake request object created manually by Kibana plugins.
|
||||
* @public
|
||||
*/
|
||||
export interface FakeRequest {
|
||||
/** Headers used for authentication against Elasticsearch */
|
||||
headers: Headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an Elasticsearch cluster API client created by the platform.
|
||||
* It allows to call API on behalf of the internal Kibana user and
|
||||
* the actual user that is derived from the request headers (via `asScoped(...)`).
|
||||
*
|
||||
* See {@link ClusterClient}.
|
||||
* See {@link LegacyClusterClient}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type IClusterClient = Pick<ClusterClient, 'callAsInternalUser' | 'asScoped'>;
|
||||
export type ILegacyClusterClient = Pick<LegacyClusterClient, 'callAsInternalUser' | 'asScoped'>;
|
||||
|
||||
/**
|
||||
* Represents an Elasticsearch cluster API client created by a plugin.
|
||||
* It allows to call API on behalf of the internal Kibana user and
|
||||
* the actual user that is derived from the request headers (via `asScoped(...)`).
|
||||
*
|
||||
* See {@link ClusterClient}.
|
||||
* See {@link LegacyClusterClient}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type ICustomClusterClient = Pick<ClusterClient, 'callAsInternalUser' | 'close' | 'asScoped'>;
|
||||
|
||||
/**
|
||||
A user credentials container.
|
||||
* It accommodates the necessary auth credentials to impersonate the current user.
|
||||
*
|
||||
* @public
|
||||
* See {@link KibanaRequest}.
|
||||
*/
|
||||
export type ScopeableRequest = KibanaRequest | LegacyRequest | FakeRequest;
|
||||
export type ILegacyCustomClusterClient = Pick<
|
||||
LegacyClusterClient,
|
||||
'callAsInternalUser' | 'close' | 'asScoped'
|
||||
>;
|
||||
|
||||
/**
|
||||
* {@inheritDoc IClusterClient}
|
||||
* @public
|
||||
*/
|
||||
export class ClusterClient implements IClusterClient {
|
||||
export class LegacyClusterClient implements ILegacyClusterClient {
|
||||
/**
|
||||
* Raw Elasticsearch JS client that acts on behalf of the Kibana internal user.
|
||||
*/
|
||||
|
@ -141,7 +127,7 @@ export class ClusterClient implements IClusterClient {
|
|||
private isClosed = false;
|
||||
|
||||
constructor(
|
||||
private readonly config: ElasticsearchClientConfig,
|
||||
private readonly config: LegacyElasticsearchClientConfig,
|
||||
private readonly log: Logger,
|
||||
private readonly getAuthHeaders: GetAuthHeaders = noop
|
||||
) {
|
||||
|
@ -151,20 +137,24 @@ export class ClusterClient implements IClusterClient {
|
|||
/**
|
||||
* Calls specified endpoint with provided clientParams on behalf of the
|
||||
* Kibana internal user.
|
||||
* See {@link APICaller}.
|
||||
* See {@link LegacyAPICaller}.
|
||||
*
|
||||
* @param endpoint - String descriptor of the endpoint e.g. `cluster.getSettings` or `ping`.
|
||||
* @param clientParams - A dictionary of parameters that will be passed directly to the Elasticsearch JS client.
|
||||
* @param options - Options that affect the way we call the API and process the result.
|
||||
*/
|
||||
public callAsInternalUser: APICaller = async (
|
||||
public callAsInternalUser: LegacyAPICaller = async (
|
||||
endpoint: string,
|
||||
clientParams: Record<string, any> = {},
|
||||
options?: CallAPIOptions
|
||||
options?: LegacyCallAPIOptions
|
||||
) => {
|
||||
this.assertIsNotClosed();
|
||||
|
||||
return await (callAPI.bind(null, this.client) as APICaller)(endpoint, clientParams, options);
|
||||
return await (callAPI.bind(null, this.client) as LegacyAPICaller)(
|
||||
endpoint,
|
||||
clientParams,
|
||||
options
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -185,7 +175,7 @@ export class ClusterClient implements IClusterClient {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of {@link IScopedClusterClient} based on the configuration the
|
||||
* Creates an instance of {@link ILegacyScopedClusterClient} based on the configuration the
|
||||
* current cluster client that exposes additional `callAsCurrentUser` method
|
||||
* scoped to the provided req. Consumers shouldn't worry about closing
|
||||
* scoped client instances, these will be automatically closed as soon as the
|
||||
|
@ -194,7 +184,7 @@ export class ClusterClient implements IClusterClient {
|
|||
* @param request - Request the `IScopedClusterClient` instance will be scoped to.
|
||||
* Supports request optionality, Legacy.Request & FakeRequest for BWC with LegacyPlatform
|
||||
*/
|
||||
public asScoped(request?: ScopeableRequest): IScopedClusterClient {
|
||||
public asScoped(request?: ScopeableRequest): ILegacyScopedClusterClient {
|
||||
// It'd have been quite expensive to create and configure client for every incoming
|
||||
// request since it involves parsing of the config, reading of the SSL certificate and
|
||||
// key files etc. Moreover scoped client needs two Elasticsearch JS clients at the same
|
||||
|
@ -210,7 +200,7 @@ export class ClusterClient implements IClusterClient {
|
|||
);
|
||||
}
|
||||
|
||||
return new ScopedClusterClient(
|
||||
return new LegacyScopedClusterClient(
|
||||
this.callAsInternalUser,
|
||||
this.callAsCurrentUser,
|
||||
filterHeaders(this.getHeaders(request), this.config.requestHeadersWhitelist)
|
||||
|
@ -220,20 +210,20 @@ export class ClusterClient implements IClusterClient {
|
|||
/**
|
||||
* Calls specified endpoint with provided clientParams on behalf of the
|
||||
* user initiated request to the Kibana server (via HTTP request headers).
|
||||
* See {@link APICaller}.
|
||||
* See {@link LegacyAPICaller}.
|
||||
*
|
||||
* @param endpoint - String descriptor of the endpoint e.g. `cluster.getSettings` or `ping`.
|
||||
* @param clientParams - A dictionary of parameters that will be passed directly to the Elasticsearch JS client.
|
||||
* @param options - Options that affect the way we call the API and process the result.
|
||||
*/
|
||||
private callAsCurrentUser: APICaller = async (
|
||||
private callAsCurrentUser: LegacyAPICaller = async (
|
||||
endpoint: string,
|
||||
clientParams: Record<string, any> = {},
|
||||
options?: CallAPIOptions
|
||||
options?: LegacyCallAPIOptions
|
||||
) => {
|
||||
this.assertIsNotClosed();
|
||||
|
||||
return await (callAPI.bind(null, this.scopedClient!) as APICaller)(
|
||||
return await (callAPI.bind(null, this.scopedClient!) as LegacyAPICaller)(
|
||||
endpoint,
|
||||
clientParams,
|
||||
options
|
||||
|
@ -246,9 +236,7 @@ export class ClusterClient implements IClusterClient {
|
|||
}
|
||||
}
|
||||
|
||||
private getHeaders(
|
||||
request?: KibanaRequest | LegacyRequest | FakeRequest
|
||||
): Record<string, string | string[] | undefined> {
|
||||
private getHeaders(request?: ScopeableRequest): Record<string, string | string[] | undefined> {
|
||||
if (!isRealRequest(request)) {
|
||||
return request && request.headers ? request.headers : {};
|
||||
}
|
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
|
||||
import { duration } from 'moment';
|
||||
import { loggingSystemMock } from '../logging/logging_system.mock';
|
||||
import { loggingSystemMock } from '../../logging/logging_system.mock';
|
||||
import {
|
||||
ElasticsearchClientConfig,
|
||||
LegacyElasticsearchClientConfig,
|
||||
parseElasticsearchClientConfig,
|
||||
} from './elasticsearch_client_config';
|
||||
const logger = loggingSystemMock.create();
|
||||
|
@ -64,7 +64,7 @@ Object {
|
|||
});
|
||||
|
||||
test('parses fully specified config', () => {
|
||||
const elasticsearchConfig: ElasticsearchClientConfig = {
|
||||
const elasticsearchConfig: LegacyElasticsearchClientConfig = {
|
||||
apiVersion: 'v7.0.0',
|
||||
customHeaders: { xsrf: 'something' },
|
||||
logQueries: true,
|
|
@ -22,9 +22,9 @@ import { cloneDeep } from 'lodash';
|
|||
import { Duration } from 'moment';
|
||||
import { checkServerIdentity } from 'tls';
|
||||
import url from 'url';
|
||||
import { pick } from '../../utils';
|
||||
import { Logger } from '../logging';
|
||||
import { ElasticsearchConfig } from './elasticsearch_config';
|
||||
import { pick } from '../../../utils';
|
||||
import { Logger } from '../../logging';
|
||||
import { ElasticsearchConfig } from '../elasticsearch_config';
|
||||
|
||||
/**
|
||||
* @privateRemarks Config that consumers can pass to the Elasticsearch JS client is complex and includes
|
||||
|
@ -33,7 +33,7 @@ import { ElasticsearchConfig } from './elasticsearch_config';
|
|||
*
|
||||
* @public
|
||||
*/
|
||||
export type ElasticsearchClientConfig = Pick<ConfigOptions, 'keepAlive' | 'log' | 'plugins'> &
|
||||
export type LegacyElasticsearchClientConfig = Pick<ConfigOptions, 'keepAlive' | 'log' | 'plugins'> &
|
||||
Pick<
|
||||
ElasticsearchConfig,
|
||||
| 'apiVersion'
|
||||
|
@ -53,7 +53,7 @@ export type ElasticsearchClientConfig = Pick<ConfigOptions, 'keepAlive' | 'log'
|
|||
};
|
||||
|
||||
/** @internal */
|
||||
interface ElasticsearchClientConfigOverrides {
|
||||
interface LegacyElasticsearchClientConfigOverrides {
|
||||
/**
|
||||
* If set to `true`, username and password from the config won't be used
|
||||
* to access Elasticsearch API even if these are specified.
|
||||
|
@ -83,9 +83,9 @@ type ExtendedConfigOptions = ConfigOptions &
|
|||
|
||||
/** @internal */
|
||||
export function parseElasticsearchClientConfig(
|
||||
config: ElasticsearchClientConfig,
|
||||
config: LegacyElasticsearchClientConfig,
|
||||
log: Logger,
|
||||
{ ignoreCertAndKey = false, auth = true }: ElasticsearchClientConfigOverrides = {}
|
||||
{ ignoreCertAndKey = false, auth = true }: LegacyElasticsearchClientConfigOverrides = {}
|
||||
) {
|
||||
const esClientConfig: ExtendedConfigOptions = {
|
||||
keepAlive: true,
|
|
@ -19,49 +19,53 @@
|
|||
|
||||
import Boom from 'boom';
|
||||
|
||||
import { ElasticsearchErrorHelpers } from './errors';
|
||||
import { LegacyElasticsearchErrorHelpers } from './errors';
|
||||
|
||||
describe('ElasticsearchErrorHelpers', () => {
|
||||
describe('NotAuthorized error', () => {
|
||||
describe('decorateNotAuthorizedError', () => {
|
||||
it('returns original object', () => {
|
||||
const error = new Error();
|
||||
expect(ElasticsearchErrorHelpers.decorateNotAuthorizedError(error)).toBe(error);
|
||||
expect(LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError(error)).toBe(error);
|
||||
});
|
||||
|
||||
it('makes the error identifiable as a NotAuthorized error', () => {
|
||||
const error = new Error();
|
||||
expect(ElasticsearchErrorHelpers.isNotAuthorizedError(error)).toBe(false);
|
||||
ElasticsearchErrorHelpers.decorateNotAuthorizedError(error);
|
||||
expect(ElasticsearchErrorHelpers.isNotAuthorizedError(error)).toBe(true);
|
||||
expect(LegacyElasticsearchErrorHelpers.isNotAuthorizedError(error)).toBe(false);
|
||||
LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError(error);
|
||||
expect(LegacyElasticsearchErrorHelpers.isNotAuthorizedError(error)).toBe(true);
|
||||
});
|
||||
|
||||
it('adds boom properties', () => {
|
||||
const error = ElasticsearchErrorHelpers.decorateNotAuthorizedError(new Error());
|
||||
const error = LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError(new Error());
|
||||
expect(typeof error.output).toBe('object');
|
||||
expect(error.output.statusCode).toBe(401);
|
||||
});
|
||||
|
||||
it('preserves boom properties of input', () => {
|
||||
const error = Boom.notFound();
|
||||
ElasticsearchErrorHelpers.decorateNotAuthorizedError(error);
|
||||
LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError(error);
|
||||
expect(error.output.statusCode).toBe(404);
|
||||
});
|
||||
|
||||
describe('error.output', () => {
|
||||
it('defaults to message of error', () => {
|
||||
const error = ElasticsearchErrorHelpers.decorateNotAuthorizedError(new Error('foobar'));
|
||||
const error = LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError(
|
||||
new Error('foobar')
|
||||
);
|
||||
expect(error.output.payload).toHaveProperty('message', 'foobar');
|
||||
});
|
||||
it('prefixes message with passed reason', () => {
|
||||
const error = ElasticsearchErrorHelpers.decorateNotAuthorizedError(
|
||||
const error = LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError(
|
||||
new Error('foobar'),
|
||||
'biz'
|
||||
);
|
||||
expect(error.output.payload).toHaveProperty('message', 'biz: foobar');
|
||||
});
|
||||
it('sets statusCode to 401', () => {
|
||||
const error = ElasticsearchErrorHelpers.decorateNotAuthorizedError(new Error('foo'));
|
||||
const error = LegacyElasticsearchErrorHelpers.decorateNotAuthorizedError(
|
||||
new Error('foo')
|
||||
);
|
||||
expect(error.output).toHaveProperty('statusCode', 401);
|
||||
});
|
||||
});
|
|
@ -27,11 +27,11 @@ enum ErrorCode {
|
|||
}
|
||||
|
||||
/** @public */
|
||||
export interface ElasticsearchError extends Boom {
|
||||
export interface LegacyElasticsearchError extends Boom {
|
||||
[code]?: string;
|
||||
}
|
||||
|
||||
function isElasticsearchError(error: any): error is ElasticsearchError {
|
||||
function isElasticsearchError(error: any): error is LegacyElasticsearchError {
|
||||
return Boolean(error && error[code]);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ function decorate(
|
|||
errorCode: ErrorCode,
|
||||
statusCode: number,
|
||||
message?: string
|
||||
): ElasticsearchError {
|
||||
): LegacyElasticsearchError {
|
||||
if (isElasticsearchError(error)) {
|
||||
return error;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ function decorate(
|
|||
message,
|
||||
// keep status and messages if Boom error object already has them
|
||||
override: false,
|
||||
}) as ElasticsearchError;
|
||||
}) as LegacyElasticsearchError;
|
||||
|
||||
boom[code] = errorCode;
|
||||
|
||||
|
@ -74,8 +74,8 @@ function decorate(
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
export class ElasticsearchErrorHelpers {
|
||||
public static isNotAuthorizedError(error: any): error is ElasticsearchError {
|
||||
export class LegacyElasticsearchErrorHelpers {
|
||||
public static isNotAuthorizedError(error: any): error is LegacyElasticsearchError {
|
||||
return isElasticsearchError(error) && error[code] === ErrorCode.NOT_AUTHORIZED;
|
||||
}
|
||||
|
28
src/core/server/elasticsearch/legacy/index.ts
Normal file
28
src/core/server/elasticsearch/legacy/index.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
export {
|
||||
LegacyClusterClient,
|
||||
ILegacyClusterClient,
|
||||
ILegacyCustomClusterClient,
|
||||
} from './cluster_client';
|
||||
export { ILegacyScopedClusterClient, LegacyScopedClusterClient } from './scoped_cluster_client';
|
||||
export { LegacyElasticsearchClientConfig } from './elasticsearch_client_config';
|
||||
export { retryCallCluster, migrationsRetryCallCluster } from './retry_call_cluster';
|
||||
export { LegacyElasticsearchError, LegacyElasticsearchErrorHelpers } from './errors';
|
||||
export * from './api_types';
|
|
@ -19,7 +19,7 @@
|
|||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
import { retryCallCluster, migrationsRetryCallCluster } from './retry_call_cluster';
|
||||
import { loggingSystemMock } from '../logging/logging_system.mock';
|
||||
import { loggingSystemMock } from '../../logging/logging_system.mock';
|
||||
|
||||
describe('retryCallCluster', () => {
|
||||
it('retries ES API calls that rejects with NoConnections', () => {
|
|
@ -21,9 +21,9 @@ import { retryWhen, concatMap } from 'rxjs/operators';
|
|||
import { defer, throwError, iif, timer } from 'rxjs';
|
||||
import * as legacyElasticsearch from 'elasticsearch';
|
||||
|
||||
import { CallAPIOptions } from '.';
|
||||
import { APICaller } from './api_types';
|
||||
import { Logger } from '../logging';
|
||||
import { LegacyCallAPIOptions } from '.';
|
||||
import { LegacyAPICaller } from './api_types';
|
||||
import { Logger } from '../../logging';
|
||||
|
||||
const esErrors = legacyElasticsearch.errors;
|
||||
|
||||
|
@ -39,12 +39,16 @@ const esErrors = legacyElasticsearch.errors;
|
|||
* @param delay
|
||||
*/
|
||||
export function migrationsRetryCallCluster(
|
||||
apiCaller: APICaller,
|
||||
apiCaller: LegacyAPICaller,
|
||||
log: Logger,
|
||||
delay: number = 2500
|
||||
) {
|
||||
const previousErrors: string[] = [];
|
||||
return (endpoint: string, clientParams: Record<string, any> = {}, options?: CallAPIOptions) => {
|
||||
return (
|
||||
endpoint: string,
|
||||
clientParams: Record<string, any> = {},
|
||||
options?: LegacyCallAPIOptions
|
||||
) => {
|
||||
return defer(() => apiCaller(endpoint, clientParams, options))
|
||||
.pipe(
|
||||
retryWhen((error$) =>
|
||||
|
@ -86,8 +90,12 @@ export function migrationsRetryCallCluster(
|
|||
*
|
||||
* @param apiCaller
|
||||
*/
|
||||
export function retryCallCluster(apiCaller: APICaller) {
|
||||
return (endpoint: string, clientParams: Record<string, any> = {}, options?: CallAPIOptions) => {
|
||||
export function retryCallCluster(apiCaller: LegacyAPICaller) {
|
||||
return (
|
||||
endpoint: string,
|
||||
clientParams: Record<string, any> = {},
|
||||
options?: LegacyCallAPIOptions
|
||||
) => {
|
||||
return defer(() => apiCaller(endpoint, clientParams, options))
|
||||
.pipe(
|
||||
retryWhen((errors) =>
|
|
@ -17,15 +17,15 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { ScopedClusterClient } from './scoped_cluster_client';
|
||||
import { LegacyScopedClusterClient } from './scoped_cluster_client';
|
||||
|
||||
let internalAPICaller: jest.Mock;
|
||||
let scopedAPICaller: jest.Mock;
|
||||
let clusterClient: ScopedClusterClient;
|
||||
let clusterClient: LegacyScopedClusterClient;
|
||||
beforeEach(() => {
|
||||
internalAPICaller = jest.fn();
|
||||
scopedAPICaller = jest.fn();
|
||||
clusterClient = new ScopedClusterClient(internalAPICaller, scopedAPICaller, { one: '1' });
|
||||
clusterClient = new LegacyScopedClusterClient(internalAPICaller, scopedAPICaller, { one: '1' });
|
||||
});
|
||||
|
||||
afterEach(() => jest.clearAllMocks());
|
||||
|
@ -184,7 +184,10 @@ describe('#callAsCurrentUser', () => {
|
|||
const mockResponse = { data: 'response' };
|
||||
scopedAPICaller.mockResolvedValue(mockResponse);
|
||||
|
||||
const clusterClientWithoutHeaders = new ScopedClusterClient(internalAPICaller, scopedAPICaller);
|
||||
const clusterClientWithoutHeaders = new LegacyScopedClusterClient(
|
||||
internalAPICaller,
|
||||
scopedAPICaller
|
||||
);
|
||||
|
||||
await expect(clusterClientWithoutHeaders.callAsCurrentUser('ping')).resolves.toBe(mockResponse);
|
||||
expect(scopedAPICaller).toHaveBeenCalledTimes(1);
|
|
@ -18,11 +18,8 @@
|
|||
*/
|
||||
|
||||
import { intersection, isObject } from 'lodash';
|
||||
import { Headers } from '../http/router';
|
||||
import { APICaller, CallAPIOptions } from './api_types';
|
||||
|
||||
/** @public */
|
||||
export { Headers };
|
||||
import { Headers } from '../../http/router';
|
||||
import { LegacyAPICaller, LegacyCallAPIOptions } from './api_types';
|
||||
|
||||
/**
|
||||
* Serves the same purpose as "normal" `ClusterClient` but exposes additional
|
||||
|
@ -30,12 +27,12 @@ export { Headers };
|
|||
* user (as `callAsInternalUser` does) to request Elasticsearch API, but rather
|
||||
* passes HTTP headers extracted from the current user request to the API.
|
||||
*
|
||||
* See {@link ScopedClusterClient}.
|
||||
* See {@link LegacyScopedClusterClient}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type IScopedClusterClient = Pick<
|
||||
ScopedClusterClient,
|
||||
export type ILegacyScopedClusterClient = Pick<
|
||||
LegacyScopedClusterClient,
|
||||
'callAsCurrentUser' | 'callAsInternalUser'
|
||||
>;
|
||||
|
||||
|
@ -43,10 +40,10 @@ export type IScopedClusterClient = Pick<
|
|||
* {@inheritDoc IScopedClusterClient}
|
||||
* @public
|
||||
*/
|
||||
export class ScopedClusterClient implements IScopedClusterClient {
|
||||
export class LegacyScopedClusterClient implements ILegacyScopedClusterClient {
|
||||
constructor(
|
||||
private readonly internalAPICaller: APICaller,
|
||||
private readonly scopedAPICaller: APICaller,
|
||||
private readonly internalAPICaller: LegacyAPICaller,
|
||||
private readonly scopedAPICaller: LegacyAPICaller,
|
||||
private readonly headers?: Headers
|
||||
) {
|
||||
this.callAsCurrentUser = this.callAsCurrentUser.bind(this);
|
||||
|
@ -56,7 +53,7 @@ export class ScopedClusterClient implements IScopedClusterClient {
|
|||
/**
|
||||
* Calls specified `endpoint` with provided `clientParams` on behalf of the
|
||||
* Kibana internal user.
|
||||
* See {@link APICaller}.
|
||||
* See {@link LegacyAPICaller}.
|
||||
*
|
||||
* @param endpoint - String descriptor of the endpoint e.g. `cluster.getSettings` or `ping`.
|
||||
* @param clientParams - A dictionary of parameters that will be passed directly to the Elasticsearch JS client.
|
||||
|
@ -65,7 +62,7 @@ export class ScopedClusterClient implements IScopedClusterClient {
|
|||
public callAsInternalUser(
|
||||
endpoint: string,
|
||||
clientParams: Record<string, any> = {},
|
||||
options?: CallAPIOptions
|
||||
options?: LegacyCallAPIOptions
|
||||
) {
|
||||
return this.internalAPICaller(endpoint, clientParams, options);
|
||||
}
|
||||
|
@ -73,7 +70,7 @@ export class ScopedClusterClient implements IScopedClusterClient {
|
|||
/**
|
||||
* Calls specified `endpoint` with provided `clientParams` on behalf of the
|
||||
* user initiated request to the Kibana server (via HTTP request headers).
|
||||
* See {@link APICaller}.
|
||||
* See {@link LegacyAPICaller}.
|
||||
*
|
||||
* @param endpoint - String descriptor of the endpoint e.g. `cluster.getSettings` or `ping`.
|
||||
* @param clientParams - A dictionary of parameters that will be passed directly to the Elasticsearch JS client.
|
||||
|
@ -82,7 +79,7 @@ export class ScopedClusterClient implements IScopedClusterClient {
|
|||
public callAsCurrentUser(
|
||||
endpoint: string,
|
||||
clientParams: Record<string, any> = {},
|
||||
options?: CallAPIOptions
|
||||
options?: LegacyCallAPIOptions
|
||||
) {
|
||||
const defaultHeaders = this.headers;
|
||||
if (defaultHeaders !== undefined) {
|
|
@ -18,9 +18,14 @@
|
|||
*/
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { Headers } from '../http/router';
|
||||
import { LegacyRequest, KibanaRequest } from '../http';
|
||||
import { ElasticsearchConfig } from './elasticsearch_config';
|
||||
import { ElasticsearchClientConfig } from './elasticsearch_client_config';
|
||||
import { IClusterClient, ICustomClusterClient } from './cluster_client';
|
||||
import {
|
||||
LegacyElasticsearchClientConfig,
|
||||
ILegacyClusterClient,
|
||||
ILegacyCustomClusterClient,
|
||||
} from './legacy';
|
||||
import { NodesVersionCompatibility } from './version_check/ensure_es_version';
|
||||
import { ServiceStatus } from '../status';
|
||||
|
||||
|
@ -38,7 +43,7 @@ export interface ElasticsearchServiceSetup {
|
|||
* @deprecated
|
||||
* Use {@link ElasticsearchServiceStart.legacy | ElasticsearchServiceStart.legacy.createClient} instead.
|
||||
*
|
||||
* Create application specific Elasticsearch cluster API client with customized config. See {@link IClusterClient}.
|
||||
* Create application specific Elasticsearch cluster API client with customized config. See {@link ILegacyClusterClient}.
|
||||
*
|
||||
* @param type Unique identifier of the client
|
||||
* @param clientConfig A config consists of Elasticsearch JS client options and
|
||||
|
@ -56,22 +61,22 @@ export interface ElasticsearchServiceSetup {
|
|||
*/
|
||||
readonly createClient: (
|
||||
type: string,
|
||||
clientConfig?: Partial<ElasticsearchClientConfig>
|
||||
) => ICustomClusterClient;
|
||||
clientConfig?: Partial<LegacyElasticsearchClientConfig>
|
||||
) => ILegacyCustomClusterClient;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use {@link ElasticsearchServiceStart.legacy | ElasticsearchServiceStart.legacy.client} instead.
|
||||
*
|
||||
* All Elasticsearch config value changes are processed under the hood.
|
||||
* See {@link IClusterClient}.
|
||||
* See {@link ILegacyClusterClient}.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const client = core.elasticsearch.legacy.client;
|
||||
* ```
|
||||
*/
|
||||
readonly client: IClusterClient;
|
||||
readonly client: ILegacyClusterClient;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -86,7 +91,7 @@ export interface ElasticsearchServiceStart {
|
|||
* */
|
||||
legacy: {
|
||||
/**
|
||||
* Create application specific Elasticsearch cluster API client with customized config. See {@link IClusterClient}.
|
||||
* Create application specific Elasticsearch cluster API client with customized config. See {@link ILegacyClusterClient}.
|
||||
*
|
||||
* @param type Unique identifier of the client
|
||||
* @param clientConfig A config consists of Elasticsearch JS client options and
|
||||
|
@ -104,19 +109,19 @@ export interface ElasticsearchServiceStart {
|
|||
*/
|
||||
readonly createClient: (
|
||||
type: string,
|
||||
clientConfig?: Partial<ElasticsearchClientConfig>
|
||||
) => ICustomClusterClient;
|
||||
clientConfig?: Partial<LegacyElasticsearchClientConfig>
|
||||
) => ILegacyCustomClusterClient;
|
||||
|
||||
/**
|
||||
* A pre-configured Elasticsearch client. All Elasticsearch config value changes are processed under the hood.
|
||||
* See {@link IClusterClient}.
|
||||
* See {@link ILegacyClusterClient}.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const client = core.elasticsearch.client;
|
||||
* ```
|
||||
*/
|
||||
readonly client: IClusterClient;
|
||||
readonly client: ILegacyClusterClient;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -135,3 +140,21 @@ export interface ElasticsearchStatusMeta {
|
|||
warningNodes: NodesVersionCompatibility['warningNodes'];
|
||||
incompatibleNodes: NodesVersionCompatibility['incompatibleNodes'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Fake request object created manually by Kibana plugins.
|
||||
* @public
|
||||
*/
|
||||
export interface FakeRequest {
|
||||
/** Headers used for authentication against Elasticsearch */
|
||||
headers: Headers;
|
||||
}
|
||||
|
||||
/**
|
||||
A user credentials container.
|
||||
* It accommodates the necessary auth credentials to impersonate the current user.
|
||||
*
|
||||
* @public
|
||||
* See {@link KibanaRequest}.
|
||||
*/
|
||||
export type ScopeableRequest = KibanaRequest | LegacyRequest | FakeRequest;
|
||||
|
|
|
@ -29,10 +29,10 @@ import {
|
|||
esVersionEqualsKibana,
|
||||
} from './es_kibana_version_compatability';
|
||||
import { Logger } from '../../logging';
|
||||
import { APICaller } from '..';
|
||||
import { LegacyAPICaller } from '..';
|
||||
|
||||
export interface PollEsNodesVersionOptions {
|
||||
callWithInternalUser: APICaller;
|
||||
callWithInternalUser: LegacyAPICaller;
|
||||
log: Logger;
|
||||
kibanaVersion: string;
|
||||
ignoreVersionMismatch: boolean;
|
||||
|
|
|
@ -25,6 +25,7 @@ export {
|
|||
CustomHttpResponseOptions,
|
||||
IKibanaSocket,
|
||||
isRealRequest,
|
||||
Headers,
|
||||
HttpResponseOptions,
|
||||
HttpResponsePayload,
|
||||
ErrorHttpResponseOptions,
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
import { elasticsearchServiceMock } from '../../elasticsearch/elasticsearch_service.mock';
|
||||
|
||||
export const clusterClientMock = jest.fn();
|
||||
jest.doMock('../../elasticsearch/scoped_cluster_client', () => ({
|
||||
ScopedClusterClient: clusterClientMock.mockImplementation(function () {
|
||||
jest.doMock('../../elasticsearch/legacy/scoped_cluster_client', () => ({
|
||||
LegacyScopedClusterClient: clusterClientMock.mockImplementation(function () {
|
||||
return elasticsearchServiceMock.createScopedClusterClient();
|
||||
}),
|
||||
}));
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
import {
|
||||
ElasticsearchServiceSetup,
|
||||
IScopedClusterClient,
|
||||
ILegacyScopedClusterClient,
|
||||
configSchema as elasticsearchConfigSchema,
|
||||
ElasticsearchServiceStart,
|
||||
} from './elasticsearch';
|
||||
|
@ -91,25 +91,24 @@ export {
|
|||
export { CoreId } from './core_context';
|
||||
export { CspConfig, ICspConfig } from './csp';
|
||||
export {
|
||||
ClusterClient,
|
||||
IClusterClient,
|
||||
ICustomClusterClient,
|
||||
Headers,
|
||||
ScopedClusterClient,
|
||||
IScopedClusterClient,
|
||||
LegacyClusterClient,
|
||||
ILegacyClusterClient,
|
||||
ILegacyCustomClusterClient,
|
||||
LegacyScopedClusterClient,
|
||||
ILegacyScopedClusterClient,
|
||||
ElasticsearchConfig,
|
||||
ElasticsearchClientConfig,
|
||||
ElasticsearchError,
|
||||
ElasticsearchErrorHelpers,
|
||||
LegacyElasticsearchClientConfig,
|
||||
LegacyElasticsearchError,
|
||||
LegacyElasticsearchErrorHelpers,
|
||||
ElasticsearchServiceSetup,
|
||||
ElasticsearchServiceStart,
|
||||
ElasticsearchStatusMeta,
|
||||
NodesVersionCompatibility,
|
||||
APICaller,
|
||||
LegacyAPICaller,
|
||||
FakeRequest,
|
||||
ScopeableRequest,
|
||||
} from './elasticsearch';
|
||||
export * from './elasticsearch/api_types';
|
||||
export * from './elasticsearch/legacy/api_types';
|
||||
export {
|
||||
AuthenticationHandler,
|
||||
AuthHeaders,
|
||||
|
@ -127,6 +126,7 @@ export {
|
|||
CustomHttpResponseOptions,
|
||||
GetAuthHeaders,
|
||||
GetAuthState,
|
||||
Headers,
|
||||
HttpAuth,
|
||||
HttpResponseOptions,
|
||||
HttpResponsePayload,
|
||||
|
@ -356,7 +356,7 @@ export {
|
|||
* which uses the credentials of the incoming request
|
||||
* - {@link ISavedObjectTypeRegistry | savedObjects.typeRegistry} - Type registry containing
|
||||
* all the registered types.
|
||||
* - {@link ScopedClusterClient | elasticsearch.legacy.client} - Elasticsearch
|
||||
* - {@link LegacyScopedClusterClient | elasticsearch.legacy.client} - Elasticsearch
|
||||
* data client which uses the credentials of the incoming request
|
||||
* - {@link IUiSettingsClient | uiSettings.client} - uiSettings client
|
||||
* which uses the credentials of the incoming request
|
||||
|
@ -371,7 +371,7 @@ export interface RequestHandlerContext {
|
|||
};
|
||||
elasticsearch: {
|
||||
legacy: {
|
||||
client: IScopedClusterClient;
|
||||
client: ILegacyScopedClusterClient;
|
||||
};
|
||||
};
|
||||
uiSettings: {
|
||||
|
|
|
@ -30,13 +30,13 @@ import { KibanaMigrator, IKibanaMigrator } from './migrations';
|
|||
import { CoreContext } from '../core_context';
|
||||
import { LegacyServiceDiscoverPlugins } from '../legacy';
|
||||
import {
|
||||
APICaller,
|
||||
LegacyAPICaller,
|
||||
ElasticsearchServiceStart,
|
||||
IClusterClient,
|
||||
ILegacyClusterClient,
|
||||
InternalElasticsearchServiceSetup,
|
||||
} from '../elasticsearch';
|
||||
import { KibanaConfigType } from '../kibana_config';
|
||||
import { migrationsRetryCallCluster } from '../elasticsearch/retry_call_cluster';
|
||||
import { migrationsRetryCallCluster } from '../elasticsearch/legacy';
|
||||
import {
|
||||
SavedObjectsConfigType,
|
||||
SavedObjectsMigrationConfigType,
|
||||
|
@ -434,7 +434,7 @@ export class SavedObjectsService
|
|||
await migrator.runMigrations();
|
||||
}
|
||||
|
||||
const createRepository = (callCluster: APICaller, includedHiddenTypes: string[] = []) => {
|
||||
const createRepository = (callCluster: LegacyAPICaller, includedHiddenTypes: string[] = []) => {
|
||||
return SavedObjectsRepository.createRepository(
|
||||
migrator,
|
||||
this.typeRegistry,
|
||||
|
@ -484,7 +484,7 @@ export class SavedObjectsService
|
|||
private createMigrator(
|
||||
kibanaConfig: KibanaConfigType,
|
||||
savedObjectsConfig: SavedObjectsMigrationConfigType,
|
||||
esClient: IClusterClient,
|
||||
esClient: ILegacyClusterClient,
|
||||
migrationsRetryDelay?: number
|
||||
): KibanaMigrator {
|
||||
return new KibanaMigrator({
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
import { omit } from 'lodash';
|
||||
import uuid from 'uuid';
|
||||
import { retryCallCluster } from '../../../elasticsearch/retry_call_cluster';
|
||||
import { APICaller } from '../../../elasticsearch/';
|
||||
import { retryCallCluster } from '../../../elasticsearch/legacy';
|
||||
import { LegacyAPICaller } from '../../../elasticsearch/';
|
||||
|
||||
import { getRootPropertiesObjects, IndexMapping } from '../../mappings';
|
||||
import { getSearchDsl } from './search_dsl';
|
||||
|
@ -74,7 +74,7 @@ const isRight = (either: Either): either is Right => either.tag === 'Right';
|
|||
export interface SavedObjectsRepositoryOptions {
|
||||
index: string;
|
||||
mappings: IndexMapping;
|
||||
callCluster: APICaller;
|
||||
callCluster: LegacyAPICaller;
|
||||
typeRegistry: SavedObjectTypeRegistry;
|
||||
serializer: SavedObjectsSerializer;
|
||||
migrator: KibanaMigrator;
|
||||
|
@ -117,7 +117,7 @@ export class SavedObjectsRepository {
|
|||
private _mappings: IndexMapping;
|
||||
private _registry: SavedObjectTypeRegistry;
|
||||
private _allowedTypes: string[];
|
||||
private _unwrappedCallCluster: APICaller;
|
||||
private _unwrappedCallCluster: LegacyAPICaller;
|
||||
private _serializer: SavedObjectsSerializer;
|
||||
|
||||
/**
|
||||
|
@ -132,7 +132,7 @@ export class SavedObjectsRepository {
|
|||
migrator: KibanaMigrator,
|
||||
typeRegistry: SavedObjectTypeRegistry,
|
||||
indexName: string,
|
||||
callCluster: APICaller,
|
||||
callCluster: LegacyAPICaller,
|
||||
includedHiddenTypes: string[] = [],
|
||||
injectedConstructor: any = SavedObjectsRepository
|
||||
): ISavedObjectsRepository {
|
||||
|
@ -188,7 +188,7 @@ export class SavedObjectsRepository {
|
|||
}
|
||||
this._allowedTypes = allowedTypes;
|
||||
|
||||
this._unwrappedCallCluster = async (...args: Parameters<APICaller>) => {
|
||||
this._unwrappedCallCluster = async (...args: Parameters<LegacyAPICaller>) => {
|
||||
await migrator.runMigrations();
|
||||
return callCluster(...args);
|
||||
};
|
||||
|
@ -1300,7 +1300,7 @@ export class SavedObjectsRepository {
|
|||
};
|
||||
}
|
||||
|
||||
private async _writeToCluster(...args: Parameters<APICaller>) {
|
||||
private async _writeToCluster(...args: Parameters<LegacyAPICaller>) {
|
||||
try {
|
||||
return await this._callCluster(...args);
|
||||
} catch (err) {
|
||||
|
@ -1308,7 +1308,7 @@ export class SavedObjectsRepository {
|
|||
}
|
||||
}
|
||||
|
||||
private async _callCluster(...args: Parameters<APICaller>) {
|
||||
private async _callCluster(...args: Parameters<LegacyAPICaller>) {
|
||||
try {
|
||||
return await this._unwrappedCallCluster(...args);
|
||||
} catch (err) {
|
||||
|
|
|
@ -144,250 +144,6 @@ import { UpdateDocumentByQueryParams } from 'elasticsearch';
|
|||
import { UpdateDocumentParams } from 'elasticsearch';
|
||||
import { Url } from 'url';
|
||||
|
||||
// @public (undocumented)
|
||||
export interface APICaller {
|
||||
// (undocumented)
|
||||
(endpoint: 'bulk', params: BulkIndexDocumentsParams, options?: CallAPIOptions): ReturnType<Client['bulk']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'clearScroll', params: ClearScrollParams, options?: CallAPIOptions): ReturnType<Client['clearScroll']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'count', params: CountParams, options?: CallAPIOptions): ReturnType<Client['count']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'create', params: CreateDocumentParams, options?: CallAPIOptions): ReturnType<Client['create']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'delete', params: DeleteDocumentParams, options?: CallAPIOptions): ReturnType<Client['delete']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'deleteByQuery', params: DeleteDocumentByQueryParams, options?: CallAPIOptions): ReturnType<Client['deleteByQuery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'deleteScript', params: DeleteScriptParams, options?: CallAPIOptions): ReturnType<Client['deleteScript']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'deleteTemplate', params: DeleteTemplateParams, options?: CallAPIOptions): ReturnType<Client['deleteTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'exists', params: ExistsParams, options?: CallAPIOptions): ReturnType<Client['exists']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'explain', params: ExplainParams, options?: CallAPIOptions): ReturnType<Client['explain']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'fieldStats', params: FieldStatsParams, options?: CallAPIOptions): ReturnType<Client['fieldStats']>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'get', params: GetParams, options?: CallAPIOptions): Promise<GetResponse<T>>;
|
||||
// (undocumented)
|
||||
(endpoint: 'getScript', params: GetScriptParams, options?: CallAPIOptions): ReturnType<Client['getScript']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'getSource', params: GetSourceParams, options?: CallAPIOptions): ReturnType<Client['getSource']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'getTemplate', params: GetTemplateParams, options?: CallAPIOptions): ReturnType<Client['getTemplate']>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'index', params: IndexDocumentParams<T>, options?: CallAPIOptions): ReturnType<Client['index']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'info', params: InfoParams, options?: CallAPIOptions): ReturnType<Client['info']>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'mget', params: MGetParams, options?: CallAPIOptions): Promise<MGetResponse<T>>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'msearch', params: MSearchParams, options?: CallAPIOptions): Promise<MSearchResponse<T>>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'msearchTemplate', params: MSearchTemplateParams, options?: CallAPIOptions): Promise<MSearchResponse<T>>;
|
||||
// (undocumented)
|
||||
(endpoint: 'mtermvectors', params: MTermVectorsParams, options?: CallAPIOptions): ReturnType<Client['mtermvectors']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ping', params: PingParams, options?: CallAPIOptions): ReturnType<Client['ping']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'putScript', params: PutScriptParams, options?: CallAPIOptions): ReturnType<Client['putScript']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'putTemplate', params: PutTemplateParams, options?: CallAPIOptions): ReturnType<Client['putTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'reindex', params: ReindexParams, options?: CallAPIOptions): ReturnType<Client['reindex']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'reindexRethrottle', params: ReindexRethrottleParams, options?: CallAPIOptions): ReturnType<Client['reindexRethrottle']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'renderSearchTemplate', params: RenderSearchTemplateParams, options?: CallAPIOptions): ReturnType<Client['renderSearchTemplate']>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'scroll', params: ScrollParams, options?: CallAPIOptions): Promise<SearchResponse<T>>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'search', params: SearchParams, options?: CallAPIOptions): Promise<SearchResponse<T>>;
|
||||
// (undocumented)
|
||||
(endpoint: 'searchShards', params: SearchShardsParams, options?: CallAPIOptions): ReturnType<Client['searchShards']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'searchTemplate', params: SearchTemplateParams, options?: CallAPIOptions): ReturnType<Client['searchTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'suggest', params: SuggestParams, options?: CallAPIOptions): ReturnType<Client['suggest']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'termvectors', params: TermvectorsParams, options?: CallAPIOptions): ReturnType<Client['termvectors']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'update', params: UpdateDocumentParams, options?: CallAPIOptions): ReturnType<Client['update']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'updateByQuery', params: UpdateDocumentByQueryParams, options?: CallAPIOptions): ReturnType<Client['updateByQuery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.aliases', params: CatAliasesParams, options?: CallAPIOptions): ReturnType<Client['cat']['aliases']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.allocation', params: CatAllocationParams, options?: CallAPIOptions): ReturnType<Client['cat']['allocation']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.count', params: CatAllocationParams, options?: CallAPIOptions): ReturnType<Client['cat']['count']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.fielddata', params: CatFielddataParams, options?: CallAPIOptions): ReturnType<Client['cat']['fielddata']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.health', params: CatHealthParams, options?: CallAPIOptions): ReturnType<Client['cat']['health']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.help', params: CatHelpParams, options?: CallAPIOptions): ReturnType<Client['cat']['help']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.indices', params: CatIndicesParams, options?: CallAPIOptions): ReturnType<Client['cat']['indices']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.master', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['master']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.nodeattrs', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['nodeattrs']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.nodes', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['nodes']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.pendingTasks', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['pendingTasks']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.plugins', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['plugins']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.recovery', params: CatRecoveryParams, options?: CallAPIOptions): ReturnType<Client['cat']['recovery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.repositories', params: CatCommonParams, options?: CallAPIOptions): ReturnType<Client['cat']['repositories']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.segments', params: CatSegmentsParams, options?: CallAPIOptions): ReturnType<Client['cat']['segments']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.shards', params: CatShardsParams, options?: CallAPIOptions): ReturnType<Client['cat']['shards']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.snapshots', params: CatSnapshotsParams, options?: CallAPIOptions): ReturnType<Client['cat']['snapshots']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.tasks', params: CatTasksParams, options?: CallAPIOptions): ReturnType<Client['cat']['tasks']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.threadPool', params: CatThreadPoolParams, options?: CallAPIOptions): ReturnType<Client['cat']['threadPool']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.allocationExplain', params: ClusterAllocationExplainParams, options?: CallAPIOptions): ReturnType<Client['cluster']['allocationExplain']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.getSettings', params: ClusterGetSettingsParams, options?: CallAPIOptions): ReturnType<Client['cluster']['getSettings']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.health', params: ClusterHealthParams, options?: CallAPIOptions): ReturnType<Client['cluster']['health']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.pendingTasks', params: ClusterPendingTasksParams, options?: CallAPIOptions): ReturnType<Client['cluster']['pendingTasks']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.putSettings', params: ClusterPutSettingsParams, options?: CallAPIOptions): ReturnType<Client['cluster']['putSettings']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.reroute', params: ClusterRerouteParams, options?: CallAPIOptions): ReturnType<Client['cluster']['reroute']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.state', params: ClusterStateParams, options?: CallAPIOptions): ReturnType<Client['cluster']['state']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.stats', params: ClusterStatsParams, options?: CallAPIOptions): ReturnType<Client['cluster']['stats']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.analyze', params: IndicesAnalyzeParams, options?: CallAPIOptions): ReturnType<Client['indices']['analyze']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.clearCache', params: IndicesClearCacheParams, options?: CallAPIOptions): ReturnType<Client['indices']['clearCache']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.close', params: IndicesCloseParams, options?: CallAPIOptions): ReturnType<Client['indices']['close']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.create', params: IndicesCreateParams, options?: CallAPIOptions): ReturnType<Client['indices']['create']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.delete', params: IndicesDeleteParams, options?: CallAPIOptions): ReturnType<Client['indices']['delete']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.deleteAlias', params: IndicesDeleteAliasParams, options?: CallAPIOptions): ReturnType<Client['indices']['deleteAlias']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.deleteTemplate', params: IndicesDeleteTemplateParams, options?: CallAPIOptions): ReturnType<Client['indices']['deleteTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.exists', params: IndicesExistsParams, options?: CallAPIOptions): ReturnType<Client['indices']['exists']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.existsAlias', params: IndicesExistsAliasParams, options?: CallAPIOptions): ReturnType<Client['indices']['existsAlias']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.existsTemplate', params: IndicesExistsTemplateParams, options?: CallAPIOptions): ReturnType<Client['indices']['existsTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.existsType', params: IndicesExistsTypeParams, options?: CallAPIOptions): ReturnType<Client['indices']['existsType']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.flush', params: IndicesFlushParams, options?: CallAPIOptions): ReturnType<Client['indices']['flush']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.flushSynced', params: IndicesFlushSyncedParams, options?: CallAPIOptions): ReturnType<Client['indices']['flushSynced']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.forcemerge', params: IndicesForcemergeParams, options?: CallAPIOptions): ReturnType<Client['indices']['forcemerge']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.get', params: IndicesGetParams, options?: CallAPIOptions): ReturnType<Client['indices']['get']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getAlias', params: IndicesGetAliasParams, options?: CallAPIOptions): ReturnType<Client['indices']['getAlias']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getFieldMapping', params: IndicesGetFieldMappingParams, options?: CallAPIOptions): ReturnType<Client['indices']['getFieldMapping']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getMapping', params: IndicesGetMappingParams, options?: CallAPIOptions): ReturnType<Client['indices']['getMapping']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getSettings', params: IndicesGetSettingsParams, options?: CallAPIOptions): ReturnType<Client['indices']['getSettings']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getTemplate', params: IndicesGetTemplateParams, options?: CallAPIOptions): ReturnType<Client['indices']['getTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getUpgrade', params: IndicesGetUpgradeParams, options?: CallAPIOptions): ReturnType<Client['indices']['getUpgrade']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.open', params: IndicesOpenParams, options?: CallAPIOptions): ReturnType<Client['indices']['open']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.putAlias', params: IndicesPutAliasParams, options?: CallAPIOptions): ReturnType<Client['indices']['putAlias']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.putMapping', params: IndicesPutMappingParams, options?: CallAPIOptions): ReturnType<Client['indices']['putMapping']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.putSettings', params: IndicesPutSettingsParams, options?: CallAPIOptions): ReturnType<Client['indices']['putSettings']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.putTemplate', params: IndicesPutTemplateParams, options?: CallAPIOptions): ReturnType<Client['indices']['putTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.recovery', params: IndicesRecoveryParams, options?: CallAPIOptions): ReturnType<Client['indices']['recovery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.refresh', params: IndicesRefreshParams, options?: CallAPIOptions): ReturnType<Client['indices']['refresh']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.rollover', params: IndicesRolloverParams, options?: CallAPIOptions): ReturnType<Client['indices']['rollover']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.segments', params: IndicesSegmentsParams, options?: CallAPIOptions): ReturnType<Client['indices']['segments']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.shardStores', params: IndicesShardStoresParams, options?: CallAPIOptions): ReturnType<Client['indices']['shardStores']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.shrink', params: IndicesShrinkParams, options?: CallAPIOptions): ReturnType<Client['indices']['shrink']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.stats', params: IndicesStatsParams, options?: CallAPIOptions): ReturnType<Client['indices']['stats']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.updateAliases', params: IndicesUpdateAliasesParams, options?: CallAPIOptions): ReturnType<Client['indices']['updateAliases']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.upgrade', params: IndicesUpgradeParams, options?: CallAPIOptions): ReturnType<Client['indices']['upgrade']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.validateQuery', params: IndicesValidateQueryParams, options?: CallAPIOptions): ReturnType<Client['indices']['validateQuery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ingest.deletePipeline', params: IngestDeletePipelineParams, options?: CallAPIOptions): ReturnType<Client['ingest']['deletePipeline']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ingest.getPipeline', params: IngestGetPipelineParams, options?: CallAPIOptions): ReturnType<Client['ingest']['getPipeline']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ingest.putPipeline', params: IngestPutPipelineParams, options?: CallAPIOptions): ReturnType<Client['ingest']['putPipeline']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ingest.simulate', params: IngestSimulateParams, options?: CallAPIOptions): ReturnType<Client['ingest']['simulate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'nodes.hotThreads', params: NodesHotThreadsParams, options?: CallAPIOptions): ReturnType<Client['nodes']['hotThreads']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'nodes.info', params: NodesInfoParams, options?: CallAPIOptions): ReturnType<Client['nodes']['info']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'nodes.stats', params: NodesStatsParams, options?: CallAPIOptions): ReturnType<Client['nodes']['stats']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.create', params: SnapshotCreateParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['create']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.createRepository', params: SnapshotCreateRepositoryParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['createRepository']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.delete', params: SnapshotDeleteParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['delete']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.deleteRepository', params: SnapshotDeleteRepositoryParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['deleteRepository']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.get', params: SnapshotGetParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['get']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.getRepository', params: SnapshotGetRepositoryParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['getRepository']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.restore', params: SnapshotRestoreParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['restore']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.status', params: SnapshotStatusParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['status']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.verifyRepository', params: SnapshotVerifyRepositoryParams, options?: CallAPIOptions): ReturnType<Client['snapshot']['verifyRepository']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'tasks.cancel', params: TasksCancelParams, options?: CallAPIOptions): ReturnType<Client['tasks']['cancel']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'tasks.get', params: TasksGetParams, options?: CallAPIOptions): ReturnType<Client['tasks']['get']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'tasks.list', params: TasksListParams, options?: CallAPIOptions): ReturnType<Client['tasks']['list']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'transport.request', clientParams: AssistantAPIClientParams, options?: CallAPIOptions): Promise<AssistanceAPIResponse>;
|
||||
// (undocumented)
|
||||
(endpoint: 'transport.request', clientParams: DeprecationAPIClientParams, options?: CallAPIOptions): Promise<DeprecationAPIResponse>;
|
||||
// (undocumented)
|
||||
<T = any>(endpoint: string, clientParams?: Record<string, any>, options?: CallAPIOptions): Promise<T>;
|
||||
}
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "appendersSchema" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public (undocumented)
|
||||
|
@ -497,12 +253,6 @@ export class BasePath {
|
|||
// @internal (undocumented)
|
||||
export function bootstrap({ configs, cliArgs, applyConfigOverrides, features, }: BootstrapArgs): Promise<void>;
|
||||
|
||||
// @public
|
||||
export interface CallAPIOptions {
|
||||
signal?: AbortSignal;
|
||||
wrap401Errors?: boolean;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface Capabilities {
|
||||
[key: string]: Record<string, boolean | Record<string, boolean>>;
|
||||
|
@ -530,14 +280,6 @@ export interface CapabilitiesStart {
|
|||
// @public
|
||||
export type CapabilitiesSwitcher = (request: KibanaRequest, uiCapabilities: Capabilities) => Partial<Capabilities> | Promise<Partial<Capabilities>>;
|
||||
|
||||
// @public
|
||||
export class ClusterClient implements IClusterClient {
|
||||
constructor(config: ElasticsearchClientConfig, log: Logger, getAuthHeaders?: GetAuthHeaders);
|
||||
asScoped(request?: ScopeableRequest): IScopedClusterClient;
|
||||
callAsInternalUser: APICaller;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export const config: {
|
||||
elasticsearch: {
|
||||
|
@ -851,14 +593,6 @@ export interface DiscoveredPlugin {
|
|||
readonly requiredPlugins: readonly PluginName[];
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type ElasticsearchClientConfig = Pick<ConfigOptions, 'keepAlive' | 'log' | 'plugins'> & Pick<ElasticsearchConfig, 'apiVersion' | 'customHeaders' | 'logQueries' | 'requestHeadersWhitelist' | 'sniffOnStart' | 'sniffOnConnectionFault' | 'hosts' | 'username' | 'password'> & {
|
||||
pingTimeout?: ElasticsearchConfig['pingTimeout'] | ConfigOptions['pingTimeout'];
|
||||
requestTimeout?: ElasticsearchConfig['requestTimeout'] | ConfigOptions['requestTimeout'];
|
||||
sniffInterval?: ElasticsearchConfig['sniffInterval'] | ConfigOptions['sniffInterval'];
|
||||
ssl?: Partial<ElasticsearchConfig['ssl']>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class ElasticsearchConfig {
|
||||
constructor(rawConfig: ElasticsearchConfigType);
|
||||
|
@ -884,26 +618,12 @@ export class ElasticsearchConfig {
|
|||
readonly username?: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ElasticsearchError extends Boom {
|
||||
// (undocumented)
|
||||
[code]?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class ElasticsearchErrorHelpers {
|
||||
// (undocumented)
|
||||
static decorateNotAuthorizedError(error: Error, reason?: string): ElasticsearchError;
|
||||
// (undocumented)
|
||||
static isNotAuthorizedError(error: any): error is ElasticsearchError;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ElasticsearchServiceSetup {
|
||||
// @deprecated (undocumented)
|
||||
legacy: {
|
||||
readonly createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient;
|
||||
readonly client: IClusterClient;
|
||||
readonly createClient: (type: string, clientConfig?: Partial<LegacyElasticsearchClientConfig>) => ILegacyCustomClusterClient;
|
||||
readonly client: ILegacyClusterClient;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -911,8 +631,8 @@ export interface ElasticsearchServiceSetup {
|
|||
export interface ElasticsearchServiceStart {
|
||||
// @deprecated (undocumented)
|
||||
legacy: {
|
||||
readonly createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient;
|
||||
readonly client: IClusterClient;
|
||||
readonly createClient: (type: string, clientConfig?: Partial<LegacyElasticsearchClientConfig>) => ILegacyCustomClusterClient;
|
||||
readonly client: ILegacyClusterClient;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1056,9 +776,6 @@ export interface HttpServiceStart {
|
|||
// @public
|
||||
export type IBasePath = Pick<BasePath, keyof BasePath>;
|
||||
|
||||
// @public
|
||||
export type IClusterClient = Pick<ClusterClient, 'callAsInternalUser' | 'asScoped'>;
|
||||
|
||||
// @public
|
||||
export interface IContextContainer<THandler extends HandlerFunction<any>> {
|
||||
createHandler(pluginOpaqueId: PluginOpaqueId, handler: THandler): (...rest: HandlerParameters<THandler>) => ShallowPromise<ReturnType<THandler>>;
|
||||
|
@ -1078,9 +795,6 @@ export interface ICspConfig {
|
|||
readonly warnLegacyBrowsers: boolean;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ICustomClusterClient = Pick<ClusterClient, 'callAsInternalUser' | 'close' | 'asScoped'>;
|
||||
|
||||
// @public
|
||||
export interface IKibanaResponse<T extends HttpResponsePayload | ResponseError = any> {
|
||||
// (undocumented)
|
||||
|
@ -1102,6 +816,15 @@ export interface IKibanaSocket {
|
|||
getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate | null;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ILegacyClusterClient = Pick<LegacyClusterClient, 'callAsInternalUser' | 'asScoped'>;
|
||||
|
||||
// @public
|
||||
export type ILegacyCustomClusterClient = Pick<LegacyClusterClient, 'callAsInternalUser' | 'close' | 'asScoped'>;
|
||||
|
||||
// @public
|
||||
export type ILegacyScopedClusterClient = Pick<LegacyScopedClusterClient, 'callAsCurrentUser' | 'callAsInternalUser'>;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface ImageValidation {
|
||||
// (undocumented)
|
||||
|
@ -1155,9 +878,6 @@ export type ISavedObjectsRepository = Pick<SavedObjectsRepository, keyof SavedOb
|
|||
// @public
|
||||
export type ISavedObjectTypeRegistry = Omit<SavedObjectTypeRegistry, 'registerType'>;
|
||||
|
||||
// @public
|
||||
export type IScopedClusterClient = Pick<ScopedClusterClient, 'callAsCurrentUser' | 'callAsInternalUser'>;
|
||||
|
||||
// @public
|
||||
export function isRelativeUrl(candidatePath: string): boolean;
|
||||
|
||||
|
@ -1247,6 +967,266 @@ export const kibanaResponseFactory: {
|
|||
// @public
|
||||
export type KnownHeaders = KnownKeys<IncomingHttpHeaders>;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface LegacyAPICaller {
|
||||
// (undocumented)
|
||||
(endpoint: 'bulk', params: BulkIndexDocumentsParams, options?: LegacyCallAPIOptions): ReturnType<Client['bulk']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'clearScroll', params: ClearScrollParams, options?: LegacyCallAPIOptions): ReturnType<Client['clearScroll']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'count', params: CountParams, options?: LegacyCallAPIOptions): ReturnType<Client['count']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'create', params: CreateDocumentParams, options?: LegacyCallAPIOptions): ReturnType<Client['create']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'delete', params: DeleteDocumentParams, options?: LegacyCallAPIOptions): ReturnType<Client['delete']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'deleteByQuery', params: DeleteDocumentByQueryParams, options?: LegacyCallAPIOptions): ReturnType<Client['deleteByQuery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'deleteScript', params: DeleteScriptParams, options?: LegacyCallAPIOptions): ReturnType<Client['deleteScript']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'deleteTemplate', params: DeleteTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['deleteTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'exists', params: ExistsParams, options?: LegacyCallAPIOptions): ReturnType<Client['exists']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'explain', params: ExplainParams, options?: LegacyCallAPIOptions): ReturnType<Client['explain']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'fieldStats', params: FieldStatsParams, options?: LegacyCallAPIOptions): ReturnType<Client['fieldStats']>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'get', params: GetParams, options?: LegacyCallAPIOptions): Promise<GetResponse<T>>;
|
||||
// (undocumented)
|
||||
(endpoint: 'getScript', params: GetScriptParams, options?: LegacyCallAPIOptions): ReturnType<Client['getScript']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'getSource', params: GetSourceParams, options?: LegacyCallAPIOptions): ReturnType<Client['getSource']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'getTemplate', params: GetTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['getTemplate']>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'index', params: IndexDocumentParams<T>, options?: LegacyCallAPIOptions): ReturnType<Client['index']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'info', params: InfoParams, options?: LegacyCallAPIOptions): ReturnType<Client['info']>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'mget', params: MGetParams, options?: LegacyCallAPIOptions): Promise<MGetResponse<T>>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'msearch', params: MSearchParams, options?: LegacyCallAPIOptions): Promise<MSearchResponse<T>>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'msearchTemplate', params: MSearchTemplateParams, options?: LegacyCallAPIOptions): Promise<MSearchResponse<T>>;
|
||||
// (undocumented)
|
||||
(endpoint: 'mtermvectors', params: MTermVectorsParams, options?: LegacyCallAPIOptions): ReturnType<Client['mtermvectors']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ping', params: PingParams, options?: LegacyCallAPIOptions): ReturnType<Client['ping']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'putScript', params: PutScriptParams, options?: LegacyCallAPIOptions): ReturnType<Client['putScript']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'putTemplate', params: PutTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['putTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'reindex', params: ReindexParams, options?: LegacyCallAPIOptions): ReturnType<Client['reindex']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'reindexRethrottle', params: ReindexRethrottleParams, options?: LegacyCallAPIOptions): ReturnType<Client['reindexRethrottle']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'renderSearchTemplate', params: RenderSearchTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['renderSearchTemplate']>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'scroll', params: ScrollParams, options?: LegacyCallAPIOptions): Promise<SearchResponse<T>>;
|
||||
// (undocumented)
|
||||
<T>(endpoint: 'search', params: SearchParams, options?: LegacyCallAPIOptions): Promise<SearchResponse<T>>;
|
||||
// (undocumented)
|
||||
(endpoint: 'searchShards', params: SearchShardsParams, options?: LegacyCallAPIOptions): ReturnType<Client['searchShards']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'searchTemplate', params: SearchTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['searchTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'suggest', params: SuggestParams, options?: LegacyCallAPIOptions): ReturnType<Client['suggest']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'termvectors', params: TermvectorsParams, options?: LegacyCallAPIOptions): ReturnType<Client['termvectors']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'update', params: UpdateDocumentParams, options?: LegacyCallAPIOptions): ReturnType<Client['update']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'updateByQuery', params: UpdateDocumentByQueryParams, options?: LegacyCallAPIOptions): ReturnType<Client['updateByQuery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.aliases', params: CatAliasesParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['aliases']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.allocation', params: CatAllocationParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['allocation']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.count', params: CatAllocationParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['count']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.fielddata', params: CatFielddataParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['fielddata']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.health', params: CatHealthParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['health']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.help', params: CatHelpParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['help']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.indices', params: CatIndicesParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['indices']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.master', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['master']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.nodeattrs', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['nodeattrs']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.nodes', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['nodes']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.pendingTasks', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['pendingTasks']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.plugins', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['plugins']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.recovery', params: CatRecoveryParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['recovery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.repositories', params: CatCommonParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['repositories']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.segments', params: CatSegmentsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['segments']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.shards', params: CatShardsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['shards']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.snapshots', params: CatSnapshotsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['snapshots']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.tasks', params: CatTasksParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['tasks']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cat.threadPool', params: CatThreadPoolParams, options?: LegacyCallAPIOptions): ReturnType<Client['cat']['threadPool']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.allocationExplain', params: ClusterAllocationExplainParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['allocationExplain']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.getSettings', params: ClusterGetSettingsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['getSettings']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.health', params: ClusterHealthParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['health']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.pendingTasks', params: ClusterPendingTasksParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['pendingTasks']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.putSettings', params: ClusterPutSettingsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['putSettings']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.reroute', params: ClusterRerouteParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['reroute']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.state', params: ClusterStateParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['state']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'cluster.stats', params: ClusterStatsParams, options?: LegacyCallAPIOptions): ReturnType<Client['cluster']['stats']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.analyze', params: IndicesAnalyzeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['analyze']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.clearCache', params: IndicesClearCacheParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['clearCache']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.close', params: IndicesCloseParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['close']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.create', params: IndicesCreateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['create']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.delete', params: IndicesDeleteParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['delete']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.deleteAlias', params: IndicesDeleteAliasParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['deleteAlias']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.deleteTemplate', params: IndicesDeleteTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['deleteTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.exists', params: IndicesExistsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['exists']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.existsAlias', params: IndicesExistsAliasParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['existsAlias']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.existsTemplate', params: IndicesExistsTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['existsTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.existsType', params: IndicesExistsTypeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['existsType']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.flush', params: IndicesFlushParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['flush']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.flushSynced', params: IndicesFlushSyncedParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['flushSynced']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.forcemerge', params: IndicesForcemergeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['forcemerge']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.get', params: IndicesGetParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['get']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getAlias', params: IndicesGetAliasParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getAlias']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getFieldMapping', params: IndicesGetFieldMappingParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getFieldMapping']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getMapping', params: IndicesGetMappingParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getMapping']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getSettings', params: IndicesGetSettingsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getSettings']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getTemplate', params: IndicesGetTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.getUpgrade', params: IndicesGetUpgradeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['getUpgrade']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.open', params: IndicesOpenParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['open']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.putAlias', params: IndicesPutAliasParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['putAlias']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.putMapping', params: IndicesPutMappingParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['putMapping']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.putSettings', params: IndicesPutSettingsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['putSettings']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.putTemplate', params: IndicesPutTemplateParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['putTemplate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.recovery', params: IndicesRecoveryParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['recovery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.refresh', params: IndicesRefreshParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['refresh']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.rollover', params: IndicesRolloverParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['rollover']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.segments', params: IndicesSegmentsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['segments']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.shardStores', params: IndicesShardStoresParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['shardStores']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.shrink', params: IndicesShrinkParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['shrink']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.stats', params: IndicesStatsParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['stats']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.updateAliases', params: IndicesUpdateAliasesParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['updateAliases']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.upgrade', params: IndicesUpgradeParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['upgrade']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'indices.validateQuery', params: IndicesValidateQueryParams, options?: LegacyCallAPIOptions): ReturnType<Client['indices']['validateQuery']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ingest.deletePipeline', params: IngestDeletePipelineParams, options?: LegacyCallAPIOptions): ReturnType<Client['ingest']['deletePipeline']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ingest.getPipeline', params: IngestGetPipelineParams, options?: LegacyCallAPIOptions): ReturnType<Client['ingest']['getPipeline']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ingest.putPipeline', params: IngestPutPipelineParams, options?: LegacyCallAPIOptions): ReturnType<Client['ingest']['putPipeline']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'ingest.simulate', params: IngestSimulateParams, options?: LegacyCallAPIOptions): ReturnType<Client['ingest']['simulate']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'nodes.hotThreads', params: NodesHotThreadsParams, options?: LegacyCallAPIOptions): ReturnType<Client['nodes']['hotThreads']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'nodes.info', params: NodesInfoParams, options?: LegacyCallAPIOptions): ReturnType<Client['nodes']['info']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'nodes.stats', params: NodesStatsParams, options?: LegacyCallAPIOptions): ReturnType<Client['nodes']['stats']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.create', params: SnapshotCreateParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['create']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.createRepository', params: SnapshotCreateRepositoryParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['createRepository']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.delete', params: SnapshotDeleteParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['delete']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.deleteRepository', params: SnapshotDeleteRepositoryParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['deleteRepository']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.get', params: SnapshotGetParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['get']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.getRepository', params: SnapshotGetRepositoryParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['getRepository']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.restore', params: SnapshotRestoreParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['restore']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.status', params: SnapshotStatusParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['status']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'snapshot.verifyRepository', params: SnapshotVerifyRepositoryParams, options?: LegacyCallAPIOptions): ReturnType<Client['snapshot']['verifyRepository']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'tasks.cancel', params: TasksCancelParams, options?: LegacyCallAPIOptions): ReturnType<Client['tasks']['cancel']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'tasks.get', params: TasksGetParams, options?: LegacyCallAPIOptions): ReturnType<Client['tasks']['get']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'tasks.list', params: TasksListParams, options?: LegacyCallAPIOptions): ReturnType<Client['tasks']['list']>;
|
||||
// (undocumented)
|
||||
(endpoint: 'transport.request', clientParams: AssistantAPIClientParams, options?: LegacyCallAPIOptions): Promise<AssistanceAPIResponse>;
|
||||
// (undocumented)
|
||||
(endpoint: 'transport.request', clientParams: DeprecationAPIClientParams, options?: LegacyCallAPIOptions): Promise<DeprecationAPIResponse>;
|
||||
// (undocumented)
|
||||
<T = any>(endpoint: string, clientParams?: Record<string, any>, options?: LegacyCallAPIOptions): Promise<T>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface LegacyCallAPIOptions {
|
||||
signal?: AbortSignal;
|
||||
wrap401Errors?: boolean;
|
||||
}
|
||||
|
||||
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "kibana" does not have an export "IClusterClient"
|
||||
//
|
||||
// @public (undocumented)
|
||||
export class LegacyClusterClient implements ILegacyClusterClient {
|
||||
constructor(config: LegacyElasticsearchClientConfig, log: Logger, getAuthHeaders?: GetAuthHeaders);
|
||||
asScoped(request?: ScopeableRequest): ILegacyScopedClusterClient;
|
||||
callAsInternalUser: LegacyAPICaller;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
// @internal @deprecated
|
||||
export interface LegacyConfig {
|
||||
// (undocumented)
|
||||
|
@ -1261,6 +1241,28 @@ export interface LegacyConfig {
|
|||
set(config: LegacyVars): void;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type LegacyElasticsearchClientConfig = Pick<ConfigOptions, 'keepAlive' | 'log' | 'plugins'> & Pick<ElasticsearchConfig, 'apiVersion' | 'customHeaders' | 'logQueries' | 'requestHeadersWhitelist' | 'sniffOnStart' | 'sniffOnConnectionFault' | 'hosts' | 'username' | 'password'> & {
|
||||
pingTimeout?: ElasticsearchConfig['pingTimeout'] | ConfigOptions['pingTimeout'];
|
||||
requestTimeout?: ElasticsearchConfig['requestTimeout'] | ConfigOptions['requestTimeout'];
|
||||
sniffInterval?: ElasticsearchConfig['sniffInterval'] | ConfigOptions['sniffInterval'];
|
||||
ssl?: Partial<ElasticsearchConfig['ssl']>;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export interface LegacyElasticsearchError extends Boom {
|
||||
// (undocumented)
|
||||
[code]?: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class LegacyElasticsearchErrorHelpers {
|
||||
// (undocumented)
|
||||
static decorateNotAuthorizedError(error: Error, reason?: string): LegacyElasticsearchError;
|
||||
// (undocumented)
|
||||
static isNotAuthorizedError(error: any): error is LegacyElasticsearchError;
|
||||
}
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "ILegacyInternals" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @internal @deprecated (undocumented)
|
||||
|
@ -1280,6 +1282,15 @@ export class LegacyInternals implements ILegacyInternals {
|
|||
export interface LegacyRequest extends Request {
|
||||
}
|
||||
|
||||
// Warning: (ae-unresolved-inheritdoc-reference) The @inheritDoc reference could not be resolved: The package "kibana" does not have an export "IScopedClusterClient"
|
||||
//
|
||||
// @public (undocumented)
|
||||
export class LegacyScopedClusterClient implements ILegacyScopedClusterClient {
|
||||
constructor(internalAPICaller: LegacyAPICaller, scopedAPICaller: LegacyAPICaller, headers?: Headers | undefined);
|
||||
callAsCurrentUser(endpoint: string, clientParams?: Record<string, any>, options?: LegacyCallAPIOptions): Promise<any>;
|
||||
callAsInternalUser(endpoint: string, clientParams?: Record<string, any>, options?: LegacyCallAPIOptions): Promise<any>;
|
||||
}
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "LegacyPlugins" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @internal @deprecated (undocumented)
|
||||
|
@ -1679,7 +1690,7 @@ export interface RequestHandlerContext {
|
|||
};
|
||||
elasticsearch: {
|
||||
legacy: {
|
||||
client: IScopedClusterClient;
|
||||
client: ILegacyScopedClusterClient;
|
||||
};
|
||||
};
|
||||
uiSettings: {
|
||||
|
@ -2323,7 +2334,7 @@ export class SavedObjectsRepository {
|
|||
// Warning: (ae-forgotten-export) The symbol "KibanaMigrator" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @internal
|
||||
static createRepository(migrator: KibanaMigrator, typeRegistry: SavedObjectTypeRegistry, indexName: string, callCluster: APICaller, includedHiddenTypes?: string[], injectedConstructor?: any): ISavedObjectsRepository;
|
||||
static createRepository(migrator: KibanaMigrator, typeRegistry: SavedObjectTypeRegistry, indexName: string, callCluster: LegacyAPICaller, includedHiddenTypes?: string[], injectedConstructor?: any): ISavedObjectsRepository;
|
||||
delete(type: string, id: string, options?: SavedObjectsDeleteOptions): Promise<{}>;
|
||||
deleteByNamespace(namespace: string, options?: SavedObjectsDeleteByNamespaceOptions): Promise<any>;
|
||||
deleteFromNamespaces(type: string, id: string, namespaces: string[], options?: SavedObjectsDeleteFromNamespacesOptions): Promise<{}>;
|
||||
|
@ -2478,13 +2489,6 @@ export type SavedObjectUnsanitizedDoc<T = unknown> = SavedObjectDoc<T> & Partial
|
|||
// @public
|
||||
export type ScopeableRequest = KibanaRequest | LegacyRequest | FakeRequest;
|
||||
|
||||
// @public
|
||||
export class ScopedClusterClient implements IScopedClusterClient {
|
||||
constructor(internalAPICaller: APICaller, scopedAPICaller: APICaller, headers?: Headers | undefined);
|
||||
callAsCurrentUser(endpoint: string, clientParams?: Record<string, any>, options?: CallAPIOptions): Promise<any>;
|
||||
callAsInternalUser(endpoint: string, clientParams?: Record<string, any>, options?: CallAPIOptions): Promise<any>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export interface ServiceStatus<Meta extends Record<string, any> | unknown = unknown> {
|
||||
detail?: string;
|
||||
|
|
|
@ -25,7 +25,7 @@ import {
|
|||
TestKibanaUtils,
|
||||
TestUtils,
|
||||
} from '../../../../../test_utils/kbn_server';
|
||||
import { APICaller } from '../../../elasticsearch/';
|
||||
import { LegacyAPICaller } from '../../../elasticsearch/';
|
||||
import { httpServerMock } from '../../../http/http_server.mocks';
|
||||
|
||||
let servers: TestUtils;
|
||||
|
@ -37,7 +37,7 @@ let kbnServer: TestKibanaUtils['kbnServer'];
|
|||
interface AllServices {
|
||||
kbnServer: TestKibanaUtils['kbnServer'];
|
||||
savedObjectsClient: SavedObjectsClientContract;
|
||||
callCluster: APICaller;
|
||||
callCluster: LegacyAPICaller;
|
||||
uiSettings: IUiSettingsClient;
|
||||
deleteKibanaIndex: typeof deleteKibanaIndex;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ export async function startServers() {
|
|||
kbnServer = kbn.kbnServer;
|
||||
}
|
||||
|
||||
async function deleteKibanaIndex(callCluster: APICaller) {
|
||||
async function deleteKibanaIndex(callCluster: LegacyAPICaller) {
|
||||
const kibanaIndices = await callCluster('cat.indices', { index: '.kibana*', format: 'json' });
|
||||
const indexNames = kibanaIndices.map((x: any) => x.index);
|
||||
if (!indexNames.length) {
|
||||
|
|
|
@ -19,18 +19,18 @@
|
|||
|
||||
import { Request } from 'hapi';
|
||||
import { errors } from 'elasticsearch';
|
||||
import { CallAPIOptions, ClusterClient, FakeRequest } from 'kibana/server';
|
||||
import { LegacyCallAPIOptions, LegacyClusterClient, FakeRequest } from 'kibana/server';
|
||||
|
||||
export class Cluster {
|
||||
public readonly errors = errors;
|
||||
|
||||
constructor(private readonly clusterClient: ClusterClient) {}
|
||||
constructor(private readonly clusterClient: LegacyClusterClient) {}
|
||||
|
||||
public callWithRequest = async (
|
||||
req: Request | FakeRequest,
|
||||
endpoint: string,
|
||||
clientParams?: Record<string, unknown>,
|
||||
options?: CallAPIOptions
|
||||
options?: LegacyCallAPIOptions
|
||||
) => {
|
||||
return await this.clusterClient
|
||||
.asScoped(req)
|
||||
|
@ -40,7 +40,7 @@ export class Cluster {
|
|||
public callWithInternalUser = async (
|
||||
endpoint: string,
|
||||
clientParams?: Record<string, unknown>,
|
||||
options?: CallAPIOptions
|
||||
options?: LegacyCallAPIOptions
|
||||
) => {
|
||||
return await this.clusterClient.callAsInternalUser(endpoint, clientParams, options);
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
|
||||
import { getFieldCapabilities, resolveTimePattern, createNoMatchingIndicesError } from './lib';
|
||||
|
||||
|
@ -37,9 +37,9 @@ interface FieldSubType {
|
|||
}
|
||||
|
||||
export class IndexPatternsFetcher {
|
||||
private _callDataCluster: APICaller;
|
||||
private _callDataCluster: LegacyAPICaller;
|
||||
|
||||
constructor(callDataCluster: APICaller) {
|
||||
constructor(callDataCluster: LegacyAPICaller) {
|
||||
this._callDataCluster = callDataCluster;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
import { convertEsError } from './errors';
|
||||
import { FieldCapsResponse } from './field_capabilities';
|
||||
|
||||
|
@ -46,7 +46,7 @@ export interface IndexAliasResponse {
|
|||
* @return {Promise<IndexAliasResponse>}
|
||||
*/
|
||||
export async function callIndexAliasApi(
|
||||
callCluster: APICaller,
|
||||
callCluster: LegacyAPICaller,
|
||||
indices: string[] | string
|
||||
): Promise<IndicesAliasResponse> {
|
||||
try {
|
||||
|
@ -71,7 +71,7 @@ export async function callIndexAliasApi(
|
|||
* @param {Array<String>|String} indices
|
||||
* @return {Promise<FieldCapsResponse>}
|
||||
*/
|
||||
export async function callFieldCapsApi(callCluster: APICaller, indices: string[] | string) {
|
||||
export async function callFieldCapsApi(callCluster: LegacyAPICaller, indices: string[] | string) {
|
||||
try {
|
||||
return (await callCluster('fieldCaps', {
|
||||
index: indices,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { defaults, indexBy, sortBy } from 'lodash';
|
||||
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
import { callFieldCapsApi } from '../es_api';
|
||||
import { FieldCapsResponse, readFieldCapsResponse } from './field_caps_response';
|
||||
import { mergeOverrides } from './overrides';
|
||||
|
@ -39,7 +39,7 @@ export function concatIfUniq<T>(arr: T[], value: T) {
|
|||
* @return {Promise<Array<FieldDescriptor>>}
|
||||
*/
|
||||
export async function getFieldCapabilities(
|
||||
callCluster: APICaller,
|
||||
callCluster: LegacyAPICaller,
|
||||
indices: string | string[] = [],
|
||||
metaFields: string[] = []
|
||||
) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import { chain } from 'lodash';
|
||||
import moment from 'moment';
|
||||
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
|
||||
import { timePatternToWildcard } from './time_pattern_to_wildcard';
|
||||
import { callIndexAliasApi, IndicesAliasResponse } from './es_api';
|
||||
|
@ -36,7 +36,7 @@ import { callIndexAliasApi, IndicesAliasResponse } from './es_api';
|
|||
* and the indices that actually match the time
|
||||
* pattern (matches);
|
||||
*/
|
||||
export async function resolveTimePattern(callCluster: APICaller, timePattern: string) {
|
||||
export async function resolveTimePattern(callCluster: LegacyAPICaller, timePattern: string) {
|
||||
const aliases = await callIndexAliasApi(callCluster, timePatternToWildcard(timePattern));
|
||||
|
||||
const allIndexDetails = chain<IndicesAliasResponse>(aliases)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { fetchProvider } from './fetch';
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
|
||||
jest.mock('../../../common', () => ({
|
||||
DEFAULT_QUERY_LANGUAGE: 'lucene',
|
||||
|
@ -28,7 +28,7 @@ jest.mock('../../../common', () => ({
|
|||
}));
|
||||
|
||||
let fetch: ReturnType<typeof fetchProvider>;
|
||||
let callCluster: APICaller;
|
||||
let callCluster: LegacyAPICaller;
|
||||
|
||||
function setupMockCallCluster(
|
||||
optCount: { optInCount?: number; optOutCount?: number } | null,
|
||||
|
@ -78,7 +78,7 @@ function setupMockCallCluster(
|
|||
}
|
||||
|
||||
throw new Error('invalid call');
|
||||
}) as unknown) as APICaller;
|
||||
}) as unknown) as LegacyAPICaller;
|
||||
}
|
||||
|
||||
describe('makeKQLUsageCollector', () => {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { get } from 'lodash';
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
import { DEFAULT_QUERY_LANGUAGE, UI_SETTINGS } from '../../../common';
|
||||
|
||||
const defaultSearchQueryLanguageSetting = DEFAULT_QUERY_LANGUAGE;
|
||||
|
@ -30,7 +30,7 @@ export interface Usage {
|
|||
}
|
||||
|
||||
export function fetchProvider(index: string) {
|
||||
return async (callCluster: APICaller): Promise<Usage> => {
|
||||
return async (callCluster: LegacyAPICaller): Promise<Usage> => {
|
||||
const [response, config] = await Promise.all([
|
||||
callCluster('get', {
|
||||
index,
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
```ts
|
||||
|
||||
import { APICaller as APICaller_2 } from 'kibana/server';
|
||||
import Boom from 'boom';
|
||||
import { BulkIndexDocumentsParams } from 'elasticsearch';
|
||||
import { CatAliasesParams } from 'elasticsearch';
|
||||
|
@ -92,6 +91,7 @@ import { IngestGetPipelineParams } from 'elasticsearch';
|
|||
import { IngestPutPipelineParams } from 'elasticsearch';
|
||||
import { IngestSimulateParams } from 'elasticsearch';
|
||||
import { KibanaConfigType as KibanaConfigType_2 } from 'src/core/server/kibana_config';
|
||||
import { LegacyAPICaller as LegacyAPICaller_2 } from 'kibana/server';
|
||||
import { Logger as Logger_2 } from 'kibana/server';
|
||||
import { MGetParams } from 'elasticsearch';
|
||||
import { MGetResponse } from 'elasticsearch';
|
||||
|
@ -477,7 +477,7 @@ export const indexPatterns: {
|
|||
//
|
||||
// @public (undocumented)
|
||||
export class IndexPatternsFetcher {
|
||||
constructor(callDataCluster: APICaller_2);
|
||||
constructor(callDataCluster: LegacyAPICaller_2);
|
||||
getFieldsForTimePattern(options: {
|
||||
pattern: string;
|
||||
metaFields: string[];
|
||||
|
|
|
@ -26,7 +26,7 @@ import { register, registryFactory, Registry, Fn } from '@kbn/interpreter/common
|
|||
|
||||
import Boom from 'boom';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { CoreSetup, Logger, APICaller } from 'src/core/server';
|
||||
import { CoreSetup, Logger, LegacyAPICaller } from 'src/core/server';
|
||||
import { ExpressionsServerSetupDependencies } from './plugin';
|
||||
import { typeSpecs, ExpressionType } from '../common';
|
||||
import { serializeProvider } from '../common';
|
||||
|
@ -98,7 +98,7 @@ export const createLegacyServerEndpoints = (
|
|||
* @param {*} fnCall - Describes the function being run `{ functionName, args, context }`
|
||||
*/
|
||||
async function runFunction(
|
||||
handlers: { environment: string; elasticsearchClient: APICaller },
|
||||
handlers: { environment: string; elasticsearchClient: LegacyAPICaller },
|
||||
fnCall: any
|
||||
) {
|
||||
const { functionName, args, context } = fnCall;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
import { snakeCase } from 'lodash';
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
|
||||
const TYPES = [
|
||||
'dashboard',
|
||||
|
@ -45,7 +45,7 @@ export interface KibanaSavedObjectCounts {
|
|||
}
|
||||
|
||||
export async function getSavedObjectsCounts(
|
||||
callCluster: APICaller,
|
||||
callCluster: LegacyAPICaller,
|
||||
kibanaIndex: string // Typically '.kibana'. We might need a way to obtain it from the SavedObjects client (or the SavedObjects client to provide a way to run aggregations?)
|
||||
): Promise<KibanaSavedObjectCounts> {
|
||||
const savedObjectCountSearchParams = {
|
||||
|
|
|
@ -29,7 +29,7 @@ import {
|
|||
SavedObjectsClientContract,
|
||||
SavedObjectsClient,
|
||||
CoreStart,
|
||||
ICustomClusterClient,
|
||||
ILegacyCustomClusterClient,
|
||||
} from '../../../core/server';
|
||||
import {
|
||||
getTelemetryOptIn,
|
||||
|
@ -63,7 +63,7 @@ export class FetcherTask {
|
|||
private isSending = false;
|
||||
private internalRepository?: SavedObjectsClientContract;
|
||||
private telemetryCollectionManager?: TelemetryCollectionManagerPluginStart;
|
||||
private elasticsearchClient?: ICustomClusterClient;
|
||||
private elasticsearchClient?: ILegacyCustomClusterClient;
|
||||
|
||||
constructor(initializerContext: PluginInitializerContext<TelemetryConfigType>) {
|
||||
this.config$ = initializerContext.config.create();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
|
||||
// This can be removed when the ES client improves the types
|
||||
export interface ESClusterInfo {
|
||||
|
@ -43,6 +43,6 @@ export interface ESClusterInfo {
|
|||
*
|
||||
* @param {function} callCluster The callWithInternalUser handler (exposed for testing)
|
||||
*/
|
||||
export function getClusterInfo(callCluster: APICaller) {
|
||||
export function getClusterInfo(callCluster: LegacyAPICaller) {
|
||||
return callCluster<ESClusterInfo>('info');
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
*/
|
||||
|
||||
import { ClusterDetailsGetter } from 'src/plugins/telemetry_collection_manager/server';
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
import { TIMEOUT } from './constants';
|
||||
/**
|
||||
* Get the cluster stats from the connected cluster.
|
||||
*
|
||||
* This is the equivalent to GET /_cluster/stats?timeout=30s.
|
||||
*/
|
||||
export async function getClusterStats(callCluster: APICaller) {
|
||||
export async function getClusterStats(callCluster: LegacyAPICaller) {
|
||||
return await callCluster('cluster.stats', {
|
||||
timeout: TIMEOUT,
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { omit } from 'lodash';
|
||||
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
import { StatsCollectionContext } from 'src/plugins/telemetry_collection_manager/server';
|
||||
|
||||
export interface KibanaUsageStats {
|
||||
|
@ -83,7 +83,7 @@ export function handleKibanaStats(
|
|||
|
||||
export async function getKibana(
|
||||
usageCollection: UsageCollectionSetup,
|
||||
callWithInternalUser: APICaller
|
||||
callWithInternalUser: LegacyAPICaller
|
||||
): Promise<KibanaUsageStats> {
|
||||
const usage = await usageCollection.bulkFetch(callWithInternalUser);
|
||||
return usageCollection.toObject(usage);
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
import { ESLicense, LicenseGetter } from 'src/plugins/telemetry_collection_manager/server';
|
||||
|
||||
let cachedLicense: ESLicense | undefined;
|
||||
|
||||
function fetchLicense(callCluster: APICaller, local: boolean) {
|
||||
function fetchLicense(callCluster: LegacyAPICaller, local: boolean) {
|
||||
return callCluster<{ license: ESLicense }>('transport.request', {
|
||||
method: 'GET',
|
||||
path: '/_license',
|
||||
|
@ -41,7 +41,7 @@ function fetchLicense(callCluster: APICaller, local: boolean) {
|
|||
*
|
||||
* Like any X-Pack related API, X-Pack must installed for this to work.
|
||||
*/
|
||||
async function getLicenseFromLocalOrMaster(callCluster: APICaller) {
|
||||
async function getLicenseFromLocalOrMaster(callCluster: LegacyAPICaller) {
|
||||
// Fetching the local license is cheaper than getting it from the master and good enough
|
||||
const { license } = await fetchLicense(callCluster, true).catch(async (err) => {
|
||||
if (cachedLicense) {
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { IClusterClient } from 'kibana/server';
|
||||
import { ILegacyClusterClient } from 'kibana/server';
|
||||
import { TelemetryCollectionManagerPluginSetup } from 'src/plugins/telemetry_collection_manager/server';
|
||||
import { getLocalStats } from './get_local_stats';
|
||||
import { getClusterUuids } from './get_cluster_stats';
|
||||
|
@ -44,7 +44,7 @@ import { getLocalLicense } from './get_local_license';
|
|||
|
||||
export function registerCollection(
|
||||
telemetryCollectionManager: TelemetryCollectionManagerPluginSetup,
|
||||
esCluster: IClusterClient
|
||||
esCluster: ILegacyClusterClient
|
||||
) {
|
||||
telemetryCollectionManager.setCollection({
|
||||
esCluster,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { APICaller, Logger, KibanaRequest, IClusterClient } from 'kibana/server';
|
||||
import { LegacyAPICaller, Logger, KibanaRequest, ILegacyClusterClient } from 'kibana/server';
|
||||
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
|
||||
import { TelemetryCollectionManagerPlugin } from './plugin';
|
||||
|
||||
|
@ -64,7 +64,7 @@ export interface ClusterDetails {
|
|||
|
||||
export interface StatsCollectionConfig {
|
||||
usageCollection: UsageCollectionSetup;
|
||||
callCluster: APICaller;
|
||||
callCluster: LegacyAPICaller;
|
||||
start: string | number;
|
||||
end: string | number;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ export interface CollectionConfig<
|
|||
> {
|
||||
title: string;
|
||||
priority: number;
|
||||
esCluster: IClusterClient;
|
||||
esCluster: ILegacyClusterClient;
|
||||
statsGetter: StatsGetter<CustomContext, T>;
|
||||
clusterDetailsGetter: ClusterDetailsGetter<CustomContext>;
|
||||
licenseGetter: LicenseGetter<CustomContext>;
|
||||
|
@ -144,6 +144,6 @@ export interface Collection<
|
|||
statsGetter: StatsGetter<CustomContext, T>;
|
||||
licenseGetter: LicenseGetter<CustomContext>;
|
||||
clusterDetailsGetter: ClusterDetailsGetter<CustomContext>;
|
||||
esCluster: IClusterClient;
|
||||
esCluster: ILegacyClusterClient;
|
||||
title: string;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Logger, APICaller } from 'kibana/server';
|
||||
import { Logger, LegacyAPICaller } from 'kibana/server';
|
||||
|
||||
export type CollectorFormatForBulkUpload<T, U> = (result: T) => { type: string; payload: U };
|
||||
|
||||
|
@ -48,7 +48,7 @@ export interface CollectorOptions<T = unknown, U = T> {
|
|||
type: string;
|
||||
init?: Function;
|
||||
schema?: MakeSchemaFrom<T>;
|
||||
fetch: (callCluster: APICaller) => Promise<T> | T;
|
||||
fetch: (callCluster: LegacyAPICaller) => Promise<T> | T;
|
||||
/*
|
||||
* A hook for allowing the fetched data payload to be organized into a typed
|
||||
* data model for internal bulk upload. See defaultFormatterForBulkUpload for
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { snakeCase } from 'lodash';
|
||||
import { Logger, APICaller } from 'kibana/server';
|
||||
import { Logger, LegacyAPICaller } from 'kibana/server';
|
||||
import { Collector, CollectorOptions } from './collector';
|
||||
import { UsageCollector } from './usage_collector';
|
||||
|
||||
|
@ -112,7 +112,7 @@ export class CollectorSet {
|
|||
};
|
||||
|
||||
public bulkFetch = async (
|
||||
callCluster: APICaller,
|
||||
callCluster: LegacyAPICaller,
|
||||
collectors: Array<Collector<any, any>> = this.collectors
|
||||
) => {
|
||||
const responses = [];
|
||||
|
@ -140,7 +140,7 @@ export class CollectorSet {
|
|||
return this.makeCollectorSetFromArray(filtered);
|
||||
};
|
||||
|
||||
public bulkFetchUsage = async (callCluster: APICaller) => {
|
||||
public bulkFetchUsage = async (callCluster: LegacyAPICaller) => {
|
||||
const usageCollectors = this.getFilteredCollectorSet((c) => c instanceof UsageCollector);
|
||||
return await this.bulkFetch(callCluster, usageCollectors.collectors);
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
APICaller,
|
||||
LegacyAPICaller,
|
||||
FakeRequest,
|
||||
IUiSettingsClient,
|
||||
SavedObjectsClientContract,
|
||||
|
@ -53,12 +53,12 @@ export type ReqFacade = FakeRequest & {
|
|||
};
|
||||
|
||||
export class AbstractSearchStrategy {
|
||||
public getCallWithRequestInstance: (req: ReqFacade) => APICaller;
|
||||
public getCallWithRequestInstance: (req: ReqFacade) => LegacyAPICaller;
|
||||
public getSearchRequest: (req: ReqFacade) => any;
|
||||
|
||||
constructor(
|
||||
server: any,
|
||||
callWithRequestFactory: (server: any, req: ReqFacade) => APICaller,
|
||||
callWithRequestFactory: (server: any, req: ReqFacade) => LegacyAPICaller,
|
||||
SearchRequest: any
|
||||
) {
|
||||
this.getCallWithRequestInstance = (req) => callWithRequestFactory(server, req);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { APICaller, CoreSetup, Plugin, PluginInitializerContext } from 'kibana/server';
|
||||
import { LegacyAPICaller, CoreSetup, Plugin, PluginInitializerContext } from 'kibana/server';
|
||||
import { UsageCollectionSetup } from '../../../usage_collection/server';
|
||||
import { tsvbTelemetrySavedObjectType } from '../saved_objects';
|
||||
|
||||
|
@ -49,7 +49,7 @@ export class ValidationTelemetryService implements Plugin<ValidationTelemetrySer
|
|||
usageCollection.makeUsageCollector<Usage>({
|
||||
type: 'tsvb-validation',
|
||||
isReady: () => this.kibanaIndex !== '',
|
||||
fetch: async (callCluster: APICaller) => {
|
||||
fetch: async (callCluster: LegacyAPICaller) => {
|
||||
try {
|
||||
const response = await callCluster('get', {
|
||||
index: this.kibanaIndex,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { ElasticsearchServiceStart, IClusterClient } from 'src/core/server';
|
||||
import { ElasticsearchServiceStart, ILegacyClusterClient } from 'src/core/server';
|
||||
import { FrameworkUser } from '../framework/adapter_types';
|
||||
import { internalAuthData } from './../framework/adapter_types';
|
||||
import {
|
||||
|
@ -23,7 +23,7 @@ import {
|
|||
} from './adapter_types';
|
||||
|
||||
export class KibanaDatabaseAdapter implements DatabaseAdapter {
|
||||
private es: IClusterClient;
|
||||
private es: ILegacyClusterClient;
|
||||
|
||||
constructor(elasticsearch: ElasticsearchServiceStart) {
|
||||
this.es = elasticsearch.legacy.client;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
import Boom from 'boom';
|
||||
import {
|
||||
IScopedClusterClient,
|
||||
ILegacyScopedClusterClient,
|
||||
SavedObjectsClientContract,
|
||||
SavedObjectAttributes,
|
||||
SavedObject,
|
||||
|
@ -50,7 +50,7 @@ interface CreateOptions {
|
|||
|
||||
interface ConstructorOptions {
|
||||
defaultKibanaIndex: string;
|
||||
scopedClusterClient: IScopedClusterClient;
|
||||
scopedClusterClient: ILegacyScopedClusterClient;
|
||||
actionTypeRegistry: ActionTypeRegistry;
|
||||
savedObjectsClient: SavedObjectsClientContract;
|
||||
preconfiguredActions: PreConfiguredAction[];
|
||||
|
@ -66,7 +66,7 @@ interface UpdateOptions {
|
|||
|
||||
export class ActionsClient {
|
||||
private readonly defaultKibanaIndex: string;
|
||||
private readonly scopedClusterClient: IScopedClusterClient;
|
||||
private readonly scopedClusterClient: ILegacyScopedClusterClient;
|
||||
private readonly savedObjectsClient: SavedObjectsClientContract;
|
||||
private readonly actionTypeRegistry: ActionTypeRegistry;
|
||||
private readonly preconfiguredActions: PreConfiguredAction[];
|
||||
|
@ -298,7 +298,7 @@ function actionFromSavedObject(savedObject: SavedObject<RawAction>): ActionResul
|
|||
|
||||
async function injectExtraFindData(
|
||||
defaultKibanaIndex: string,
|
||||
scopedClusterClient: IScopedClusterClient,
|
||||
scopedClusterClient: ILegacyScopedClusterClient,
|
||||
actionResults: ActionResult[]
|
||||
): Promise<FindActionResult[]> {
|
||||
const aggs: Record<string, unknown> = {};
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
RequestHandler,
|
||||
IContextProvider,
|
||||
ElasticsearchServiceStart,
|
||||
IClusterClient,
|
||||
ILegacyClusterClient,
|
||||
SavedObjectsClientContract,
|
||||
} from '../../../../src/core/server';
|
||||
|
||||
|
@ -307,7 +307,7 @@ export class ActionsPlugin implements Plugin<Promise<PluginSetupContract>, Plugi
|
|||
return (request) => ({
|
||||
callCluster: elasticsearch.legacy.client.asScoped(request).callAsCurrentUser,
|
||||
savedObjectsClient: getScopedClient(request),
|
||||
getScopedCallCluster(clusterClient: IClusterClient) {
|
||||
getScopedCallCluster(clusterClient: ILegacyClusterClient) {
|
||||
return clusterClient.asScoped(request).callAsCurrentUser;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -9,8 +9,8 @@ import { PluginSetupContract, PluginStartContract } from './plugin';
|
|||
import { ActionsClient } from './actions_client';
|
||||
import { LicenseType } from '../../licensing/common/types';
|
||||
import {
|
||||
IClusterClient,
|
||||
IScopedClusterClient,
|
||||
ILegacyClusterClient,
|
||||
ILegacyScopedClusterClient,
|
||||
KibanaRequest,
|
||||
SavedObjectsClientContract,
|
||||
SavedObjectAttributes,
|
||||
|
@ -23,9 +23,11 @@ export type GetBasePathFunction = (spaceId?: string) => string;
|
|||
export type SpaceIdToNamespaceFunction = (spaceId?: string) => string | undefined;
|
||||
|
||||
export interface Services {
|
||||
callCluster: IScopedClusterClient['callAsCurrentUser'];
|
||||
callCluster: ILegacyScopedClusterClient['callAsCurrentUser'];
|
||||
savedObjectsClient: SavedObjectsClientContract;
|
||||
getScopedCallCluster(clusterClient: IClusterClient): IScopedClusterClient['callAsCurrentUser'];
|
||||
getScopedCallCluster(
|
||||
clusterClient: ILegacyClusterClient
|
||||
): ILegacyScopedClusterClient['callAsCurrentUser'];
|
||||
}
|
||||
|
||||
declare module 'src/core/server' {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { APICaller } from 'kibana/server';
|
||||
import { LegacyAPICaller } from 'kibana/server';
|
||||
|
||||
export async function getTotalCount(callCluster: APICaller, kibanaIndex: string) {
|
||||
export async function getTotalCount(callCluster: LegacyAPICaller, kibanaIndex: string) {
|
||||
const scriptedMetric = {
|
||||
scripted_metric: {
|
||||
init_script: 'state.types = [:]',
|
||||
|
@ -66,7 +66,7 @@ export async function getTotalCount(callCluster: APICaller, kibanaIndex: string)
|
|||
};
|
||||
}
|
||||
|
||||
export async function getInUseTotalCount(callCluster: APICaller, kibanaIndex: string) {
|
||||
export async function getInUseTotalCount(callCluster: LegacyAPICaller, kibanaIndex: string) {
|
||||
const scriptedMetric = {
|
||||
scripted_metric: {
|
||||
init_script: 'state.connectorIds = new HashMap(); state.total = 0;',
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Logger, CoreSetup, APICaller } from 'kibana/server';
|
||||
import { Logger, CoreSetup, LegacyAPICaller } from 'kibana/server';
|
||||
import moment from 'moment';
|
||||
import {
|
||||
RunContext,
|
||||
|
@ -62,7 +62,7 @@ async function scheduleTasks(logger: Logger, taskManager: TaskManagerStartContra
|
|||
export function telemetryTaskRunner(logger: Logger, core: CoreSetup, kibanaIndex: string) {
|
||||
return ({ taskInstance }: RunContext) => {
|
||||
const { state } = taskInstance;
|
||||
const callCluster = (...args: Parameters<APICaller>) => {
|
||||
const callCluster = (...args: Parameters<LegacyAPICaller>) => {
|
||||
return core.getStartServices().then(([{ elasticsearch: { legacy: { client } } }]) =>
|
||||
client.callAsInternalUser(...args)
|
||||
);
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
KibanaRequest,
|
||||
IKibanaResponse,
|
||||
KibanaResponseFactory,
|
||||
IScopedClusterClient,
|
||||
ILegacyScopedClusterClient,
|
||||
} from 'kibana/server';
|
||||
import { Service } from '../../../types';
|
||||
|
||||
|
@ -93,7 +93,7 @@ interface Field {
|
|||
}
|
||||
|
||||
async function getRawFields(
|
||||
dataClient: IScopedClusterClient,
|
||||
dataClient: ILegacyScopedClusterClient,
|
||||
indexes: string[]
|
||||
): Promise<RawFields> {
|
||||
const params = {
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
KibanaRequest,
|
||||
IKibanaResponse,
|
||||
KibanaResponseFactory,
|
||||
IScopedClusterClient,
|
||||
ILegacyScopedClusterClient,
|
||||
} from 'kibana/server';
|
||||
import { SearchResponse } from 'elasticsearch';
|
||||
import { Service } from '../../../types';
|
||||
|
@ -84,7 +84,7 @@ function uniqueCombined(list1: string[], list2: string[], limit: number) {
|
|||
}
|
||||
|
||||
async function getIndicesFromPattern(
|
||||
dataClient: IScopedClusterClient,
|
||||
dataClient: ILegacyScopedClusterClient,
|
||||
pattern: string
|
||||
): Promise<string[]> {
|
||||
const params = {
|
||||
|
@ -114,7 +114,7 @@ async function getIndicesFromPattern(
|
|||
}
|
||||
|
||||
async function getAliasesFromPattern(
|
||||
dataClient: IScopedClusterClient,
|
||||
dataClient: ILegacyScopedClusterClient,
|
||||
pattern: string
|
||||
): Promise<string[]> {
|
||||
const params = {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Logger, ScopedClusterClient } from '../../../../src/core/server';
|
||||
import { Logger, LegacyScopedClusterClient } from '../../../../src/core/server';
|
||||
import { PluginSetupContract as AlertingSetup } from '../../alerts/server';
|
||||
import { getService as getServiceIndexThreshold } from './alert_types/index_threshold';
|
||||
|
||||
|
@ -31,4 +31,4 @@ export interface Service extends IService {
|
|||
logger: Logger;
|
||||
}
|
||||
|
||||
export type CallCluster = ScopedClusterClient['callAsCurrentUser'];
|
||||
export type CallCluster = LegacyScopedClusterClient['callAsCurrentUser'];
|
||||
|
|
|
@ -29,7 +29,7 @@ import {
|
|||
RequestHandler,
|
||||
SharedGlobalConfig,
|
||||
ElasticsearchServiceStart,
|
||||
IClusterClient,
|
||||
ILegacyClusterClient,
|
||||
} from '../../../../src/core/server';
|
||||
|
||||
import {
|
||||
|
@ -273,7 +273,7 @@ export class AlertingPlugin {
|
|||
return (request) => ({
|
||||
callCluster: elasticsearch.legacy.client.asScoped(request).callAsCurrentUser,
|
||||
savedObjectsClient: this.getScopedClientWithAlertSavedObjectType(savedObjects, request),
|
||||
getScopedCallCluster(clusterClient: IClusterClient) {
|
||||
getScopedCallCluster(clusterClient: ILegacyClusterClient) {
|
||||
return clusterClient.asScoped(request).callAsCurrentUser;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
RequestHandlerContext,
|
||||
KibanaRequest,
|
||||
KibanaResponseFactory,
|
||||
IClusterClient,
|
||||
ILegacyClusterClient,
|
||||
} from 'kibana/server';
|
||||
import { identity } from 'lodash';
|
||||
import { httpServerMock } from '../../../../../src/core/server/mocks';
|
||||
|
@ -24,7 +24,7 @@ export function mockHandlerArguments(
|
|||
}: {
|
||||
alertsClient?: AlertsClientMock;
|
||||
listTypes?: AlertType[];
|
||||
esClient?: jest.Mocked<IClusterClient>;
|
||||
esClient?: jest.Mocked<ILegacyClusterClient>;
|
||||
},
|
||||
req: unknown,
|
||||
res?: Array<MethodKeysOf<KibanaResponseFactory>>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue