mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
55 lines
1.4 KiB
TypeScript
55 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 { Plugin, CoreSetup } from 'kibana/server';
|
|
|
|
import { ApiRoutes } from './routes';
|
|
import { handleEsError } from './shared_imports';
|
|
import { SetupDependencies, StartDependencies } from './types';
|
|
|
|
export class LicenseManagementServerPlugin
|
|
implements Plugin<void, void, SetupDependencies, StartDependencies> {
|
|
private readonly apiRoutes = new ApiRoutes();
|
|
|
|
setup(
|
|
{ http, getStartServices }: CoreSetup<StartDependencies>,
|
|
{ features, security }: SetupDependencies
|
|
) {
|
|
const router = http.createRouter();
|
|
|
|
features.registerElasticsearchFeature({
|
|
id: 'license_management',
|
|
management: {
|
|
stack: ['license_management'],
|
|
},
|
|
privileges: [
|
|
{
|
|
requiredClusterPrivileges: ['manage'],
|
|
ui: [],
|
|
},
|
|
],
|
|
});
|
|
|
|
getStartServices().then(([, { licensing }]) => {
|
|
this.apiRoutes.setup({
|
|
router,
|
|
plugins: {
|
|
licensing,
|
|
},
|
|
lib: {
|
|
handleEsError,
|
|
},
|
|
config: {
|
|
isSecurityEnabled: security !== undefined,
|
|
},
|
|
});
|
|
});
|
|
}
|
|
|
|
start() {}
|
|
stop() {}
|
|
}
|