import { schema } from '@kbn/config-schema' ; import { Subject } from 'rxjs' ; import { Plugin , CoreSetup , ServiceStatus , ServiceStatusLevels , } from '../../../../../../src/core/server' ; export class StatusPluginAPlugin implements Plugin { private status$ = new Subject < ServiceStatus > ( ) ; public setup ( core , deps ) { core . status . set ( this . status$ ) ; const router = core . http . createRouter ( ) ; router . post ( { path : '/internal/status_plugin_a/status/set' , validate : { query : schema . object ( { level : schema . oneOf ( [ schema . literal ( 'available' ) , schema . literal ( 'degraded' ) , schema . literal ( 'unavailable' ) , schema . literal ( 'critical' ) , ] ) , } ) , } , } , ( context , req , res ) => { const { level } = req . query ; this . status$ . next ( { level : ServiceStatusLevels [ level ] , summary : `statusPluginA is ${ level }` , } ) ; return res . ok ( ) ; } ) ; } public start ( ) { } public stop ( ) { } }