mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Alerting] Export rules and connectors (#98802)
* Adding importableAndExportable but hidden saved object types to saved object feature privilege * Adding helper function for transforming rule for export. Added audit logging * Adding helper function for transforming rule for export. Added audit logging * Adding unit test for transforming rules for export * Exporting connectors * Removing auditing during export * Adding import/export to docs * PR fixes * Using action type validation onExport * Fixing logic for connectors with optional secrets * Fixing logic for connectors with optional secrets Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
0d7a5826a4
commit
4ab86c77d4
11 changed files with 495 additions and 7 deletions
|
@ -27,6 +27,20 @@ describe('Features Plugin', () => {
|
|||
namespaceType: 'single' as 'single',
|
||||
},
|
||||
]);
|
||||
typeRegistry.getImportableAndExportableTypes.mockReturnValue([
|
||||
{
|
||||
name: 'hidden-importableAndExportable',
|
||||
hidden: true,
|
||||
mappings: { properties: {} },
|
||||
namespaceType: 'single' as 'single',
|
||||
},
|
||||
{
|
||||
name: 'not-hidden-importableAndExportable',
|
||||
hidden: false,
|
||||
mappings: { properties: {} },
|
||||
namespaceType: 'single' as 'single',
|
||||
},
|
||||
]);
|
||||
coreStart.savedObjects.getTypeRegistry.mockReturnValue(typeRegistry);
|
||||
});
|
||||
|
||||
|
@ -87,7 +101,9 @@ describe('Features Plugin', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
it('registers kibana features with not hidden saved objects types', async () => {
|
||||
it('registers kibana features with visible saved objects types and hidden saved object types that are importable and exportable', async () => {
|
||||
typeRegistry.isHidden.mockReturnValueOnce(true);
|
||||
typeRegistry.isHidden.mockReturnValueOnce(false);
|
||||
const plugin = new FeaturesPlugin(initContext);
|
||||
await plugin.setup(coreSetup, {});
|
||||
const { getKibanaFeatures } = plugin.start(coreStart);
|
||||
|
@ -98,6 +114,8 @@ describe('Features Plugin', () => {
|
|||
|
||||
expect(soTypes.includes('foo')).toBe(true);
|
||||
expect(soTypes.includes('bar')).toBe(false);
|
||||
expect(soTypes.includes('hidden-importableAndExportable')).toBe(true);
|
||||
expect(soTypes.includes('not-hidden-importableAndExportable')).toBe(false);
|
||||
});
|
||||
|
||||
it('returns registered elasticsearch features', async () => {
|
||||
|
|
|
@ -128,7 +128,15 @@ export class FeaturesPlugin
|
|||
|
||||
private registerOssFeatures(savedObjects: SavedObjectsServiceStart) {
|
||||
const registry = savedObjects.getTypeRegistry();
|
||||
const savedObjectTypes = registry.getVisibleTypes().map((t) => t.name);
|
||||
const savedObjectVisibleTypes = registry.getVisibleTypes().map((t) => t.name);
|
||||
const savedObjectImportableAndExportableHiddenTypes = registry
|
||||
.getImportableAndExportableTypes()
|
||||
.filter((t) => registry.isHidden(t.name))
|
||||
.map((t) => t.name);
|
||||
|
||||
const savedObjectTypes = Array.from(
|
||||
new Set([...savedObjectVisibleTypes, ...savedObjectImportableAndExportableHiddenTypes])
|
||||
);
|
||||
|
||||
this.logger.debug(
|
||||
`Registering OSS features with SO types: ${savedObjectTypes.join(', ')}. "includeTimelion": ${
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue