Skip to content

Commit

Permalink
Add types to Elasticsearch API calls (#46668)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover authored Oct 7, 2019
1 parent b9bbde6 commit d6410b5
Show file tree
Hide file tree
Showing 59 changed files with 1,267 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [APICaller](./kibana-plugin-server.apicaller.md)

## APICaller type
## APICaller interface


<b>Signature:</b>

```typescript
export declare type APICaller = (endpoint: string, clientParams: Record<string, any>, options?: CallAPIOptions) => Promise<unknown>;
export interface APICaller
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AssistanceAPIResponse](./kibana-plugin-server.assistanceapiresponse.md) &gt; [indices](./kibana-plugin-server.assistanceapiresponse.indices.md)

## AssistanceAPIResponse.indices property

<b>Signature:</b>

```typescript
indices: {
[indexName: string]: {
action_required: MIGRATION_ASSISTANCE_INDEX_ACTION;
};
};
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AssistanceAPIResponse](./kibana-plugin-server.assistanceapiresponse.md)

## AssistanceAPIResponse interface

<b>Signature:</b>

```typescript
export interface AssistanceAPIResponse
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [indices](./kibana-plugin-server.assistanceapiresponse.indices.md) | <code>{</code><br/><code> [indexName: string]: {</code><br/><code> action_required: MIGRATION_ASSISTANCE_INDEX_ACTION;</code><br/><code> };</code><br/><code> }</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AssistantAPIClientParams](./kibana-plugin-server.assistantapiclientparams.md)

## AssistantAPIClientParams interface

<b>Signature:</b>

```typescript
export interface AssistantAPIClientParams extends GenericParams
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [method](./kibana-plugin-server.assistantapiclientparams.method.md) | <code>'GET'</code> | |
| [path](./kibana-plugin-server.assistantapiclientparams.path.md) | <code>'/_migration/assistance'</code> | |
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AssistantAPIClientParams](./kibana-plugin-server.assistantapiclientparams.md) &gt; [method](./kibana-plugin-server.assistantapiclientparams.method.md)

## AssistantAPIClientParams.method property

<b>Signature:</b>

```typescript
method: 'GET';
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AssistantAPIClientParams](./kibana-plugin-server.assistantapiclientparams.md) &gt; [path](./kibana-plugin-server.assistantapiclientparams.path.md)

## AssistantAPIClientParams.path property

<b>Signature:</b>

```typescript
path: '/_migration/assistance';
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Creates an instance of `ScopedClusterClient` based on the configuration the curr
<b>Signature:</b>

```typescript
asScoped(request?: KibanaRequest | LegacyRequest | FakeRequest): ScopedClusterClient;
asScoped(request?: KibanaRequest | LegacyRequest | FakeRequest): IScopedClusterClient;
```

## Parameters
Expand All @@ -20,5 +20,5 @@ asScoped(request?: KibanaRequest | LegacyRequest | FakeRequest): ScopedClusterCl

<b>Returns:</b>

`ScopedClusterClient`
`IScopedClusterClient`

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Calls specified endpoint with provided clientParams on behalf of the Kibana inte
<b>Signature:</b>

```typescript
callAsInternalUser: (endpoint: string, clientParams?: Record<string, any>, options?: CallAPIOptions | undefined) => Promise<any>;
callAsInternalUser: APICaller;
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

Represents an Elasticsearch cluster API client and 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-server.clusterclient.md)<!-- -->.

<b>Signature:</b>

```typescript
export declare class ClusterClient
export declare class ClusterClient implements IClusterClient
```
## Constructors
Expand All @@ -22,7 +24,7 @@ export declare class ClusterClient
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [callAsInternalUser](./kibana-plugin-server.clusterclient.callasinternaluser.md) | | <code>(endpoint: string, clientParams?: Record&lt;string, any&gt;, options?: CallAPIOptions &#124; undefined) =&gt; Promise&lt;any&gt;</code> | Calls specified endpoint with provided clientParams on behalf of the Kibana internal user. |
| [callAsInternalUser](./kibana-plugin-server.clusterclient.callasinternaluser.md) | | <code>APICaller</code> | Calls specified endpoint with provided clientParams on behalf of the Kibana internal user. |
## Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

```typescript
elasticsearch: {
adminClient$: Observable<ClusterClient>;
dataClient$: Observable<ClusterClient>;
createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ClusterClient;
adminClient$: Observable<IClusterClient>;
dataClient$: Observable<IClusterClient>;
createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => IClusterClient;
};
```
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export interface CoreSetup
| Property | Type | Description |
| --- | --- | --- |
| [context](./kibana-plugin-server.coresetup.context.md) | <code>{</code><br/><code> createContextContainer: ContextSetup['createContextContainer'];</code><br/><code> }</code> | |
| [elasticsearch](./kibana-plugin-server.coresetup.elasticsearch.md) | <code>{</code><br/><code> adminClient$: Observable&lt;ClusterClient&gt;;</code><br/><code> dataClient$: Observable&lt;ClusterClient&gt;;</code><br/><code> createClient: (type: string, clientConfig?: Partial&lt;ElasticsearchClientConfig&gt;) =&gt; ClusterClient;</code><br/><code> }</code> | |
| [elasticsearch](./kibana-plugin-server.coresetup.elasticsearch.md) | <code>{</code><br/><code> adminClient$: Observable&lt;IClusterClient&gt;;</code><br/><code> dataClient$: Observable&lt;IClusterClient&gt;;</code><br/><code> createClient: (type: string, clientConfig?: Partial&lt;ElasticsearchClientConfig&gt;) =&gt; IClusterClient;</code><br/><code> }</code> | |
| [http](./kibana-plugin-server.coresetup.http.md) | <code>{</code><br/><code> createCookieSessionStorageFactory: HttpServiceSetup['createCookieSessionStorageFactory'];</code><br/><code> registerOnPreAuth: HttpServiceSetup['registerOnPreAuth'];</code><br/><code> registerAuth: HttpServiceSetup['registerAuth'];</code><br/><code> registerOnPostAuth: HttpServiceSetup['registerOnPostAuth'];</code><br/><code> basePath: HttpServiceSetup['basePath'];</code><br/><code> isTlsEnabled: HttpServiceSetup['isTlsEnabled'];</code><br/><code> registerRouteHandlerContext: &lt;T extends keyof RequestHandlerContext&gt;(name: T, provider: RequestHandlerContextProvider&lt;T&gt;) =&gt; RequestHandlerContextContainer;</code><br/><code> createRouter: () =&gt; IRouter;</code><br/><code> }</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationAPIClientParams](./kibana-plugin-server.deprecationapiclientparams.md)

## DeprecationAPIClientParams interface

<b>Signature:</b>

```typescript
export interface DeprecationAPIClientParams extends GenericParams
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [method](./kibana-plugin-server.deprecationapiclientparams.method.md) | <code>'GET'</code> | |
| [path](./kibana-plugin-server.deprecationapiclientparams.path.md) | <code>'/_migration/deprecations'</code> | |
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationAPIClientParams](./kibana-plugin-server.deprecationapiclientparams.md) &gt; [method](./kibana-plugin-server.deprecationapiclientparams.method.md)

## DeprecationAPIClientParams.method property

<b>Signature:</b>

```typescript
method: 'GET';
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationAPIClientParams](./kibana-plugin-server.deprecationapiclientparams.md) &gt; [path](./kibana-plugin-server.deprecationapiclientparams.path.md)

## DeprecationAPIClientParams.path property

<b>Signature:</b>

```typescript
path: '/_migration/deprecations';
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationAPIResponse](./kibana-plugin-server.deprecationapiresponse.md) &gt; [cluster\_settings](./kibana-plugin-server.deprecationapiresponse.cluster_settings.md)

## DeprecationAPIResponse.cluster\_settings property

<b>Signature:</b>

```typescript
cluster_settings: DeprecationInfo[];
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationAPIResponse](./kibana-plugin-server.deprecationapiresponse.md) &gt; [index\_settings](./kibana-plugin-server.deprecationapiresponse.index_settings.md)

## DeprecationAPIResponse.index\_settings property

<b>Signature:</b>

```typescript
index_settings: IndexSettingsDeprecationInfo;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationAPIResponse](./kibana-plugin-server.deprecationapiresponse.md)

## DeprecationAPIResponse interface

<b>Signature:</b>

```typescript
export interface DeprecationAPIResponse
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [cluster\_settings](./kibana-plugin-server.deprecationapiresponse.cluster_settings.md) | <code>DeprecationInfo[]</code> | |
| [index\_settings](./kibana-plugin-server.deprecationapiresponse.index_settings.md) | <code>IndexSettingsDeprecationInfo</code> | |
| [ml\_settings](./kibana-plugin-server.deprecationapiresponse.ml_settings.md) | <code>DeprecationInfo[]</code> | |
| [node\_settings](./kibana-plugin-server.deprecationapiresponse.node_settings.md) | <code>DeprecationInfo[]</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationAPIResponse](./kibana-plugin-server.deprecationapiresponse.md) &gt; [ml\_settings](./kibana-plugin-server.deprecationapiresponse.ml_settings.md)

## DeprecationAPIResponse.ml\_settings property

<b>Signature:</b>

```typescript
ml_settings: DeprecationInfo[];
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationAPIResponse](./kibana-plugin-server.deprecationapiresponse.md) &gt; [node\_settings](./kibana-plugin-server.deprecationapiresponse.node_settings.md)

## DeprecationAPIResponse.node\_settings property

<b>Signature:</b>

```typescript
node_settings: DeprecationInfo[];
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationInfo](./kibana-plugin-server.deprecationinfo.md) &gt; [details](./kibana-plugin-server.deprecationinfo.details.md)

## DeprecationInfo.details property

<b>Signature:</b>

```typescript
details?: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationInfo](./kibana-plugin-server.deprecationinfo.md) &gt; [level](./kibana-plugin-server.deprecationinfo.level.md)

## DeprecationInfo.level property

<b>Signature:</b>

```typescript
level: MIGRATION_DEPRECATION_LEVEL;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationInfo](./kibana-plugin-server.deprecationinfo.md)

## DeprecationInfo interface

<b>Signature:</b>

```typescript
export interface DeprecationInfo
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [details](./kibana-plugin-server.deprecationinfo.details.md) | <code>string</code> | |
| [level](./kibana-plugin-server.deprecationinfo.level.md) | <code>MIGRATION_DEPRECATION_LEVEL</code> | |
| [message](./kibana-plugin-server.deprecationinfo.message.md) | <code>string</code> | |
| [url](./kibana-plugin-server.deprecationinfo.url.md) | <code>string</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationInfo](./kibana-plugin-server.deprecationinfo.md) &gt; [message](./kibana-plugin-server.deprecationinfo.message.md)

## DeprecationInfo.message property

<b>Signature:</b>

```typescript
message: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [DeprecationInfo](./kibana-plugin-server.deprecationinfo.md) &gt; [url](./kibana-plugin-server.deprecationinfo.url.md)

## DeprecationInfo.url property

<b>Signature:</b>

```typescript
url: string;
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
readonly adminClient$: Observable<ClusterClient>;
readonly adminClient$: Observable<IClusterClient>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Create application specific Elasticsearch cluster API client with customized con
<b>Signature:</b>

```typescript
readonly createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ClusterClient;
readonly createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => IClusterClient;
```

## Example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
readonly dataClient$: Observable<ClusterClient>;
readonly dataClient$: Observable<IClusterClient>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export interface ElasticsearchServiceSetup

| Property | Type | Description |
| --- | --- | --- |
| [adminClient$](./kibana-plugin-server.elasticsearchservicesetup.adminclient_.md) | <code>Observable&lt;ClusterClient&gt;</code> | |
| [createClient](./kibana-plugin-server.elasticsearchservicesetup.createclient.md) | <code>(type: string, clientConfig?: Partial&lt;ElasticsearchClientConfig&gt;) =&gt; ClusterClient</code> | Create application specific Elasticsearch cluster API client with customized config. |
| [dataClient$](./kibana-plugin-server.elasticsearchservicesetup.dataclient_.md) | <code>Observable&lt;ClusterClient&gt;</code> | |
| [adminClient$](./kibana-plugin-server.elasticsearchservicesetup.adminclient_.md) | <code>Observable&lt;IClusterClient&gt;</code> | |
| [createClient](./kibana-plugin-server.elasticsearchservicesetup.createclient.md) | <code>(type: string, clientConfig?: Partial&lt;ElasticsearchClientConfig&gt;) =&gt; IClusterClient</code> | Create application specific Elasticsearch cluster API client with customized config. |
| [dataClient$](./kibana-plugin-server.elasticsearchservicesetup.dataclient_.md) | <code>Observable&lt;IClusterClient&gt;</code> | |
| [legacy](./kibana-plugin-server.elasticsearchservicesetup.legacy.md) | <code>{</code><br/><code> readonly config$: Observable&lt;ElasticsearchConfig&gt;;</code><br/><code> }</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [IClusterClient](./kibana-plugin-server.iclusterclient.md)

## IClusterClient type

Represents an Elasticsearch cluster API client and 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-server.clusterclient.md)<!-- -->.

<b>Signature:</b>

```typescript
export declare type IClusterClient = Pick<ClusterClient, 'callAsInternalUser' | 'close' | 'asScoped'>;
```
Loading

0 comments on commit d6410b5

Please sign in to comment.