From 28fd8749c1613bef09de27a394319dc45d77b51e Mon Sep 17 00:00:00 2001 From: neptunian Date: Mon, 10 Feb 2020 10:58:53 +0000 Subject: [PATCH] move AssetType to IngestAsset type from ingest plugin --- .../ingest_manager/common/types/models/epm.ts | 13 ++++++++++++- .../ingest_manager/common/types/models/index.ts | 1 + .../ingest_pipeline/ingest_pipelines.ts | 10 +++++++--- .../services/epm/elasticsearch/template/install.ts | 10 +++++++--- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/ingest_manager/common/types/models/epm.ts b/x-pack/plugins/ingest_manager/common/types/models/epm.ts index c17dee530e5c1..89983ccb2998b 100644 --- a/x-pack/plugins/ingest_manager/common/types/models/epm.ts +++ b/x-pack/plugins/ingest_manager/common/types/models/epm.ts @@ -11,7 +11,6 @@ import { SavedObjectAttributes, SavedObjectReference, } from '../../../../../../src/core/public'; -import { AssetType as IngestAssetType } from '../../../../../legacy/plugins/ingest/common/types/domain_data'; export enum InstallationStatus { installed = 'installed', @@ -169,3 +168,15 @@ export type NotInstalled = T & { export type AssetReference = Pick & { type: AssetType | IngestAssetType; }; + +/** + * Types of assets which can be installed/removed + */ +export enum IngestAssetType { + DataFrameTransform = 'data-frame-transform', + IlmPolicy = 'ilm-policy', + IndexTemplate = 'index-template', + IngestPipeline = 'ingest-pipeline', + MlJob = 'ml-job', + RollupJob = 'rollup-job', +} diff --git a/x-pack/plugins/ingest_manager/common/types/models/index.ts b/x-pack/plugins/ingest_manager/common/types/models/index.ts index 959dfe1d937b9..02a12efb96a7d 100644 --- a/x-pack/plugins/ingest_manager/common/types/models/index.ts +++ b/x-pack/plugins/ingest_manager/common/types/models/index.ts @@ -6,3 +6,4 @@ export * from './agent_config'; export * from './datasource'; export * from './output'; +export * from './epm'; diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/ingest_pipelines.ts b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/ingest_pipelines.ts index e7b338da70d47..047ee530d527e 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/ingest_pipelines.ts +++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/ingest_pipeline/ingest_pipelines.ts @@ -4,8 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { AssetType } from '../../../../../../../legacy/plugins/ingest/common/types/domain_data'; -import { AssetReference, Dataset, ElasticsearchAssetType } from '../../../../../common/types'; +import { + AssetReference, + Dataset, + ElasticsearchAssetType, + IngestAssetType, +} from '../../../../../common/types'; import * as Registry from '../../registry'; import { CallESAsCurrentUser } from '../../cluster_access'; @@ -120,7 +124,7 @@ async function installPipeline({ // which we could otherwise use. // See src/core/server/elasticsearch/api_types.ts for available endpoints. await callCluster('transport.request', callClusterParams); - return { id: pipeline.name, type: AssetType.IngestPipeline }; + return { id: pipeline.name, type: IngestAssetType.IngestPipeline }; } const isDirectory = ({ path }: Registry.ArchiveEntry) => path.endsWith('/'); diff --git a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/install.ts b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/install.ts index 79f4e59135b98..2b41a79a69c99 100644 --- a/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/install.ts +++ b/x-pack/plugins/ingest_manager/server/services/epm/elasticsearch/template/install.ts @@ -4,8 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { AssetType } from '../../../../../../../legacy/plugins/ingest/common/types/domain_data'; -import { AssetReference, Dataset, RegistryPackage } from '../../../../../common/types'; +import { + AssetReference, + Dataset, + RegistryPackage, + IngestAssetType, +} from '../../../../../common/types'; import { CallESAsCurrentUser } from '../../cluster_access'; import { Field, loadFieldsFromYaml } from '../../fields/field'; import { getPipelineNameForInstallation } from '../ingest_pipeline/ingest_pipelines'; @@ -62,5 +66,5 @@ export async function installTemplate({ }); // The id of a template is its name - return { id: templateName, type: AssetType.IndexTemplate }; + return { id: templateName, type: IngestAssetType.IndexTemplate }; }