import { Plugin , CoreSetup } from 'kibana/server' ; import { i18n } from '@kbn/i18n' ; import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils/default_app_categories' ; import { PluginSetupContract as AlertingSetup } from '../../../plugins/alerting/server' ; import { PluginSetupContract as FeaturesPluginSetup } from '../../../plugins/features/server' ; import { alertType as alwaysFiringAlert } from './alert_types/always_firing' ; import { alertType as peopleInSpaceAlert } from './alert_types/astros' ; const INDEX_THRESHOLD_ID = '.index-threshold' ; import { ALERTING_EXAMPLE_APP_ID } from '../common/constants' ; export interface AlertingExampleDeps { alerting : AlertingSetup ; features : FeaturesPluginSetup ; } export class AlertingExamplePlugin implements Plugin < void , void , AlertingExampleDeps > { public setup ( core , { alerting , features } ) { alerting . registerType ( alwaysFiringAlert ) ; alerting . registerType ( peopleInSpaceAlert ) ; features . registerKibanaFeature ( { id : ALERTING_EXAMPLE_APP_ID , name : i18n . translate ( 'alertsExample.featureRegistry.alertsExampleFeatureName' , { defaultMessage : 'Alerting Examples' , } ) , app : [ ] , management : { insightsAndAlerting : [ 'triggersActions' ] , } , category : DEFAULT_APP_CATEGORIES . management , alerting : [ alwaysFiringAlert . id , peopleInSpaceAlert . id , INDEX_THRESHOLD_ID ] , privileges : { all : { alerting : { rule : { all : [ alwaysFiringAlert . id , peopleInSpaceAlert . id , INDEX_THRESHOLD_ID ] , } , alert : { all : [ alwaysFiringAlert . id , peopleInSpaceAlert . id , INDEX_THRESHOLD_ID ] , } , } , savedObject : { all : [ ] , read : [ ] , } , management : { insightsAndAlerting : [ 'triggersActions' ] , } , ui : [ ] , } , read : { alerting : { rule : { read : [ alwaysFiringAlert . id , peopleInSpaceAlert . id , INDEX_THRESHOLD_ID ] , } , alert : { read : [ alwaysFiringAlert . id , peopleInSpaceAlert . id , INDEX_THRESHOLD_ID ] , } , } , savedObject : { all : [ ] , read : [ ] , } , management : { insightsAndAlerting : [ 'triggersActions' ] , } , ui : [ ] , } , } , } ) ; } public start ( ) { } public stop ( ) { } }