import { schema } from '@kbn/config-schema' ; import { startBasic } from '../../../lib/start_basic' ; import { RouteDependencies } from '../../../types' ; import { addBasePath } from '../../helpers' ; export function registerStartBasicRoute ( { router , lib : { handleEsError } , plugins : { licensing } , } ) { router . post ( { path : addBasePath ( '/start_basic' ) , validate : { query : schema . object ( { acknowledge : schema . string ( ) } ) } , } , async ( ctx , req , res ) => { const { client } = ctx . core . elasticsearch ; try { return res . ok ( { body : await startBasic ( { acknowledge : Boolean ( req . query . acknowledge ) , client , licensing , } ) , } ) ; } catch ( error ) { return handleEsError ( { error , response : res } ) ; } } ) ; }