kibana/x-pack/plugins/transform/common/constants.ts
Pierre Gayvallet 0d09cea436
Remove legacy plugins support (#77599)
* remove ALL the things.

* adapt some types and tests

* restore ensureValidConfiguration

* fix legacy service tests

* adapt uiRender mixin

* remove legacy types

* update generated doc

* restore legacy plugin schema

* update generated doc

* remove remaining code of x-pack/legacy

* adapt imports due to merge

* cleanup CODEOWNERS

* cleanup gitignore & i18nrc

* cleanup tsconfig.json

* remove unused i18n keys

* add back `"legacy/plugins/**/*",` to tsconfig until legacy space plugin is deleted

* fix create_jest_config

* remove references from eslintrc

* more eslint cleanup

* remove `x-pack/index.js`

* fix xpack gulp scripts

* fix bug with default + named imports from boom

* remove rules from eslintrc

* remove LegacyInternals

* review comments

* update generated doc

* cleanup legacy metadatas

* revert changes to eslintrc

* update generated doc
2020-09-23 09:52:51 +02:00

98 lines
3.5 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
import { LicenseType } from '../../licensing/common/types';
export const DEFAULT_REFRESH_INTERVAL_MS = 30000;
export const MINIMUM_REFRESH_INTERVAL_MS = 1000;
export const PROGRESS_REFRESH_INTERVAL_MS = 2000;
export const PLUGIN = {
ID: 'transform',
MINIMUM_LICENSE_REQUIRED: 'basic' as LicenseType,
getI18nName: (): string => {
return i18n.translate('xpack.transform.appName', {
defaultMessage: 'Transforms',
});
},
};
export const API_BASE_PATH = '/api/transform/';
// In order to create a transform, the API requires the following privileges:
// - transform_admin (builtin)
// - cluster privileges: manage_transform
// - index privileges:
// - indices: .transform-notifications-*, .data-frame-notifications-*, .transform-notifications-read
// - privileges: view_index_metadata, read
// - transform_user (builtin)
// - cluster privileges: monitor_transform
// - index privileges:
// - indices: .transform-notifications-*, .data-frame-notifications-*, .transform-notifications-read
// - privileges: view_index_metadata, read
// - source index: read, view_index_metadata (can be applied to a pattern e.g. farequote-*)
// - dest index: index, create_index (can be applied to a pattern e.g. df-*)
//
// In the UI additional privileges are required:
// - kibana_admin (builtin)
// - dest index: monitor (applied to df-*)
// - cluster: monitor
//
// Note that users with kibana_admin can see all Kibana index patterns and saved searches
// in the source selection modal when creating a transform, but the wizard will trigger
// error callouts when there are no sufficient privileges to read the actual source indices.
export const APP_CLUSTER_PRIVILEGES = [
'cluster:monitor/transform/get',
'cluster:monitor/transform/stats/get',
'cluster:admin/transform/delete',
'cluster:admin/transform/preview',
'cluster:admin/transform/put',
'cluster:admin/transform/start',
'cluster:admin/transform/start_task',
'cluster:admin/transform/stop',
];
// Equivalent of capabilities.canGetTransform
export const APP_GET_TRANSFORM_CLUSTER_PRIVILEGES = [
'cluster.cluster:monitor/transform/get',
'cluster.cluster:monitor/transform/stats/get',
];
// Equivalent of capabilities.canGetTransform
export const APP_CREATE_TRANSFORM_CLUSTER_PRIVILEGES = [
'cluster.cluster:monitor/transform/get',
'cluster.cluster:monitor/transform/stats/get',
'cluster.cluster:admin/transform/preview',
'cluster.cluster:admin/transform/put',
'cluster.cluster:admin/transform/start',
'cluster.cluster:admin/transform/start_task',
];
export const APP_INDEX_PRIVILEGES = ['monitor'];
// reflects https://github.com/elastic/elasticsearch/blob/master/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/dataframe/transforms/DataFrameTransformStats.java#L243
export const TRANSFORM_STATE = {
ABORTING: 'aborting',
FAILED: 'failed',
INDEXING: 'indexing',
STARTED: 'started',
STOPPED: 'stopped',
STOPPING: 'stopping',
} as const;
const transformStates = Object.values(TRANSFORM_STATE);
export type TransformState = typeof transformStates[number];
export const TRANSFORM_MODE = {
BATCH: 'batch',
CONTINUOUS: 'continuous',
} as const;
const transformModes = Object.values(TRANSFORM_MODE);
export type TransformMode = typeof transformModes[number];