kibana/x-pack/plugins/ml/server/shared_services/license_checks.ts
James Gowdy d5c092811b
[ML] Adding shared services to ml setup contract (#59730)
* [ML] Adding shared services to ml setup contract

* adding data recognizer

* typescripting js client

* adding results service

* code clean up

* adding generic ml index search

* making cloud optional
2020-03-12 10:04:40 +00:00

26 lines
773 B
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { MlServerLicense } from '../lib/license';
export type LicenseCheck = () => void;
export function licenseChecks(
mlLicense: MlServerLicense
): { isFullLicense: LicenseCheck; isMinimumLicense: LicenseCheck } {
return {
isFullLicense() {
if (mlLicense.isFullLicense() === false) {
throw Error('Platinum, Enterprise or trial license needed');
}
},
isMinimumLicense() {
if (mlLicense.isMinimumLicense() === false) {
throw Error('Basic license needed');
}
},
};
}