import { FtrProviderContext } from '../ftr_provider_context' ; import { TelemetryCollectionManagerPlugin } from '../../../../src/plugins/telemetry_collection_manager/server/plugin' ; export function UsageAPIProvider ( { getService } ) { const supertest = getService ( 'supertest' ) ; const supertestNoAuth = getService ( 'supertestWithoutAuth' ) ; return { async getUsageStatsNoAuth ( ) { const { body } = await supertestNoAuth . get ( '/api/stats?extended=true' ) . set ( 'kbn-xsrf' , 'xxx' ) . expect ( 401 ) ; return body . usage ; } , /**
         * Public stats API: it returns the usage in camelCase format
         */ async getUsageStats ( ) { const { body } = await supertest . get ( '/api/stats?extended=true' ) . set ( 'kbn-xsrf' , 'xxx' ) . expect ( 200 ) ; return body . usage ; } , param payload async getTelemetryStats ( payload ) { const { body } = await supertest . post ( '/api/telemetry/v2/clusters/_stats' ) . set ( 'kbn-xsrf' , 'xxx' ) . send ( { refreshCache : true , ... payload } ) . expect ( 200 ) ; return body ; } , } ; }