-
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.
add
isExportable
SO export API (#101860)
* add `isExportable` SO export API * add warning when export contains excluded objects * add FTR test * fix API integration assertions * lint * fix assertions again * doc * update generated doc * fix esarchiver paths * use maps instead of objects * SavedObjectsExportablePredicate is no longer async * more docs * generated doc * use info instead of warning when export contains excluded objects * try/catch on isExportable call and add exclusion reason * add FTR test for errored objects * log error if isExportable throws
- Loading branch information
1 parent
693823f
commit 59d7f33
Showing
46 changed files
with
1,968 additions
and
345 deletions.
There are no files selected for viewing
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
...nt/core/server/kibana-plugin-core-server.savedobjectsexportexcludedobject.id.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) > [SavedObjectsExportExcludedObject](./kibana-plugin-core-server.savedobjectsexportexcludedobject.md) > [id](./kibana-plugin-core-server.savedobjectsexportexcludedobject.id.md) | ||
|
||
## SavedObjectsExportExcludedObject.id property | ||
|
||
id of the excluded object | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
id: string; | ||
``` |
21 changes: 21 additions & 0 deletions
21
...pment/core/server/kibana-plugin-core-server.savedobjectsexportexcludedobject.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) > [SavedObjectsExportExcludedObject](./kibana-plugin-core-server.savedobjectsexportexcludedobject.md) | ||
|
||
## SavedObjectsExportExcludedObject interface | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface SavedObjectsExportExcludedObject | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [id](./kibana-plugin-core-server.savedobjectsexportexcludedobject.id.md) | <code>string</code> | id of the excluded object | | ||
| [reason](./kibana-plugin-core-server.savedobjectsexportexcludedobject.reason.md) | <code>string</code> | optional cause of the exclusion | | ||
| [type](./kibana-plugin-core-server.savedobjectsexportexcludedobject.type.md) | <code>string</code> | type of the excluded object | | ||
|
13 changes: 13 additions & 0 deletions
13
...ore/server/kibana-plugin-core-server.savedobjectsexportexcludedobject.reason.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) > [SavedObjectsExportExcludedObject](./kibana-plugin-core-server.savedobjectsexportexcludedobject.md) > [reason](./kibana-plugin-core-server.savedobjectsexportexcludedobject.reason.md) | ||
|
||
## SavedObjectsExportExcludedObject.reason property | ||
|
||
optional cause of the exclusion | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
reason?: string; | ||
``` |
13 changes: 13 additions & 0 deletions
13
.../core/server/kibana-plugin-core-server.savedobjectsexportexcludedobject.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) > [SavedObjectsExportExcludedObject](./kibana-plugin-core-server.savedobjectsexportexcludedobject.md) > [type](./kibana-plugin-core-server.savedobjectsexportexcludedobject.type.md) | ||
|
||
## SavedObjectsExportExcludedObject.type property | ||
|
||
type of the excluded object | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
type: string; | ||
``` |
13 changes: 13 additions & 0 deletions
13
...er/kibana-plugin-core-server.savedobjectsexportresultdetails.excludedobjects.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) > [SavedObjectsExportResultDetails](./kibana-plugin-core-server.savedobjectsexportresultdetails.md) > [excludedObjects](./kibana-plugin-core-server.savedobjectsexportresultdetails.excludedobjects.md) | ||
|
||
## SavedObjectsExportResultDetails.excludedObjects property | ||
|
||
excluded objects details | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
excludedObjects: SavedObjectsExportExcludedObject[]; | ||
``` |
13 changes: 13 additions & 0 deletions
13
...bana-plugin-core-server.savedobjectsexportresultdetails.excludedobjectscount.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) > [SavedObjectsExportResultDetails](./kibana-plugin-core-server.savedobjectsexportresultdetails.md) > [excludedObjectsCount](./kibana-plugin-core-server.savedobjectsexportresultdetails.excludedobjectscount.md) | ||
|
||
## SavedObjectsExportResultDetails.excludedObjectsCount property | ||
|
||
number of objects that were excluded from the export | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
excludedObjectsCount: number; | ||
``` |
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
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
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
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
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
49 changes: 49 additions & 0 deletions
49
.../kibana-plugin-core-server.savedobjectstypemanagementdefinition.isexportable.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,49 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsTypeManagementDefinition](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.md) > [isExportable](./kibana-plugin-core-server.savedobjectstypemanagementdefinition.isexportable.md) | ||
|
||
## SavedObjectsTypeManagementDefinition.isExportable property | ||
|
||
Optional hook to specify whether an object should be exportable. | ||
|
||
If specified, `isExportable` will be called during export for each of this type's objects in the export, and the ones not matching the predicate will be excluded from the export. | ||
|
||
When implementing both `isExportable` and `onExport`<!-- -->, it is mandatory that `isExportable` returns the same value for an object before and after going though the export transform. E.g `isExportable(objectBeforeTransform) === isExportable(objectAfterTransform)` | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
isExportable?: SavedObjectsExportablePredicate<Attributes>; | ||
``` | ||
|
||
## Remarks | ||
|
||
`importableAndExportable` must be `true` to specify this property. | ||
|
||
## Example | ||
|
||
Registering a type with a per-object exportability predicate | ||
|
||
```ts | ||
// src/plugins/my_plugin/server/plugin.ts | ||
import { myType } from './saved_objects'; | ||
|
||
export class Plugin() { | ||
setup: (core: CoreSetup) => { | ||
core.savedObjects.registerType({ | ||
...myType, | ||
management: { | ||
...myType.management, | ||
isExportable: (object) => { | ||
if (object.attributes.myCustomAttr === 'foo') { | ||
return false; | ||
} | ||
return true; | ||
} | ||
}, | ||
}); | ||
} | ||
} | ||
|
||
``` | ||
|
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
Oops, something went wrong.