Skip to content

Commit

Permalink
[Response Ops] [Connectors] Move connectors to own plugin (#139867)
Browse files Browse the repository at this point in the history
* Initial commit of stack connectors plugin

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Fixing up xmatters. Moving library functions around

* [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs'

* Fixing up webhook

* Fixing up teams and slack

* Fixing up index, email, pagerduty, server log

* Fixing i18n

* wip

* Moving well know email route to stack connectors plugin

* Fixing types

* Fixing unit tests

* Adding index.ts

* Cleanup

* Updating READMEs

* [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs'

* Moving to domain specific folders and updating codeowners

* Fixing codeowners

* Fixing types

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
ymao1 and kibanamachine authored Sep 15, 2022
1 parent 2464aa6 commit 914d1cd
Show file tree
Hide file tree
Showing 189 changed files with 2,565 additions and 2,318 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ module.exports = {
{
// typescript for front and back end
files: [
'x-pack/plugins/{alerting,stack_alerts,actions,task_manager,event_log}/**/*.{ts,tsx}',
'x-pack/plugins/{alerting,stack_alerts,stack_connectors,actions,task_manager,event_log}/**/*.{ts,tsx}',
],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ x-pack/examples/files_example @elastic/kibana-app-services
/x-pack/plugins/actions/ @elastic/response-ops
/x-pack/plugins/event_log/ @elastic/response-ops
/x-pack/plugins/task_manager/ @elastic/response-ops
/x-pack/plugins/stack_connectors/ @elastic/response-ops
/x-pack/plugins/stack_connectors/server/connector_types/stack/ @elastic/response-ops-execution
/x-pack/plugins/stack_connectors/server/connector_types/cases/ @elastic/response-ops-cases
/x-pack/test/alerting_api_integration/ @elastic/response-ops
/x-pack/test/plugin_api_integration/test_suites/task_manager/ @elastic/response-ops
/x-pack/plugins/triggers_actions_ui/ @elastic/response-ops
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,10 @@ the alertTypes by the Stack in the alerting plugin, register associated HTTP
routes, etc.
|{kib-repo}blob/{branch}/x-pack/plugins/stack_connectors/README.md[stackConnectors]
|The stack_connectors plugin provides connector types shipped with Kibana, built on top of the framework provided in the actions plugin.
|{kib-repo}blob/{branch}/x-pack/plugins/synthetics/README.md[synthetics]
|The purpose of this plugin is to provide users of Heartbeat more visibility of what's happening
in their infrastructure.
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@
"@kbn/spaces-plugin/*": ["x-pack/plugins/spaces/*"],
"@kbn/stack-alerts-plugin": ["x-pack/plugins/stack_alerts"],
"@kbn/stack-alerts-plugin/*": ["x-pack/plugins/stack_alerts/*"],
"@kbn/stack-connectors-plugin": ["x-pack/plugins/stack_connectors"],
"@kbn/stack-connectors-plugin/*": ["x-pack/plugins/stack_connectors/*"],
"@kbn/synthetics-plugin": ["x-pack/plugins/synthetics"],
"@kbn/synthetics-plugin/*": ["x-pack/plugins/synthetics/*"],
"@kbn/task-manager-plugin": ["x-pack/plugins/task_manager"],
Expand Down
1 change: 1 addition & 0 deletions x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"xpack.alerting": "plugins/alerting",
"xpack.eventLog": "plugins/event_log",
"xpack.stackAlerts": "plugins/stack_alerts",
"xpack.stackConnectors": "plugins/stack_connectors",
"xpack.apm": "plugins/apm",
"xpack.canvas": "plugins/canvas",
"xpack.cases": "plugins/cases",
Expand Down
368 changes: 0 additions & 368 deletions x-pack/plugins/actions/README.md

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions x-pack/plugins/actions/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@ export * from './alert_history_schema';
export * from './rewrite_request_case';
export * from './mustache_template';
export * from './validate_email_addresses';
export * from './servicenow_config';
export * from './connector_feature_config';

export const BASE_ACTION_API_PATH = '/api/actions';
export const INTERNAL_BASE_ACTION_API_PATH = '/internal/actions';
export const ACTIONS_FEATURE_ID = 'actions';

// supported values for `service` in addition to nodemailer's list of well-known services
export enum AdditionalEmailServices {
ELASTIC_CLOUD = 'elastic_cloud',
EXCHANGE = 'exchange_server',
OTHER = 'other',
}
6 changes: 6 additions & 0 deletions x-pack/plugins/actions/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

import { LicenseType } from '@kbn/licensing-plugin/common/types';

export {
AlertingConnectorFeatureId,
CasesConnectorFeatureId,
UptimeConnectorFeatureId,
SecurityConnectorFeatureId,
} from './connector_feature_config';
export interface ActionType {
id: string;
name: string;
Expand Down
12 changes: 6 additions & 6 deletions x-pack/plugins/actions/server/actions_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ import {
} from './authorization/get_authorization_mode_by_source';
import { actionsAuthorizationMock } from './authorization/actions_authorization.mock';
import { trackLegacyRBACExemption } from './lib/track_legacy_rbac_exemption';
import { ConnectorTokenClient } from './builtin_action_types/lib/connector_token_client';
import { ConnectorTokenClient } from './lib/connector_token_client';
import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks';
import { Logger } from '@kbn/core/server';
import { connectorTokenClientMock } from './builtin_action_types/lib/connector_token_client.mock';
import { connectorTokenClientMock } from './lib/connector_token_client.mock';
import { inMemoryMetricsMock } from './monitoring/in_memory_metrics.mock';
import { getOAuthJwtAccessToken } from './builtin_action_types/lib/get_oauth_jwt_access_token';
import { getOAuthClientCredentialsAccessToken } from './builtin_action_types/lib/get_oauth_client_credentials_access_token';
import { getOAuthJwtAccessToken } from './lib/get_oauth_jwt_access_token';
import { getOAuthClientCredentialsAccessToken } from './lib/get_oauth_client_credentials_access_token';
import { OAuthParams } from './routes/get_oauth_access_token';

jest.mock('@kbn/core-saved-objects-utils-server', () => {
Expand Down Expand Up @@ -74,10 +74,10 @@ jest.mock('./authorization/get_authorization_mode_by_source', () => {
};
});

jest.mock('./builtin_action_types/lib/get_oauth_jwt_access_token', () => ({
jest.mock('./lib/get_oauth_jwt_access_token', () => ({
getOAuthJwtAccessToken: jest.fn(),
}));
jest.mock('./builtin_action_types/lib/get_oauth_client_credentials_access_token', () => ({
jest.mock('./lib/get_oauth_client_credentials_access_token', () => ({
getOAuthClientCredentialsAccessToken: jest.fn(),
}));

Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/actions/server/actions_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import {
} from './authorization/get_authorization_mode_by_source';
import { connectorAuditEvent, ConnectorAuditAction } from './lib/audit_events';
import { trackLegacyRBACExemption } from './lib/track_legacy_rbac_exemption';
import { isConnectorDeprecated } from './lib/is_conector_deprecated';
import { isConnectorDeprecated } from './lib/is_connector_deprecated';
import { ActionsConfigurationUtilities } from './actions_config';
import {
OAuthClientCredentialsParams,
Expand All @@ -66,12 +66,12 @@ import {
getOAuthJwtAccessToken,
GetOAuthJwtConfig,
GetOAuthJwtSecrets,
} from './builtin_action_types/lib/get_oauth_jwt_access_token';
} from './lib/get_oauth_jwt_access_token';
import {
getOAuthClientCredentialsAccessToken,
GetOAuthClientCredentialsConfig,
GetOAuthClientCredentialsSecrets,
} from './builtin_action_types/lib/get_oauth_client_credentials_access_token';
} from './lib/get_oauth_client_credentials_access_token';

// We are assuming there won't be many actions. This is why we will load
// all the actions in advance and assume the total count to not go over 10000.
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/actions/server/actions_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ActionsConfig, AllowedHosts, EnabledActionTypes, CustomHostSettings } f
import { getCanonicalCustomHostUrl } from './lib/custom_host_settings';
import { ActionTypeDisabledError } from './lib';
import { ProxySettings, ResponseSettings, SSLSettings } from './types';
import { getSSLSettingsFromConfig } from './builtin_action_types/lib/get_node_ssl_options';
import { getSSLSettingsFromConfig } from './lib/get_node_ssl_options';
import {
ValidateEmailAddressesOptions,
validateEmailAddresses,
Expand Down
65 changes: 0 additions & 65 deletions x-pack/plugins/actions/server/builtin_action_types/index.test.ts

This file was deleted.

86 changes: 0 additions & 86 deletions x-pack/plugins/actions/server/builtin_action_types/index.ts

This file was deleted.

25 changes: 0 additions & 25 deletions x-pack/plugins/actions/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,6 @@ export type {
FindActionResult,
} from './types';

export type {
CasesWebhookActionTypeId,
CasesWebhookActionParams,
EmailActionTypeId,
EmailActionParams,
IndexActionTypeId,
IndexActionParams,
PagerDutyActionTypeId,
PagerDutyActionParams,
ServerLogActionTypeId,
ServerLogActionParams,
SlackActionTypeId,
SlackActionParams,
WebhookActionTypeId,
WebhookActionParams,
ServiceNowITSMActionTypeId,
ServiceNowSIRActionTypeId,
ServiceNowActionParams,
JiraActionTypeId,
JiraActionParams,
ResilientActionTypeId,
ResilientActionParams,
TeamsActionTypeId,
TeamsActionParams,
} from './builtin_action_types';
export type { PluginSetupContract, PluginStartContract } from './plugin';

export { asSavedObjectExecutionSource, asHttpRequestExecutionSource } from './lib';
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/actions/server/lib/action_executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export class ActionExecutor {
secrets: validatedSecrets,
isEphemeral,
taskInfo,
configurationUtilities,
});
} catch (err) {
if (err.reason === ActionExecutionErrorReason.Validation) {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/actions/server/lib/axios_utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from './axios_utils';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { actionsConfigMock } from '../actions_config.mock';
import { getCustomAgents } from '../builtin_action_types/lib/get_custom_agents';
import { getCustomAgents } from './get_custom_agents';

const TestUrl = 'https://elastic.co/foo/bar/baz';

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/actions/server/lib/axios_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { isObjectLike, isEmpty } from 'lodash';
import { AxiosInstance, Method, AxiosResponse, AxiosRequestConfig } from 'axios';
import { Logger } from '@kbn/core/server';
import { getCustomAgents } from '../builtin_action_types/lib/get_custom_agents';
import { getCustomAgents } from './get_custom_agents';
import { ActionsConfigurationUtilities } from '../actions_config';

export const request = async <T = unknown>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { loggingSystemMock, savedObjectsClientMock } from '@kbn/core/server/mock
import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks';
import { ConnectorTokenClient } from './connector_token_client';
import { Logger } from '@kbn/core/server';
import { ConnectorToken } from '../../types';
import { ConnectorToken } from '../types';

const logger = loggingSystemMock.create().get() as jest.Mocked<Logger>;
jest.mock('@kbn/core-saved-objects-utils-server', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import { omitBy, isUndefined } from 'lodash';
import { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-plugin/server';
import { Logger, SavedObjectsClientContract, SavedObjectsUtils } from '@kbn/core/server';
import { ConnectorToken } from '../../types';
import { CONNECTOR_TOKEN_SAVED_OBJECT_TYPE } from '../../constants/saved_objects';
import { ConnectorToken } from '../types';
import { CONNECTOR_TOKEN_SAVED_OBJECT_TYPE } from '../constants/saved_objects';

export const MAX_TOKENS_RETURNED = 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import { LICENSE_TYPE } from '@kbn/licensing-plugin/common/types';
import { ActionType } from '../types';
import { ServerLogActionTypeId, IndexActionTypeId } from '../builtin_action_types';
import { ActionTypeConfig, ActionTypeSecrets, ActionTypeParams } from '../types';

const CASE_ACTION_TYPE_ID = '.case';

const ServerLogActionTypeId = '.server-log';
const IndexActionTypeId = '.index';
const ACTIONS_SCOPED_WITHIN_STACK = new Set([
ServerLogActionTypeId,
IndexActionTypeId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { HttpsProxyAgent } from 'https-proxy-agent';
import { Logger } from '@kbn/core/server';
import { getCustomAgents } from './get_custom_agents';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { actionsConfigMock } from '../../actions_config.mock';
import { actionsConfigMock } from '../actions_config.mock';
const logger = loggingSystemMock.create().get() as jest.Mocked<Logger>;

const targetHost = 'elastic.co';
Expand Down
Loading

0 comments on commit 914d1cd

Please sign in to comment.