Skip to content

Commit

Permalink
[Core] create deprecations service (#94845)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
Bamieh and kibanamachine committed Mar 30, 2021
1 parent ceb4c9a commit a67aa97
Show file tree
Hide file tree
Showing 102 changed files with 3,262 additions and 347 deletions.
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) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [CoreStart](./kibana-plugin-core-public.corestart.md) &gt; [deprecations](./kibana-plugin-core-public.corestart.deprecations.md)

## CoreStart.deprecations property

[DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md)

<b>Signature:</b>

```typescript
deprecations: DeprecationsServiceStart;
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface CoreStart
| --- | --- | --- |
| [application](./kibana-plugin-core-public.corestart.application.md) | <code>ApplicationStart</code> | [ApplicationStart](./kibana-plugin-core-public.applicationstart.md) |
| [chrome](./kibana-plugin-core-public.corestart.chrome.md) | <code>ChromeStart</code> | [ChromeStart](./kibana-plugin-core-public.chromestart.md) |
| [deprecations](./kibana-plugin-core-public.corestart.deprecations.md) | <code>DeprecationsServiceStart</code> | [DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md) |
| [docLinks](./kibana-plugin-core-public.corestart.doclinks.md) | <code>DocLinksStart</code> | [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) |
| [fatalErrors](./kibana-plugin-core-public.corestart.fatalerrors.md) | <code>FatalErrorsStart</code> | [FatalErrorsStart](./kibana-plugin-core-public.fatalerrorsstart.md) |
| [http](./kibana-plugin-core-public.corestart.http.md) | <code>HttpStart</code> | [HttpStart](./kibana-plugin-core-public.httpstart.md) |
Expand Down
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) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md) &gt; [getAllDeprecations](./kibana-plugin-core-public.deprecationsservicestart.getalldeprecations.md)

## DeprecationsServiceStart.getAllDeprecations property

Grabs deprecations details for all domains.

<b>Signature:</b>

```typescript
getAllDeprecations: () => Promise<DomainDeprecationDetails[]>;
```
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) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md) &gt; [getDeprecations](./kibana-plugin-core-public.deprecationsservicestart.getdeprecations.md)

## DeprecationsServiceStart.getDeprecations property

Grabs deprecations for a specific domain.

<b>Signature:</b>

```typescript
getDeprecations: (domainId: string) => Promise<DomainDeprecationDetails[]>;
```
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) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md) &gt; [isDeprecationResolvable](./kibana-plugin-core-public.deprecationsservicestart.isdeprecationresolvable.md)

## DeprecationsServiceStart.isDeprecationResolvable property

Returns a boolean if the provided deprecation can be automatically resolvable.

<b>Signature:</b>

```typescript
isDeprecationResolvable: (details: DomainDeprecationDetails) => boolean;
```
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) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md)

## DeprecationsServiceStart interface

DeprecationsService provides methods to fetch domain deprecation details from the Kibana server.

<b>Signature:</b>

```typescript
export interface DeprecationsServiceStart
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [getAllDeprecations](./kibana-plugin-core-public.deprecationsservicestart.getalldeprecations.md) | <code>() =&gt; Promise&lt;DomainDeprecationDetails[]&gt;</code> | Grabs deprecations details for all domains. |
| [getDeprecations](./kibana-plugin-core-public.deprecationsservicestart.getdeprecations.md) | <code>(domainId: string) =&gt; Promise&lt;DomainDeprecationDetails[]&gt;</code> | Grabs deprecations for a specific domain. |
| [isDeprecationResolvable](./kibana-plugin-core-public.deprecationsservicestart.isdeprecationresolvable.md) | <code>(details: DomainDeprecationDetails) =&gt; boolean</code> | Returns a boolean if the provided deprecation can be automatically resolvable. |
| [resolveDeprecation](./kibana-plugin-core-public.deprecationsservicestart.resolvedeprecation.md) | <code>(details: DomainDeprecationDetails) =&gt; Promise&lt;ResolveDeprecationResponse&gt;</code> | Calls the correctiveActions.api to automatically resolve the depprecation. |

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) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md) &gt; [resolveDeprecation](./kibana-plugin-core-public.deprecationsservicestart.resolvedeprecation.md)

## DeprecationsServiceStart.resolveDeprecation property

Calls the correctiveActions.api to automatically resolve the depprecation.

<b>Signature:</b>

```typescript
resolveDeprecation: (details: DomainDeprecationDetails) => Promise<ResolveDeprecationResponse>;
```
2 changes: 2 additions & 0 deletions docs/development/core/public/kibana-plugin-core-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [ChromeUserBanner](./kibana-plugin-core-public.chromeuserbanner.md) | |
| [CoreSetup](./kibana-plugin-core-public.coresetup.md) | Core services exposed to the <code>Plugin</code> setup lifecycle |
| [CoreStart](./kibana-plugin-core-public.corestart.md) | Core services exposed to the <code>Plugin</code> start lifecycle |
| [DeprecationsServiceStart](./kibana-plugin-core-public.deprecationsservicestart.md) | DeprecationsService provides methods to fetch domain deprecation details from the Kibana server. |
| [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | |
| [ErrorToastOptions](./kibana-plugin-core-public.errortoastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) error APIs. |
| [FatalErrorInfo](./kibana-plugin-core-public.fatalerrorinfo.md) | Represents the <code>message</code> and <code>stack</code> of a fatal Error |
Expand Down Expand Up @@ -164,6 +165,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [PublicAppMetaInfo](./kibana-plugin-core-public.publicappmetainfo.md) | Public information about a registered app's [keywords](./kibana-plugin-core-public.appmeta.md) |
| [PublicAppSearchDeepLinkInfo](./kibana-plugin-core-public.publicappsearchdeeplinkinfo.md) | Public information about a registered app's [searchDeepLinks](./kibana-plugin-core-public.appsearchdeeplink.md) |
| [PublicUiSettingsParams](./kibana-plugin-core-public.publicuisettingsparams.md) | A sub-set of [UiSettingsParams](./kibana-plugin-core-public.uisettingsparams.md) exposed to the client-side. |
| [ResolveDeprecationResponse](./kibana-plugin-core-public.resolvedeprecationresponse.md) | |
| [SavedObjectAttribute](./kibana-plugin-core-public.savedobjectattribute.md) | Type definition for a Saved Object attribute value |
| [SavedObjectAttributeSingle](./kibana-plugin-core-public.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-core-public.savedobjectattribute.md) |
| [SavedObjectsClientContract](./kibana-plugin-core-public.savedobjectsclientcontract.md) | SavedObjectsClientContract as implemented by the [SavedObjectsClient](./kibana-plugin-core-public.savedobjectsclient.md) |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [ResolveDeprecationResponse](./kibana-plugin-core-public.resolvedeprecationresponse.md)

## ResolveDeprecationResponse type

<b>Signature:</b>

```typescript
export declare type ResolveDeprecationResponse = {
status: 'ok';
} | {
status: 'fail';
reason: string;
};
```
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) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [CoreSetup](./kibana-plugin-core-server.coresetup.md) &gt; [deprecations](./kibana-plugin-core-server.coresetup.deprecations.md)

## CoreSetup.deprecations property

[DeprecationsServiceSetup](./kibana-plugin-core-server.deprecationsservicesetup.md)

<b>Signature:</b>

```typescript
deprecations: DeprecationsServiceSetup;
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface CoreSetup<TPluginsStart extends object = object, TStart = unkno
| --- | --- | --- |
| [capabilities](./kibana-plugin-core-server.coresetup.capabilities.md) | <code>CapabilitiesSetup</code> | [CapabilitiesSetup](./kibana-plugin-core-server.capabilitiessetup.md) |
| [context](./kibana-plugin-core-server.coresetup.context.md) | <code>ContextSetup</code> | [ContextSetup](./kibana-plugin-core-server.contextsetup.md) |
| [deprecations](./kibana-plugin-core-server.coresetup.deprecations.md) | <code>DeprecationsServiceSetup</code> | [DeprecationsServiceSetup](./kibana-plugin-core-server.deprecationsservicesetup.md) |
| [elasticsearch](./kibana-plugin-core-server.coresetup.elasticsearch.md) | <code>ElasticsearchServiceSetup</code> | [ElasticsearchServiceSetup](./kibana-plugin-core-server.elasticsearchservicesetup.md) |
| [getStartServices](./kibana-plugin-core-server.coresetup.getstartservices.md) | <code>StartServicesAccessor&lt;TPluginsStart, TStart&gt;</code> | [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md) |
| [http](./kibana-plugin-core-server.coresetup.http.md) | <code>HttpServiceSetup &amp; {</code><br/><code> resources: HttpResources;</code><br/><code> }</code> | [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) |
Expand Down
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) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [correctiveActions](./kibana-plugin-core-server.deprecationsdetails.correctiveactions.md)

## DeprecationsDetails.correctiveActions property

<b>Signature:</b>

```typescript
correctiveActions: {
api?: {
path: string;
method: 'POST' | 'PUT';
body?: {
[key: string]: any;
};
};
manualSteps?: 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-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [documentationUrl](./kibana-plugin-core-server.deprecationsdetails.documentationurl.md)

## DeprecationsDetails.documentationUrl property

<b>Signature:</b>

```typescript
documentationUrl?: string;
```
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) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [level](./kibana-plugin-core-server.deprecationsdetails.level.md)

## DeprecationsDetails.level property

levels: - warning: will not break deployment upon upgrade - critical: needs to be addressed before upgrade. - fetch\_error: Deprecations service failed to grab the deprecation details for the domain.

<b>Signature:</b>

```typescript
level: 'warning' | 'critical' | 'fetch_error';
```
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-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md)

## DeprecationsDetails interface

<b>Signature:</b>

```typescript
export interface DeprecationsDetails
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [correctiveActions](./kibana-plugin-core-server.deprecationsdetails.correctiveactions.md) | <code>{</code><br/><code> api?: {</code><br/><code> path: string;</code><br/><code> method: 'POST' &#124; 'PUT';</code><br/><code> body?: {</code><br/><code> [key: string]: any;</code><br/><code> };</code><br/><code> };</code><br/><code> manualSteps?: string[];</code><br/><code> }</code> | |
| [documentationUrl](./kibana-plugin-core-server.deprecationsdetails.documentationurl.md) | <code>string</code> | |
| [level](./kibana-plugin-core-server.deprecationsdetails.level.md) | <code>'warning' &#124; 'critical' &#124; 'fetch_error'</code> | levels: - warning: will not break deployment upon upgrade - critical: needs to be addressed before upgrade. - fetch\_error: Deprecations service failed to grab the deprecation details for the domain. |
| [message](./kibana-plugin-core-server.deprecationsdetails.message.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-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsDetails](./kibana-plugin-core-server.deprecationsdetails.md) &gt; [message](./kibana-plugin-core-server.deprecationsdetails.message.md)

## DeprecationsDetails.message property

<b>Signature:</b>

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

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsServiceSetup](./kibana-plugin-core-server.deprecationsservicesetup.md)

## DeprecationsServiceSetup interface

The deprecations service provides a way for the Kibana platform to communicate deprecated features and configs with its users. These deprecations are only communicated if the deployment is using these features. Allowing for a user tailored experience for upgrading the stack version.

The Deprecation service is consumed by the upgrade assistant to assist with the upgrade experience.

If a deprecated feature can be resolved without manual user intervention. Using correctiveActions.api allows the Upgrade Assistant to use this api to correct the deprecation upon a user trigger.

<b>Signature:</b>

```typescript
export interface DeprecationsServiceSetup
```

## Example


```ts
import { DeprecationsDetails, GetDeprecationsContext, CoreSetup } from 'src/core/server';

async function getDeprecations({ esClient, savedObjectsClient }: GetDeprecationsContext): Promise<DeprecationsDetails[]> {
const deprecations: DeprecationsDetails[] = [];
const count = await getTimelionSheetsCount(savedObjectsClient);

if (count > 0) {
// Example of a manual correctiveAction
deprecations.push({
message: `You have ${count} Timelion worksheets. The Timelion app will be removed in 8.0. To continue using your Timelion worksheets, migrate them to a dashboard.`,
documentationUrl:
'https://www.elastic.co/guide/en/kibana/current/create-panels-with-timelion.html',
level: 'warning',
correctiveActions: {
manualSteps: [
'Navigate to the Kibana Dashboard and click "Create dashboard".',
'Select Timelion from the "New Visualization" window.',
'Open a new tab, open the Timelion app, select the chart you want to copy, then copy the chart expression.',
'Go to Timelion, paste the chart expression in the Timelion expression field, then click Update.',
'In the toolbar, click Save.',
'On the Save visualization window, enter the visualization Title, then click Save and return.',
],
},
});
}

// Example of an api correctiveAction
deprecations.push({
"message": "User 'test_dashboard_user' is using a deprecated role: 'kibana_user'",
"documentationUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html",
"level": "critical",
"correctiveActions": {
"api": {
"path": "/internal/security/users/test_dashboard_user",
"method": "POST",
"body": {
"username": "test_dashboard_user",
"roles": [
"machine_learning_user",
"enrich_user",
"kibana_admin"
],
"full_name": "Alison Goryachev",
"email": "alisongoryachev@gmail.com",
"metadata": {},
"enabled": true
}
},
"manualSteps": [
"Using Kibana user management, change all users using the kibana_user role to the kibana_admin role.",
"Using Kibana role-mapping management, change all role-mappings which assing the kibana_user role to the kibana_admin role."
]
},
});

return deprecations;
}


export class Plugin() {
setup: (core: CoreSetup) => {
core.deprecations.registerDeprecations({ getDeprecations });
}
}

```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [registerDeprecations](./kibana-plugin-core-server.deprecationsservicesetup.registerdeprecations.md) | <code>(deprecationContext: RegisterDeprecationsConfig) =&gt; void</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-core-server](./kibana-plugin-core-server.md) &gt; [DeprecationsServiceSetup](./kibana-plugin-core-server.deprecationsservicesetup.md) &gt; [registerDeprecations](./kibana-plugin-core-server.deprecationsservicesetup.registerdeprecations.md)

## DeprecationsServiceSetup.registerDeprecations property

<b>Signature:</b>

```typescript
registerDeprecations: (deprecationContext: RegisterDeprecationsConfig) => void;
```
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-core-server](./kibana-plugin-core-server.md) &gt; [GetDeprecationsContext](./kibana-plugin-core-server.getdeprecationscontext.md) &gt; [esClient](./kibana-plugin-core-server.getdeprecationscontext.esclient.md)

## GetDeprecationsContext.esClient property

<b>Signature:</b>

```typescript
esClient: IScopedClusterClient;
```
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-core-server](./kibana-plugin-core-server.md) &gt; [GetDeprecationsContext](./kibana-plugin-core-server.getdeprecationscontext.md)

## GetDeprecationsContext interface

<b>Signature:</b>

```typescript
export interface GetDeprecationsContext
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [esClient](./kibana-plugin-core-server.getdeprecationscontext.esclient.md) | <code>IScopedClusterClient</code> | |
| [savedObjectsClient](./kibana-plugin-core-server.getdeprecationscontext.savedobjectsclient.md) | <code>SavedObjectsClientContract</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-core-server](./kibana-plugin-core-server.md) &gt; [GetDeprecationsContext](./kibana-plugin-core-server.getdeprecationscontext.md) &gt; [savedObjectsClient](./kibana-plugin-core-server.getdeprecationscontext.savedobjectsclient.md)

## GetDeprecationsContext.savedObjectsClient property

<b>Signature:</b>

```typescript
savedObjectsClient: SavedObjectsClientContract;
```
Loading

0 comments on commit a67aa97

Please sign in to comment.