Skip to content

Commit

Permalink
Merge branch 'feature-make-it-ingest' of github.com:elastic/kibana in…
Browse files Browse the repository at this point in the history
…to feature-ingest
  • Loading branch information
mattapperson committed Nov 16, 2019
2 parents 03e2a68 + d3b1941 commit 570c1c7
Show file tree
Hide file tree
Showing 234 changed files with 53,785 additions and 47 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"@types/lodash.clonedeep": "^4.5.4",
"@types/react-grid-layout": "^0.16.7",
"@types/recompose": "^0.30.5",
"@use-it/interval": "^0.1.3",
"JSONStream": "1.3.5",
"abortcontroller-polyfill": "^1.3.0",
"angular": "^1.7.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/src/kbn/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const kibanaTestUser = {
};

export const kibanaServerTestUser = {
username: env.TEST_KIBANA_SERVER_USER || 'kibana',
username: env.TEST_KIBANA_SERVER_USER || 'elastic',
password: env.TEST_KIBANA_SERVER_PASS || 'changeme',
};

Expand Down
2 changes: 1 addition & 1 deletion src/cli/serve/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
set('optimize.watch', true);

if (!has('elasticsearch.username')) {
set('elasticsearch.username', 'kibana');
set('elasticsearch.username', 'elastic');
}

if (!has('elasticsearch.password')) {
Expand Down
1 change: 0 additions & 1 deletion src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import glob from 'glob';
import { resolve } from 'path';

import { REPO_ROOT } from '../constants';
import { Project } from './project';

Expand Down
10 changes: 9 additions & 1 deletion src/legacy/ui/public/management/sections_register.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ management.register('kibana', {
icon: 'logoKibana',
});

management.register('ingest', {
display: i18n.translate('common.ui.management.dataIngestionDisplayName', {
defaultMessage: 'Data Ingestion',
}),
order: 30,
icon: 'logoAPM',
});

management.register('logstash', {
display: 'Logstash',
order: 30,
order: 40,
icon: 'logoLogstash',
});
2 changes: 1 addition & 1 deletion src/test_utils/kbn_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export function createTestServers({

return {
startES: async () => {
await es.start();
await es.start(get(settings, 'es.esArgs', []));

if (['gold', 'trial'].includes(license)) {
await setupUsers({
Expand Down
2 changes: 2 additions & 0 deletions x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
"xpack.dashboardMode": "legacy/plugins/dashboard_mode",
"xpack.features": "plugins/features",
"xpack.fileUpload": "legacy/plugins/file_upload",
"xpack.fleet": "legacy/plugins/fleet",
"xpack.graph": "legacy/plugins/graph",
"xpack.grokDebugger": "legacy/plugins/grokdebugger",
"xpack.idxMgmt": "legacy/plugins/index_management",
"xpack.indexLifecycleMgmt": "legacy/plugins/index_lifecycle_management",
"xpack.infra": "legacy/plugins/infra",
"xpack.ingest": "legacy/plugins/ingest",
"xpack.kueryAutocomplete": "legacy/plugins/kuery_autocomplete",
"xpack.lens": "legacy/plugins/lens",
"xpack.licensing": "plugins/licensing",
Expand Down
4 changes: 4 additions & 0 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ import { transform } from './legacy/plugins/transform';
import { actions } from './legacy/plugins/actions';
import { alerting } from './legacy/plugins/alerting';
import { lens } from './legacy/plugins/lens';
import { ingest } from './legacy/plugins/ingest';
import { fleet } from './legacy/plugins/fleet';

module.exports = function (kibana) {
return [
Expand Down Expand Up @@ -85,5 +87,7 @@ module.exports = function (kibana) {
snapshotRestore(kibana),
actions(kibana),
alerting(kibana),
ingest(kibana),
fleet(kibana),
];
};
14 changes: 14 additions & 0 deletions x-pack/legacy/plugins/fleet/common/constants/agent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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.
*/

export const AGENT_TYPE_PERMANENT = 'PERMANENT';
export const AGENT_TYPE_EPHEMERAL = 'EPHEMERAL';
export const AGENT_TYPE_TEMPORARY = 'TEMPORARY';

export const AGENT_POLLING_THRESHOLD_MS = 30000;

export const DEFAULT_AGENTS_PAGE_SIZE = 20;
export const AGENTS_PAGE_SIZE_OPTIONS = [20, 50, 100];
12 changes: 12 additions & 0 deletions x-pack/legacy/plugins/fleet/common/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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.
*/

export { INDEX_NAMES } from './index_names';
export { PLUGIN } from './plugin';
export * from './agent';
export const BASE_PATH = '/fleet';

export const DEFAULT_POLICY_ID = 'default';
11 changes: 11 additions & 0 deletions x-pack/legacy/plugins/fleet/common/constants/index_names.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* 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.
*/

export const INDEX_NAMES = {
FLEET: '.kibana',
};

export const POLICY_NAMES = {};
10 changes: 10 additions & 0 deletions x-pack/legacy/plugins/fleet/common/constants/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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.
*/

export const PLUGIN = {
ID: 'fleet',
};
export const CONFIG_PREFIX = 'xpack.fleet';
9 changes: 9 additions & 0 deletions x-pack/legacy/plugins/fleet/common/constants/security.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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.
*/

export const REQUIRED_ROLES = ['fleet_admin'];
export const REQUIRED_LICENSES = ['standard', 'gold', 'trial', 'platinum'];
export const LICENSES = ['oss', 'basic', 'standard', 'gold', 'trial', 'platinum'];
137 changes: 137 additions & 0 deletions x-pack/legacy/plugins/fleet/common/return_types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/*
* 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.
*/

export interface BaseReturnType {
error?: {
message: string;
code?: number;
};
success: boolean;
}

export interface ReturnTypeCreate<T> extends BaseReturnType {
item: T;
action: 'created';
}

export interface ReturnTypeUpdate<T> extends BaseReturnType {
item: T;
action: 'updated';
}

export interface ReturnTypeBulkCreate<T> extends BaseReturnType {
results: Array<{
item: T;
success: boolean;
action: 'created';
error?: {
message: string;
code?: number;
};
}>;
}

// delete
export interface ReturnTypeDelete extends BaseReturnType {
action: 'deleted';
}

export interface ReturnTypeCheckin extends BaseReturnType {
action: 'checkin';
actions: Array<{
type: string;
data?: object;
}>;
policy: { [k: string]: any } | null;
}

export interface ReturnTypeBulkDelete extends BaseReturnType {
results: Array<{
success: boolean;
action: 'deleted';
error?: {
message: string;
code?: number;
};
}>;
}

// upsert
export interface ReturnTypeUpsert<T> extends BaseReturnType {
item: T;
action: 'created' | 'updated';
}

// upsert bulk
export interface ReturnTypeBulkUpsert extends BaseReturnType {
results: Array<{
success: boolean;
action: 'created' | 'updated';
error?: {
message: string;
code?: number;
};
}>;
}

export interface ReturnTypeBulkUnenroll extends BaseReturnType {
results: Array<{
id: string;
success: boolean;
action: 'unenrolled';
error?: {
message: string;
};
}>;
}

// list
export interface ReturnTypeList<T> extends BaseReturnType {
list: T[];
page: number;
total: number;
perPage: number;
}

// get
export interface ReturnTypeGet<T> extends BaseReturnType {
item: T;
}

export interface ReturnTypeBulkGet<T> extends BaseReturnType {
items: T[];
}

// action -- e.g. validate config block. Like ES simulate endpoint
export interface ReturnTypeAction extends BaseReturnType {
result: {
[key: string]: any;
};
}
// e.g.
// {
// result: {
// username: { valid: true },
// password: { valid: false, error: 'something' },
// hosts: [
// { valid: false }, { valid: true },
// ]
// }
// }

// bulk action -- e.g. assign tags to beats
export interface ReturnTypeBulkAction extends BaseReturnType {
results?: Array<{
success: boolean;
result?: {
[key: string]: any;
};
error?: {
message: string;
code?: number;
};
}>;
}
55 changes: 55 additions & 0 deletions x-pack/legacy/plugins/fleet/common/types/domain_data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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 * as t from 'io-ts';
import { RuntimeAgent, RuntimeAgentAction } from '../../server/repositories/agents/types';
import { RuntimeAgentEvent } from '../../server/repositories/agent_events/types';
import { EnrollmentApiKey } from '../../server/repositories/enrollment_api_keys/types';

// Here we create the runtime check for a generic, unknown beat config type.
// We can also pass in optional params to create spacific runtime checks that
// can be used to validate blocs on the API and UI
export const createConfigurationInterface = (beatConfigInterface: t.Mixed = t.Dictionary) =>
t.interface(
{
id: t.union([t.undefined, t.string]),
name: t.string,
description: t.union([t.undefined, t.string]),
config: beatConfigInterface,
last_updated_by: t.union([t.undefined, t.string]),
last_updated: t.union([t.undefined, t.number]),
},
'Config'
);
const BaseConfiguration = createConfigurationInterface();
export interface ConfigurationBlock
extends Pick<
t.TypeOf<typeof BaseConfiguration>,
Exclude<keyof t.TypeOf<typeof BaseConfiguration>, 'id'>
> {
id: string;
}

export type Agent = t.TypeOf<typeof RuntimeAgent>;
export type AgentAction = t.TypeOf<typeof RuntimeAgentAction>;
export type AgentEvent = t.TypeOf<typeof RuntimeAgentEvent>;

export type EnrollmentApiKey = EnrollmentApiKey;

export type PolicyUpdatedEvent =
| {
type: 'created';
policyId: string;
payload: any;
}
| {
type: 'updated';
policyId: string;
payload: any;
}
| {
type: 'deleted';
policyId: string;
};
9 changes: 9 additions & 0 deletions x-pack/legacy/plugins/fleet/common/types/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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.
*/

export type FlatObject<T> = { [Key in keyof T]: string };
export type RendererResult = React.ReactElement<any> | null;
export type RendererFunction<RenderArgs, Result = RendererResult> = (args: RenderArgs) => Result;
34 changes: 34 additions & 0 deletions x-pack/legacy/plugins/fleet/common/types/io_ts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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 * as t from 'io-ts';
import { isLeft } from 'fp-ts/lib/Either';

export class DateFromStringType extends t.Type<Date, string, t.mixed> {
// eslint-disable-next-line
public readonly _tag: 'DateFromISOStringType' = 'DateFromISOStringType';
constructor() {
super(
'DateFromString',
(u): u is Date => u instanceof Date,
(u, c) => {
const validation = t.string.validate(u, c);
if (isLeft(validation)) {
return validation as any;
} else {
const s = validation.right;
const d = new Date(s);
return isNaN(d.getTime()) ? t.failure(s, c) : t.success(d);
}
},
a => a.toISOString()
);
}
}
// eslint-disable-next-line
export interface DateFromString extends DateFromStringType {}

export const DateFromString: DateFromString = new DateFromStringType();
7 changes: 7 additions & 0 deletions x-pack/legacy/plugins/fleet/common/types/security.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* 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.
*/

export type LicenseType = 'oss' | 'basic' | 'trial' | 'standard' | 'basic' | 'gold' | 'platinum';
Loading

0 comments on commit 570c1c7

Please sign in to comment.