diff --git a/x-pack/plugins/integration_assistant/server/plugin.ts b/x-pack/plugins/integration_assistant/server/plugin.ts index 64989d23e7dd8..bf972f04a61a5 100644 --- a/x-pack/plugins/integration_assistant/server/plugin.ts +++ b/x-pack/plugins/integration_assistant/server/plugin.ts @@ -21,6 +21,8 @@ import type { IntegrationAssistantPluginStart, IntegrationAssistantPluginStartDependencies, } from './types'; +import { parseExperimentalConfigValue } from '../common/experimental_features'; +import { IntegrationAssistantConfigType } from './config'; export type IntegrationAssistantRouteHandlerContext = CustomRequestHandlerContext<{ integrationAssistant: { @@ -36,11 +38,13 @@ export class IntegrationAssistantPlugin implements Plugin { private readonly logger: Logger; + private readonly config: IntegrationAssistantConfigType; private isAvailable: boolean; private hasLicense: boolean; constructor(initializerContext: PluginInitializerContext) { this.logger = initializerContext.logger.get(); + this.config = initializerContext.config.get(); this.isAvailable = true; this.hasLicense = false; } @@ -59,9 +63,11 @@ export class IntegrationAssistantPlugin logger: this.logger, })); const router = core.http.createRouter(); + const experimentalFeatures = parseExperimentalConfigValue(this.config.enableExperimental ?? []); + this.logger.debug('integrationAssistant api: Setup'); - registerRoutes(router); + registerRoutes(router, experimentalFeatures); return { setIsAvailable: (isAvailable: boolean) => { diff --git a/x-pack/plugins/integration_assistant/server/routes/register_routes.ts b/x-pack/plugins/integration_assistant/server/routes/register_routes.ts index 976e3deb938fa..3f8795421a5c0 100644 --- a/x-pack/plugins/integration_assistant/server/routes/register_routes.ts +++ b/x-pack/plugins/integration_assistant/server/routes/register_routes.ts @@ -14,13 +14,20 @@ import { registerPipelineRoutes } from './pipeline_routes'; import type { IntegrationAssistantRouteHandlerContext } from '../plugin'; import { registerAnalyzeLogsRoutes } from './analyze_logs_routes'; import { registerCelInputRoutes } from './cel_routes'; +import { ExperimentalFeatures } from '../../common/experimental_features'; -export function registerRoutes(router: IRouter) { +export function registerRoutes( + router: IRouter, + experimentalFeatures: ExperimentalFeatures +) { registerAnalyzeLogsRoutes(router); registerEcsRoutes(router); registerIntegrationBuilderRoutes(router); registerCategorizationRoutes(router); registerRelatedRoutes(router); - registerCelInputRoutes(router); registerPipelineRoutes(router); + + if (experimentalFeatures.generateCel) { + registerCelInputRoutes(router); + } }