import { schema } from '@kbn/config-schema' ; import { PLUGIN_ID } from '../../../common' ; import { IRouter } from '../../../../../../src/core/server' ; import { OsqueryAppContext } from '../../lib/osquery_app_context_services' ; export const getAgentPolicyRoute = ( router , osqueryContext ) => { router . get ( { path : '/internal/osquery/fleet_wrapper/agent_policies/{id}' , validate : { params : schema . object ( { id : schema . string ( ) , } ) , } , options : { tags : [ `access:${ PLUGIN_ID }-read` ] } , } , async ( context , request , response ) => { const soClient = context . core . savedObjects . client ; const packageInfo = await osqueryContext . service . getAgentPolicyService ( ) ?. get ( soClient , request . params . id ) ; return response . ok ( { body : { item : packageInfo } } ) ; } ) ; } ;