import { PartialMetricsSourceConfiguration , MetricsSourceConfigurationResponse , } from '../../../plugins/infra/common/metrics_sources' ; import { FtrProviderContext } from '../ftr_provider_context' ; export function InfraOpsSourceConfigurationProvider ( { getService } ) { const log = getService ( 'log' ) ; const supertest = getService ( 'supertest' ) ; const patchRequest = async ( body ) : Promise < MetricsSourceConfigurationResponse | undefined > => { const response = await supertest . patch ( '/api/metrics/source/default' ) . set ( 'kbn-xsrf' , 'xxx' ) . send ( body ) . expect ( 200 ) ; return response . body ; } ; return { async createConfiguration ( sourceId , sourceProperties ) { log . debug ( `Creating Infra UI source configuration "${ sourceId }" with properties ${ JSON . stringify ( sourceProperties ) }` ) ; const response = await patchRequest ( sourceProperties ) ; return response ?. source . version ; } , } ; }