Skip to content

Commit

Permalink
Move saved object type registration & mapping to NP plugin; normalize…
Browse files Browse the repository at this point in the history
… and prefix saved object type names
  • Loading branch information
jen-huang committed Apr 23, 2020
1 parent 95ac47d commit b6b658e
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 164 deletions.
33 changes: 0 additions & 33 deletions x-pack/legacy/plugins/ingest_manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { resolve } from 'path';
import {
savedObjectMappings,
OUTPUT_SAVED_OBJECT_TYPE,
AGENT_CONFIG_SAVED_OBJECT_TYPE,
DATASOURCE_SAVED_OBJECT_TYPE,
PACKAGES_SAVED_OBJECT_TYPE,
} from '../../../plugins/ingest_manager/server';

// TODO https://github.com/elastic/kibana/issues/46373
// const INDEX_NAMES = {
// INGEST: '.kibana',
// };

export function ingestManager(kibana: any) {
return new kibana.Plugin({
id: 'ingestManager',
publicDir: resolve(__dirname, '../../../plugins/ingest_manager/public'),
uiExports: {
savedObjectSchemas: {
[AGENT_CONFIG_SAVED_OBJECT_TYPE]: {
isNamespaceAgnostic: true,
// indexPattern: INDEX_NAMES.INGEST,
},
[OUTPUT_SAVED_OBJECT_TYPE]: {
isNamespaceAgnostic: true,
// indexPattern: INDEX_NAMES.INGEST,
},
[DATASOURCE_SAVED_OBJECT_TYPE]: {
isNamespaceAgnostic: true,
// indexPattern: INDEX_NAMES.INGEST,
},
[PACKAGES_SAVED_OBJECT_TYPE]: {
isNamespaceAgnostic: true,
// indexPattern: INDEX_NAMES.INGEST,
},
},
mappings: savedObjectMappings,
},
});
}
6 changes: 3 additions & 3 deletions x-pack/plugins/ingest_manager/common/constants/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const AGENT_SAVED_OBJECT_TYPE = 'agents';
export const AGENT_EVENT_SAVED_OBJECT_TYPE = 'agent_events';
export const AGENT_ACTION_SAVED_OBJECT_TYPE = 'agent_actions';
export const AGENT_SAVED_OBJECT_TYPE = 'fleet-agents';
export const AGENT_EVENT_SAVED_OBJECT_TYPE = 'fleet-agent-events';
export const AGENT_ACTION_SAVED_OBJECT_TYPE = 'fleet-agent-actions';

export const AGENT_TYPE_PERMANENT = 'PERMANENT';
export const AGENT_TYPE_EPHEMERAL = 'EPHEMERAL';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import { AgentConfigStatus, DefaultPackages } from '../types';

export const AGENT_CONFIG_SAVED_OBJECT_TYPE = 'agent_configs';
export const AGENT_CONFIG_SAVED_OBJECT_TYPE = 'ingest-agent-configs';

export const DEFAULT_AGENT_CONFIG = {
name: 'Default config',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const DATASOURCE_SAVED_OBJECT_TYPE = 'datasources';
export const DATASOURCE_SAVED_OBJECT_TYPE = 'ingest-datasources';
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE = 'enrollment_api_keys';
export const ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE = 'fleet-enrollment-api-keys';
2 changes: 1 addition & 1 deletion x-pack/plugins/ingest_manager/common/constants/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const PACKAGES_SAVED_OBJECT_TYPE = 'epm-package';
export const PACKAGES_SAVED_OBJECT_TYPE = 'epm-packages';
export const INDEX_PATTERN_SAVED_OBJECT_TYPE = 'index-pattern';
2 changes: 1 addition & 1 deletion x-pack/plugins/ingest_manager/common/constants/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import { OutputType } from '../types';

export const OUTPUT_SAVED_OBJECT_TYPE = 'outputs';
export const OUTPUT_SAVED_OBJECT_TYPE = 'fleet-outputs';

export const DEFAULT_OUTPUT = {
name: 'default',
Expand Down
10 changes: 0 additions & 10 deletions x-pack/plugins/ingest_manager/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,3 @@ export type IngestManagerConfigType = TypeOf<typeof config.schema>;
export const plugin = (initializerContext: PluginInitializerContext) => {
return new IngestManagerPlugin(initializerContext);
};

// Saved object information bootstrapped by legacy `ingest_manager` plugin
// TODO: Remove once saved object mappings can be done from NP
export { savedObjectMappings } from './saved_objects';
export {
OUTPUT_SAVED_OBJECT_TYPE,
AGENT_CONFIG_SAVED_OBJECT_TYPE,
DATASOURCE_SAVED_OBJECT_TYPE,
PACKAGES_SAVED_OBJECT_TYPE,
} from './constants';
3 changes: 2 additions & 1 deletion x-pack/plugins/ingest_manager/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
AGENT_EVENT_SAVED_OBJECT_TYPE,
ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE,
} from './constants';
import { registerEncryptedSavedObjects } from './saved_objects';
import { registerSavedObjects, registerEncryptedSavedObjects } from './saved_objects';
import {
registerEPMRoutes,
registerDatasourceRoutes,
Expand Down Expand Up @@ -101,6 +101,7 @@ export class IngestManagerPlugin
this.security = deps.security;
}

registerSavedObjects(core.savedObjects);
registerEncryptedSavedObjects(deps.encryptedSavedObjects);

// Register feature
Expand Down
Loading

0 comments on commit b6b658e

Please sign in to comment.