Skip to content

Commit

Permalink
[Ingest] Fleet agent domain lib (#43493)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet committed Aug 16, 2019
1 parent 8cb4e81 commit b5803ba
Show file tree
Hide file tree
Showing 20 changed files with 5,629 additions and 21 deletions.
2 changes: 2 additions & 0 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { snapshotRestore } from './legacy/plugins/snapshot_restore';
import { actions } from './legacy/plugins/actions';
import { alerting } from './legacy/plugins/alerting';
import { advancedUiActions } from './legacy/plugins/advanced_ui_actions';
import { fleet } from './legacy/plugins/fleet';

module.exports = function (kibana) {
return [
Expand Down Expand Up @@ -87,5 +88,6 @@ module.exports = function (kibana) {
actions(kibana),
alerting(kibana),
advancedUiActions(kibana),
fleet(kibana),
];
};
26 changes: 14 additions & 12 deletions x-pack/legacy/plugins/fleet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import * as Joi from 'joi';
import { resolve } from 'path';
import { i18n } from '@kbn/i18n';
// import { i18n } from '@kbn/i18n';
import { PLUGIN } from './common/constants';
import { CONFIG_PREFIX } from './common/constants/plugin';
import { initServerWithKibana } from './server/kibana.index';
//
import { mappings } from './server/mappings';

export const config = Joi.object({
enabled: Joi.boolean().default(true),
Expand All @@ -21,16 +22,17 @@ export function fleet(kibana: any) {
require: ['kibana', 'elasticsearch', 'xpack_main'],
publicDir: resolve(__dirname, 'public'),
uiExports: {
app: {
title: 'Elastic Fleet',
description: i18n.translate('xpack.fleet.elasticFleetDescription', {
defaultMessage: 'Manage your elastic data ingestion stack',
}),
main: 'plugins/fleet/index',
icon: 'plugins/fleet/icon.svg',
euiIconType: 'apmApp',
order: 8000,
},
// app: {
// title: 'Elastic Fleet',
// description: i18n.translate('xpack.fleet.elasticFleetDescription', {
// defaultMessage: 'Manage your elastic data ingestion stack',
// }),
// main: 'plugins/fleet/index',
// icon: 'plugins/fleet/icon.svg',
// euiIconType: 'apmApp',
// order: 8000,
// },
mappings,
},
config: () => config,
configPrefix: CONFIG_PREFIX,
Expand Down
26 changes: 26 additions & 0 deletions x-pack/legacy/plugins/fleet/server/libs/__mocks__/token.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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 { TokenVerificationResponse } from '../adapters/tokens/adapter_types';

export class TokenLib {
private accessTokenId = 1;

public async verify(token: any): Promise<TokenVerificationResponse> {
switch (token) {
case 'valid-enrollment-token': {
return { valid: true };
}
default: {
return { valid: false, reason: 'token does not exists' };
}
}
}

public async generateAccessToken(token: any): Promise<string> {
return `mock-access-token-${this.accessTokenId++}`;
}
}
Loading

0 comments on commit b5803ba

Please sign in to comment.