kibana/x-pack/plugins/logstash/server/plugin.ts
Pierre Gayvallet 328febabd3
migrate logstash plugin to new ES client (#98064)
* migrate logstash plugin to new ES client

* handle 404s

* use default ES client
2021-04-27 10:25:50 +02:00

49 lines
1.4 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from 'src/core/server';
import { LicensingPluginSetup } from '../../licensing/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';
import { SecurityPluginSetup } from '../../security/server';
import { registerRoutes } from './routes';
interface SetupDeps {
licensing: LicensingPluginSetup;
security?: SecurityPluginSetup;
features: FeaturesPluginSetup;
}
export class LogstashPlugin implements Plugin {
private readonly logger: Logger;
constructor(context: PluginInitializerContext) {
this.logger = context.logger.get();
}
setup(core: CoreSetup, deps: SetupDeps) {
this.logger.debug('Setting up Logstash plugin');
registerRoutes(core.http.createRouter(), deps.security);
deps.features.registerElasticsearchFeature({
id: 'pipelines',
management: {
ingest: ['pipelines'],
},
privileges: [
{
requiredClusterPrivileges: ['manage_logstash_pipelines'],
requiredIndexPrivileges: {},
ui: [],
},
],
});
}
start(core: CoreStart) {}
}