Skip to content

Commit

Permalink
[Ingest Manager] Rename agent/package config(s) to agent/package poli…
Browse files Browse the repository at this point in the history
…cy(ies) (#74914)

* Initial pass at updating client routes, variables names, code comments, and UI copy

* Adjust server routes and param names, more var names and i18n fixes

* Fix test

* More var renaming

* Rest of server-side var renaming

* Rest of client side var renaming

* Rename agent SO attributes and add migrations

* Remove agent prefix from policy fields

* Rename agent policy SO attributes and add migrations

* Rename enrollment api key SO attributes and add migrations

* Rename package policy SO attributes and add migrations

* Rename agent event SO attributes and add migrations

* Rename subtype CONFIG to POLICY (I don't think this string is ever sent by agent, though)

* Update snapshot

* Remove unnecessary cloning in migrations

* Fix migration typos

* Update naming in tests and es archiver data

* Rename file names in /common

* Rename /server files

* Rename /public files

* Rename test file names

* Rename missed files

* Revert "Rename subtype CONFIG to POLICY (I don't think this string is ever sent by agent, though)"

This reverts commit 3c91e01.

* Add migration version to updated es archiver data to fix tests
  • Loading branch information
jen-huang committed Aug 19, 2020
1 parent 9111d50 commit ad5c0f5
Show file tree
Hide file tree
Showing 249 changed files with 4,845 additions and 4,720 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/ingest_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Plugin

- The plugin is enabled by default. See the TypeScript type for the [the available plugin configuration options](https://github.com/elastic/kibana/blob/master/x-pack/plugins/ingest_manager/common/types/index.ts#L9-L27)
- Adding `xpack.ingestManager.enabled=false` will disable the plugin including the EPM and Fleet features. It will also remove the `PACKAGE_CONFIG_API_ROUTES` and `AGENT_CONFIG_API_ROUTES` values in [`common/constants/routes.ts`](./common/constants/routes.ts)
- Adding `xpack.ingestManager.enabled=false` will disable the plugin including the EPM and Fleet features. It will also remove the `PACKAGE_POLICY_API_ROUTES` and `AGENT_POLICY_API_ROUTES` values in [`common/constants/routes.ts`](./common/constants/routes.ts)
- Adding `--xpack.ingestManager.fleet.enabled=false` will disable the Fleet API & UI
- [code for adding the routes](https://github.com/elastic/kibana/blob/1f27d349533b1c2865c10c45b2cf705d7416fb36/x-pack/plugins/ingest_manager/server/plugin.ts#L115-L133)
- [Integration tests](server/integration_tests/router.test.ts)
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/ingest_manager/common/constants/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export const AGENT_POLLING_INTERVAL = 1000;
export const AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS = 30000;
export const AGENT_UPDATE_ACTIONS_INTERVAL_MS = 5000;

export const AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS = 5000;
export const AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL = 25;
export const AGENT_POLICY_ROLLOUT_RATE_LIMIT_INTERVAL_MS = 5000;
export const AGENT_POLICY_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL = 25;
20 changes: 0 additions & 20 deletions x-pack/plugins/ingest_manager/common/constants/agent_config.ts

This file was deleted.

20 changes: 20 additions & 0 deletions x-pack/plugins/ingest_manager/common/constants/agent_policy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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 { AgentPolicyStatus, DefaultPackages } from '../types';

export const AGENT_POLICY_SAVED_OBJECT_TYPE = 'ingest-agent-policies';

export const DEFAULT_AGENT_POLICY = {
name: 'Default policy',
namespace: 'default',
description: 'Default agent policy created by Kibana',
status: AgentPolicyStatus.Active,
package_policies: [],
is_default: true,
monitoring_enabled: ['logs', 'metrics'] as Array<'logs' | 'metrics'>,
};

export const DEFAULT_AGENT_POLICIES_PACKAGES = [DefaultPackages.system];
4 changes: 2 additions & 2 deletions x-pack/plugins/ingest_manager/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export * from './plugin';
export * from './routes';

export * from './agent';
export * from './agent_config';
export * from './package_config';
export * from './agent_policy';
export * from './package_policy';
export * from './epm';
export * from './output';
export * from './enrollment_api_key';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const PACKAGE_CONFIG_SAVED_OBJECT_TYPE = 'ingest-package-policies';
export const PACKAGE_POLICY_SAVED_OBJECT_TYPE = 'ingest-package-policies';
38 changes: 19 additions & 19 deletions x-pack/plugins/ingest_manager/common/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
export const API_ROOT = `/api/ingest_manager`;
export const EPM_API_ROOT = `${API_ROOT}/epm`;
export const DATA_STREAM_API_ROOT = `${API_ROOT}/data_streams`;
export const PACKAGE_CONFIG_API_ROOT = `${API_ROOT}/package_configs`;
export const AGENT_CONFIG_API_ROOT = `${API_ROOT}/agent_configs`;
export const PACKAGE_POLICY_API_ROOT = `${API_ROOT}/package_policies`;
export const AGENT_POLICY_API_ROOT = `${API_ROOT}/agent_policies`;
export const FLEET_API_ROOT = `${API_ROOT}/fleet`;

export const LIMITED_CONCURRENCY_ROUTE_TAG = 'ingest:limited-concurrency';
Expand All @@ -32,25 +32,25 @@ export const DATA_STREAM_API_ROUTES = {
LIST_PATTERN: `${DATA_STREAM_API_ROOT}`,
};

// Package config API routes
export const PACKAGE_CONFIG_API_ROUTES = {
LIST_PATTERN: `${PACKAGE_CONFIG_API_ROOT}`,
INFO_PATTERN: `${PACKAGE_CONFIG_API_ROOT}/{packageConfigId}`,
CREATE_PATTERN: `${PACKAGE_CONFIG_API_ROOT}`,
UPDATE_PATTERN: `${PACKAGE_CONFIG_API_ROOT}/{packageConfigId}`,
DELETE_PATTERN: `${PACKAGE_CONFIG_API_ROOT}/delete`,
// Package policy API routes
export const PACKAGE_POLICY_API_ROUTES = {
LIST_PATTERN: `${PACKAGE_POLICY_API_ROOT}`,
INFO_PATTERN: `${PACKAGE_POLICY_API_ROOT}/{packagePolicyId}`,
CREATE_PATTERN: `${PACKAGE_POLICY_API_ROOT}`,
UPDATE_PATTERN: `${PACKAGE_POLICY_API_ROOT}/{packagePolicyId}`,
DELETE_PATTERN: `${PACKAGE_POLICY_API_ROOT}/delete`,
};

// Agent config API routes
export const AGENT_CONFIG_API_ROUTES = {
LIST_PATTERN: `${AGENT_CONFIG_API_ROOT}`,
INFO_PATTERN: `${AGENT_CONFIG_API_ROOT}/{agentConfigId}`,
CREATE_PATTERN: `${AGENT_CONFIG_API_ROOT}`,
UPDATE_PATTERN: `${AGENT_CONFIG_API_ROOT}/{agentConfigId}`,
COPY_PATTERN: `${AGENT_CONFIG_API_ROOT}/{agentConfigId}/copy`,
DELETE_PATTERN: `${AGENT_CONFIG_API_ROOT}/delete`,
FULL_INFO_PATTERN: `${AGENT_CONFIG_API_ROOT}/{agentConfigId}/full`,
FULL_INFO_DOWNLOAD_PATTERN: `${AGENT_CONFIG_API_ROOT}/{agentConfigId}/download`,
// Agent policy API routes
export const AGENT_POLICY_API_ROUTES = {
LIST_PATTERN: `${AGENT_POLICY_API_ROOT}`,
INFO_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}`,
CREATE_PATTERN: `${AGENT_POLICY_API_ROOT}`,
UPDATE_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}`,
COPY_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}/copy`,
DELETE_PATTERN: `${AGENT_POLICY_API_ROOT}/delete`,
FULL_INFO_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}/full`,
FULL_INFO_DOWNLOAD_PATTERN: `${AGENT_POLICY_API_ROOT}/{agentPolicyId}/download`,
};

// Output API routes
Expand Down
12 changes: 6 additions & 6 deletions x-pack/plugins/ingest_manager/common/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { NewPackageConfig, PackageConfig } from './types/models/package_config';
import { NewPackagePolicy, PackagePolicy } from './types';

export const createNewPackageConfigMock = (): NewPackageConfig => {
export const createNewPackagePolicyMock = (): NewPackagePolicy => {
return {
name: 'endpoint-1',
description: '',
namespace: 'default',
enabled: true,
config_id: '93c46720-c217-11ea-9906-b5b8a21b268e',
policy_id: '93c46720-c217-11ea-9906-b5b8a21b268e',
output_id: '',
package: {
name: 'endpoint',
Expand All @@ -23,10 +23,10 @@ export const createNewPackageConfigMock = (): NewPackageConfig => {
};
};

export const createPackageConfigMock = (): PackageConfig => {
const newPackageConfig = createNewPackageConfigMock();
export const createPackagePolicyMock = (): PackagePolicy => {
const newPackagePolicy = createNewPackagePolicyMock();
return {
...newPackageConfig,
...newPackagePolicy,
id: 'c6d16e42-c32d-4dce-8a88-113cfe276ad1',
version: 'abcd',
revision: 1,
Expand Down
Loading

0 comments on commit ad5c0f5

Please sign in to comment.