diff --git a/x-pack/plugins/index_management/server/lib/enrich_policies.ts b/x-pack/plugins/index_management/server/lib/enrich_policies.ts index 4834d2932b5df..ca1748a380c70 100644 --- a/x-pack/plugins/index_management/server/lib/enrich_policies.ts +++ b/x-pack/plugins/index_management/server/lib/enrich_policies.ts @@ -41,8 +41,12 @@ export const serializeEnrichmentPolicies = ( }); }; -export const fetchAll = async (client: IScopedClusterClient) => { +const fetchAll = async (client: IScopedClusterClient) => { const res = await client.asCurrentUser.enrich.getPolicy(); return serializeEnrichmentPolicies(res.policies); }; + +export const enrichPoliciesActions = { + fetchAll, +}; diff --git a/x-pack/plugins/index_management/server/plugin.ts b/x-pack/plugins/index_management/server/plugin.ts index 14951ebc9e66d..bf542d61142a6 100644 --- a/x-pack/plugins/index_management/server/plugin.ts +++ b/x-pack/plugins/index_management/server/plugin.ts @@ -12,10 +12,10 @@ import { Dependencies } from './types'; import { ApiRoutes } from './routes'; import { IndexDataEnricher } from './services'; import { handleEsError } from './shared_imports'; -import * as enrichPoliciesApis from './lib/enrich_policies'; +import { enrichPoliciesActions } from './lib/enrich_policies'; export interface IndexManagementPluginSetup { - enrichPolicies: typeof enrichPoliciesApis; + enrichPoliciesActions: typeof enrichPoliciesActions; indexDataEnricher: { add: IndexDataEnricher['add']; }; @@ -61,7 +61,7 @@ export class IndexMgmtServerPlugin implements Plugin { const client = (await context.core).elasticsearch.client as IScopedClusterClient; try { - const policies = await enrichPolicies.fetchAll(client); + const policies = await enrichPoliciesActions.fetchAll(client); return response.ok({ body: policies }); } catch (error) { return handleEsError({ error, response });