Skip to content

Commit

Permalink
move AssetType to IngestAsset type from ingest plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
neptunian committed Feb 10, 2020
1 parent 73128b6 commit 28fd874
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
13 changes: 12 additions & 1 deletion x-pack/plugins/ingest_manager/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -169,3 +168,15 @@ export type NotInstalled<T = {}> = T & {
export type AssetReference = Pick<SavedObjectReference, 'id'> & {
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',
}
1 change: 1 addition & 0 deletions x-pack/plugins/ingest_manager/common/types/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
export * from './agent_config';
export * from './datasource';
export * from './output';
export * from './epm';
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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('/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 };
}

0 comments on commit 28fd874

Please sign in to comment.