-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce
preboot
lifecycle stage (#103636)
- Loading branch information
Showing
194 changed files
with
5,848 additions
and
1,192 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../development/core/server/kibana-plugin-core-server.corepreboot.elasticsearch.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) > [CorePreboot](./kibana-plugin-core-server.corepreboot.md) > [elasticsearch](./kibana-plugin-core-server.corepreboot.elasticsearch.md) | ||
|
||
## CorePreboot.elasticsearch property | ||
|
||
[ElasticsearchServicePreboot](./kibana-plugin-core-server.elasticsearchservicepreboot.md) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
elasticsearch: ElasticsearchServicePreboot; | ||
``` |
13 changes: 13 additions & 0 deletions
13
docs/development/core/server/kibana-plugin-core-server.corepreboot.http.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) > [CorePreboot](./kibana-plugin-core-server.corepreboot.md) > [http](./kibana-plugin-core-server.corepreboot.http.md) | ||
|
||
## CorePreboot.http property | ||
|
||
[HttpServicePreboot](./kibana-plugin-core-server.httpservicepreboot.md) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
http: HttpServicePreboot; | ||
``` |
22 changes: 22 additions & 0 deletions
22
docs/development/core/server/kibana-plugin-core-server.corepreboot.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) > [CorePreboot](./kibana-plugin-core-server.corepreboot.md) | ||
|
||
## CorePreboot interface | ||
|
||
Context passed to the `setup` method of `preboot` plugins. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface CorePreboot | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [elasticsearch](./kibana-plugin-core-server.corepreboot.elasticsearch.md) | <code>ElasticsearchServicePreboot</code> | [ElasticsearchServicePreboot](./kibana-plugin-core-server.elasticsearchservicepreboot.md) | | ||
| [http](./kibana-plugin-core-server.corepreboot.http.md) | <code>HttpServicePreboot</code> | [HttpServicePreboot](./kibana-plugin-core-server.httpservicepreboot.md) | | ||
| [preboot](./kibana-plugin-core-server.corepreboot.preboot.md) | <code>PrebootServicePreboot</code> | [PrebootServicePreboot](./kibana-plugin-core-server.prebootservicepreboot.md) | | ||
|
13 changes: 13 additions & 0 deletions
13
docs/development/core/server/kibana-plugin-core-server.corepreboot.preboot.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) > [CorePreboot](./kibana-plugin-core-server.corepreboot.md) > [preboot](./kibana-plugin-core-server.corepreboot.preboot.md) | ||
|
||
## CorePreboot.preboot property | ||
|
||
[PrebootServicePreboot](./kibana-plugin-core-server.prebootservicepreboot.md) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
preboot: PrebootServicePreboot; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
docs/development/core/server/kibana-plugin-core-server.discoveredplugin.type.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) > [DiscoveredPlugin](./kibana-plugin-core-server.discoveredplugin.md) > [type](./kibana-plugin-core-server.discoveredplugin.type.md) | ||
|
||
## DiscoveredPlugin.type property | ||
|
||
Type of the plugin, defaults to `standard`<!-- -->. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly type: PluginType; | ||
``` |
13 changes: 13 additions & 0 deletions
13
...er/kibana-plugin-core-server.elasticsearchconfigpreboot.credentialsspecified.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) > [ElasticsearchConfigPreboot](./kibana-plugin-core-server.elasticsearchconfigpreboot.md) > [credentialsSpecified](./kibana-plugin-core-server.elasticsearchconfigpreboot.credentialsspecified.md) | ||
|
||
## ElasticsearchConfigPreboot.credentialsSpecified property | ||
|
||
Indicates whether Elasticsearch configuration includes credentials (`username`<!-- -->, `password` or `serviceAccountToken`<!-- -->). | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly credentialsSpecified: boolean; | ||
``` |
13 changes: 13 additions & 0 deletions
13
...pment/core/server/kibana-plugin-core-server.elasticsearchconfigpreboot.hosts.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) > [ElasticsearchConfigPreboot](./kibana-plugin-core-server.elasticsearchconfigpreboot.md) > [hosts](./kibana-plugin-core-server.elasticsearchconfigpreboot.hosts.md) | ||
|
||
## ElasticsearchConfigPreboot.hosts property | ||
|
||
Hosts that the client will connect to. If sniffing is enabled, this list will be used as seeds to discover the rest of your cluster. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly hosts: string[]; | ||
``` |
21 changes: 21 additions & 0 deletions
21
...development/core/server/kibana-plugin-core-server.elasticsearchconfigpreboot.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchConfigPreboot](./kibana-plugin-core-server.elasticsearchconfigpreboot.md) | ||
|
||
## ElasticsearchConfigPreboot interface | ||
|
||
A limited set of Elasticsearch configuration entries exposed to the `preboot` plugins at `setup`<!-- -->. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface ElasticsearchConfigPreboot | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [credentialsSpecified](./kibana-plugin-core-server.elasticsearchconfigpreboot.credentialsspecified.md) | <code>boolean</code> | Indicates whether Elasticsearch configuration includes credentials (<code>username</code>, <code>password</code> or <code>serviceAccountToken</code>). | | ||
| [hosts](./kibana-plugin-core-server.elasticsearchconfigpreboot.hosts.md) | <code>string[]</code> | Hosts that the client will connect to. If sniffing is enabled, this list will be used as seeds to discover the rest of your cluster. | | ||
|
22 changes: 22 additions & 0 deletions
22
...ent/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.config.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) > [ElasticsearchServicePreboot](./kibana-plugin-core-server.elasticsearchservicepreboot.md) > [config](./kibana-plugin-core-server.elasticsearchservicepreboot.config.md) | ||
|
||
## ElasticsearchServicePreboot.config property | ||
|
||
A limited set of Elasticsearch configuration entries. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly config: Readonly<ElasticsearchConfigPreboot>; | ||
``` | ||
|
||
## Example | ||
|
||
|
||
```js | ||
const { hosts, credentialsSpecified } = core.elasticsearch.config; | ||
|
||
``` | ||
|
23 changes: 23 additions & 0 deletions
23
...re/server/kibana-plugin-core-server.elasticsearchservicepreboot.createclient.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchServicePreboot](./kibana-plugin-core-server.elasticsearchservicepreboot.md) > [createClient](./kibana-plugin-core-server.elasticsearchservicepreboot.createclient.md) | ||
|
||
## ElasticsearchServicePreboot.createClient property | ||
|
||
Create application specific Elasticsearch cluster API client with customized config. See [IClusterClient](./kibana-plugin-core-server.iclusterclient.md)<!-- -->. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly createClient: (type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient; | ||
``` | ||
|
||
## Example | ||
|
||
|
||
```js | ||
const client = elasticsearch.createClient('my-app-name', config); | ||
const data = await client.asInternalUser.search(); | ||
|
||
``` | ||
|
20 changes: 20 additions & 0 deletions
20
...evelopment/core/server/kibana-plugin-core-server.elasticsearchservicepreboot.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [ElasticsearchServicePreboot](./kibana-plugin-core-server.elasticsearchservicepreboot.md) | ||
|
||
## ElasticsearchServicePreboot interface | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface ElasticsearchServicePreboot | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [config](./kibana-plugin-core-server.elasticsearchservicepreboot.config.md) | <code>Readonly<ElasticsearchConfigPreboot></code> | A limited set of Elasticsearch configuration entries. | | ||
| [createClient](./kibana-plugin-core-server.elasticsearchservicepreboot.createclient.md) | <code>(type: string, clientConfig?: Partial<ElasticsearchClientConfig>) => ICustomClusterClient</code> | Create application specific Elasticsearch cluster API client with customized config. See [IClusterClient](./kibana-plugin-core-server.iclusterclient.md)<!-- -->. | | ||
|
13 changes: 13 additions & 0 deletions
13
...evelopment/core/server/kibana-plugin-core-server.httpservicepreboot.basepath.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) > [HttpServicePreboot](./kibana-plugin-core-server.httpservicepreboot.md) > [basePath](./kibana-plugin-core-server.httpservicepreboot.basepath.md) | ||
|
||
## HttpServicePreboot.basePath property | ||
|
||
Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-core-server.ibasepath.md)<!-- -->. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
basePath: IBasePath; | ||
``` |
82 changes: 82 additions & 0 deletions
82
docs/development/core/server/kibana-plugin-core-server.httpservicepreboot.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [HttpServicePreboot](./kibana-plugin-core-server.httpservicepreboot.md) | ||
|
||
## HttpServicePreboot interface | ||
|
||
Kibana HTTP Service provides an abstraction to work with the HTTP stack at the `preboot` stage. This functionality allows Kibana to serve user requests even before Kibana becomes fully operational. Only Core and `preboot` plugins can define HTTP routes at this stage. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface HttpServicePreboot | ||
``` | ||
|
||
## Example | ||
|
||
To handle an incoming request in your preboot plugin you should: - Use `@kbn/config-schema` package to create a schema to validate the request `params`<!-- -->, `query`<!-- -->, and `body`<!-- -->. Every incoming request will be validated against the created schema. If validation failed, the request is rejected with `400` status and `Bad request` error without calling the route's handler. To opt out of validating the request, specify `false`<!-- -->. | ||
|
||
```ts | ||
import { schema, TypeOf } from '@kbn/config-schema'; | ||
const validate = { | ||
params: schema.object({ | ||
id: schema.string(), | ||
}), | ||
}; | ||
|
||
``` | ||
- Declare a function to respond to incoming request. The function will receive `request` object containing request details: url, headers, matched route, as well as validated `params`<!-- -->, `query`<!-- -->, `body`<!-- -->. And `response` object instructing HTTP server to create HTTP response with information sent back to the client as the response body, headers, and HTTP status. Any exception raised during the handler call will generate `500 Server error` response and log error details for further investigation. See below for returning custom error responses. | ||
|
||
```ts | ||
const handler = async (context: RequestHandlerContext, request: KibanaRequest, response: ResponseFactory) => { | ||
const data = await findObject(request.params.id); | ||
// creates a command to respond with 'not found' error | ||
if (!data) { | ||
return response.notFound(); | ||
} | ||
// creates a command to send found data to the client and set response headers | ||
return response.ok({ | ||
body: data, | ||
headers: { 'content-type': 'application/json' } | ||
}); | ||
} | ||
|
||
``` | ||
\* - Acquire `preboot` [IRouter](./kibana-plugin-core-server.irouter.md) instance and register route handler for GET request to 'path/<!-- -->{<!-- -->id<!-- -->}<!-- -->' path. | ||
|
||
```ts | ||
import { schema, TypeOf } from '@kbn/config-schema'; | ||
|
||
const validate = { | ||
params: schema.object({ | ||
id: schema.string(), | ||
}), | ||
}; | ||
|
||
httpPreboot.registerRoutes('my-plugin', (router) => { | ||
router.get({ path: 'path/{id}', validate }, async (context, request, response) => { | ||
const data = await findObject(request.params.id); | ||
if (!data) { | ||
return response.notFound(); | ||
} | ||
return response.ok({ | ||
body: data, | ||
headers: { 'content-type': 'application/json' } | ||
}); | ||
}); | ||
}); | ||
|
||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [basePath](./kibana-plugin-core-server.httpservicepreboot.basepath.md) | <code>IBasePath</code> | Access or manipulate the Kibana base path See [IBasePath](./kibana-plugin-core-server.ibasepath.md)<!-- -->. | | ||
|
||
## Methods | ||
|
||
| Method | Description | | ||
| --- | --- | | ||
| [registerRoutes(path, callback)](./kibana-plugin-core-server.httpservicepreboot.registerroutes.md) | Provides ability to acquire <code>preboot</code> [IRouter](./kibana-plugin-core-server.irouter.md) instance for a particular top-level path and register handler functions for any number of nested routes. | | ||
|
40 changes: 40 additions & 0 deletions
40
...ment/core/server/kibana-plugin-core-server.httpservicepreboot.registerroutes.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [HttpServicePreboot](./kibana-plugin-core-server.httpservicepreboot.md) > [registerRoutes](./kibana-plugin-core-server.httpservicepreboot.registerroutes.md) | ||
|
||
## HttpServicePreboot.registerRoutes() method | ||
|
||
Provides ability to acquire `preboot` [IRouter](./kibana-plugin-core-server.irouter.md) instance for a particular top-level path and register handler functions for any number of nested routes. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
registerRoutes(path: string, callback: (router: IRouter) => void): void; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| path | <code>string</code> | | | ||
| callback | <code>(router: IRouter) => void</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`void` | ||
|
||
## Remarks | ||
|
||
Each route can have only one handler function, which is executed when the route is matched. See the [IRouter](./kibana-plugin-core-server.irouter.md) documentation for more information. | ||
|
||
## Example | ||
|
||
|
||
```ts | ||
registerRoutes('my-plugin', (router) => { | ||
// handler is called when '/my-plugin/path' resource is requested with `GET` method | ||
router.get({ path: '/path', validate: false }, (context, req, res) => res.ok({ content: 'ok' })); | ||
}); | ||
|
||
``` | ||
|
Oops, something went wrong.