import { IRouter } from 'kibana/server' ; import { schema } from '@kbn/config-schema' ; import { ILicenseState } from '../lib' ; import { verifyAccessAndContext } from './lib' ; import { AlertingRequestHandlerContext , BASE_ALERTING_API_PATH } from '../types' ; const paramSchema = schema . object ( { id : schema . string ( ) , } ) ; export const deleteRuleRoute = ( router , licenseState ) => { router . delete ( { path : `${ BASE_ALERTING_API_PATH }/rule/{id}` , validate : { params : paramSchema , } , } , router . handleLegacyErrors ( verifyAccessAndContext ( licenseState , async function ( context , req , res ) { const rulesClient = context . alerting . getRulesClient ( ) ; const { id } = req . params ; await rulesClient . delete ( { id } ) ; return res . noContent ( ) ; } ) ) ) ; } ;