Skip to content

Commit

Permalink
Merge branch 'split-alerting-api-integration-config' of github.com:dm…
Browse files Browse the repository at this point in the history
…lemeshko/kibana into split-alerting-api-integration-config
  • Loading branch information
dmlemeshko committed Jan 31, 2023
2 parents bdb49ce + 1b09548 commit 2539714
Show file tree
Hide file tree
Showing 162 changed files with 5,048 additions and 2,421 deletions.
18 changes: 16 additions & 2 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,16 @@ enabled:
- x-pack/test/fleet_api_integration/config.ts
- x-pack/test/fleet_functional/config.ts
- x-pack/test/ftr_apis/security_and_spaces/config.ts
- x-pack/test/functional_basic/config.ts
- x-pack/test/functional_basic/apps/ml/permissions/config.ts
- x-pack/test/functional_basic/apps/ml/data_visualizer/group1/config.ts
- x-pack/test/functional_basic/apps/ml/data_visualizer/group2/config.ts
- x-pack/test/functional_basic/apps/ml/data_visualizer/group3/config.ts
- x-pack/test/functional_basic/apps/transform/creation/index_pattern/config.ts
- x-pack/test/functional_basic/apps/transform/start_reset_delete/config.ts
- x-pack/test/functional_basic/apps/transform/edit_clone/config.ts
- x-pack/test/functional_basic/apps/transform/creation/runtime_mappings_saved_search/config.ts
- x-pack/test/functional_basic/apps/transform/permissions/config.ts
- x-pack/test/functional_basic/apps/transform/feature_controls/config.ts
- x-pack/test/functional_cors/config.ts
- x-pack/test/functional_embedded/config.ts
- x-pack/test/functional_enterprise_search/without_host_configured.config.ts
Expand Down Expand Up @@ -221,7 +230,12 @@ enabled:
- x-pack/test/functional/apps/snapshot_restore/config.ts
- x-pack/test/functional/apps/spaces/config.ts
- x-pack/test/functional/apps/status_page/config.ts
- x-pack/test/functional/apps/transform/config.ts
- x-pack/test/functional/apps/transform/creation/index_pattern/config.ts
- x-pack/test/functional/apps/transform/creation/runtime_mappings_saved_search/config.ts
- x-pack/test/functional/apps/transform/start_reset_delete/config.ts
- x-pack/test/functional/apps/transform/edit_clone/config.ts
- x-pack/test/functional/apps/transform/permissions/config.ts
- x-pack/test/functional/apps/transform/feature_controls/config.ts
- x-pack/test/functional/apps/upgrade_assistant/config.ts
- x-pack/test/functional/apps/uptime/config.ts
- x-pack/test/functional/apps/visualize/config.ts
Expand Down
14 changes: 7 additions & 7 deletions docs/management/action-types.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ a| <<cases-webhook-action-type,{webhook-cm}>>
a| <<xmatters-action-type,xMatters>>

| Send actionable alerts to on-call xMatters resources.

a| <<torq-action-type,Torq>>

| Trigger a Torq workflow.
|===

[NOTE]
Expand Down Expand Up @@ -141,6 +145,9 @@ image::images/connector-select-type.png[Connector select type]
After you create a connector, it is available for use any time you set up an
action in the current space.

For out-of-the-box and standardized connectors, refer to
<<pre-configured-connectors,preconfigured connectors>>.

[float]
[[importing-and-exporting-connectors]]
=== Importing and exporting connectors
Expand All @@ -157,13 +164,6 @@ button appears in *{connectors-ui}*.
[role="screenshot"]
image::images/connectors-with-missing-secrets.png[Connectors with missing secrets]

[float]
[[create-connectors]]
=== Preconfigured connectors

For out-of-the-box and standardized connectors, you can <<preconfigured-connector-example, preconfigure connectors>>
before {kib} starts.

[float]
[[montoring-connectors]]
=== Monitoring connectors
Expand Down
65 changes: 65 additions & 0 deletions docs/management/connectors/action-types/torq.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[role="xpack"]
[[torq-action-type]]
=== Torq connector and action
++++
<titleabbrev>Torq</titleabbrev>
++++

The Torq connector uses a Torq webhook to trigger workflows with Kibana actions.

[float]
[[torq-connector-configuration]]
==== Connector configuration
Torq connectors have the following configuration properties.

Name:: The name of the connector. The name is used to identify a connector in the Stack Management UI connector listing, and in the connector list when configuring an action.

Torq endpoint URL:: Endpoint URL (webhook) of the Elastic Security integration you created in Torq.

Torq authentication header secret:: Secret of the webhook authentication header.

[float]
[[Preconfigured-torq-configuration]]
==== Preconfigured connector type

[source,yaml]
--
my-torq:
name: preconfigured-torq-connector-type
actionTypeId: .torq
config:
webhookIntegrationUrl: https://hooks.torq.io/v1/somehook
secrets:
token: mytorqtoken
--

Config defines information for the connector type.

`webhookIntegrationUrl`:: An address that corresponds to **Torq endpoint URL**.

Secrets defines sensitive information for the connector type.

`token`:: A string that corresponds to **Torq authentication header secret**.

[float]
[[define-torq-ui]]
==== Define connector in Stack Management

Define Torq connector properties.

[role="screenshot"]
image::management/connectors/images/torq-configured-connector.png[configured Torq connector]

Test Torq action parameters.

[role="screenshot"]
image::management/connectors/images/torq-connector-test.png[Torq connector test]

[float]
[[torq-action-configuration]]
==== Action configuration

Torq actions have the following configuration properties.

Body:: JSON payload to send to Torq.

Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/management/connectors/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ include::action-types/servicenow-itom.asciidoc[leveloffset=+1]
include::action-types/swimlane.asciidoc[]
include::action-types/slack.asciidoc[]
include::action-types/tines.asciidoc[leveloffset=+1]
include::action-types/torq.asciidoc[]
include::action-types/webhook.asciidoc[]
include::action-types/cases-webhook.asciidoc[leveloffset=+1]
include::action-types/xmatters.asciidoc[]
include::pre-configured-connectors.asciidoc[]
include::pre-configured-connectors.asciidoc[leveloffset=+1]

42 changes: 22 additions & 20 deletions docs/management/connectors/pre-configured-connectors.asciidoc
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
[role="xpack"]
[[pre-configured-connectors]]
=== Preconfigured connectors
== Preconfigured connectors

You can preconfigure a connector to have all the information it needs prior to
startup by adding it to the `kibana.yml` file.
If you are running {kib} on-prem, you can preconfigure a connector to have all
the information it needs prior to startup by adding it to the `kibana.yml` file.

NOTE: {ess} provides a preconfigured email connector but you cannot create
additional preconfigured connectors.

Preconfigured connectors offer the following benefits:

- Require no setup. Configuration and credentials needed to execute an
action are predefined, including the connector name and ID.
- Require no setup. Configuration and credentials needed to run an action are
predefined, including the connector name and ID.
- Appear in all spaces because they are not saved objects.
- Cannot be edited or deleted.

[float]
[[preconfigured-connector-example]]
==== Preconfigured connectors example
[[create-preconfigured-connectors]]
=== Create preconfigured connectors

Add `xpack.actions.preconfigured` settings to your `kibana.yml` file. The
settings vary depending on which type of connector you're adding.

This example shows a valid configuration for
two out-of-the box connectors: <<slack-action-type, Slack>> and
<<webhook-action-type, Webhook>>.
This example shows a valid configuration for a Slack connector and a Webhook
connector:

```js
xpack.actions.preconfigured:
Expand Down Expand Up @@ -50,31 +54,29 @@ two out-of-the box connectors: <<slack-action-type, Slack>> and
[NOTE]
==============================================
Sensitive properties, such as passwords, can also be stored in the
<<creating-keystore, {kib} keystore>>.
<<creating-keystore,{kib} keystore>>.
==============================================

[float]
[[build-in-preconfigured-connectors]]
==== Built-in preconfigured connectors
=== Built-in preconfigured connectors

{kib} provides the following built-in preconfigured connectors:

* <<preconfigured-connector-alert-history, Alert history preconfigured {es} index connector>>
* <<elasticcloud, `Elastic-Cloud-SMTP` preconfigured email connector>>
* <<preconfigured-connector-alert-history,Alert history preconfigured {es} index connector>>
* <<elasticcloud,`Elastic-Cloud-SMTP` preconfigured email connector>>

[float]
[[managing-pre-configured-connectors]]
==== View preconfigured connectors
=== View preconfigured connectors

When you open the main menu, click *{stack-manage-app} > {connectors-ui}*.
Preconfigured connectors appear regardless of which space you are
in. They are tagged as “preconfigured”, and you cannot delete them.

[role="screenshot"]
image::images/pre-configured-connectors-managing.png[Connectors managing tab with pre-configured]
image::images/preconfigured-connectors-managing.png[Connectors managing tab with pre-configured]

Clicking a preconfigured connector shows the description, but not the
configuration. A message indicates that this is a preconfigured connector.
configuration.

[role="screenshot"]
image::images/pre-configured-connectors-view-screen.png[Pre-configured connector view details]
2 changes: 1 addition & 1 deletion docs/settings/alert-action-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ A list of allowed email domains which can be used with the email connector. When
WARNING: This feature is available in {kib} 7.17.4 and 8.3.0 onwards but is not supported in {kib} 8.0, 8.1 or 8.2. As such, this setting should be removed before upgrading from 7.17 to 8.0, 8.1 or 8.2. It is possible to configure the settings in 7.17.4 and then upgrade to 8.3.0 directly.

`xpack.actions.enabledActionTypes` {ess-icon}::
A list of action types that are enabled. It defaults to `[*]`, enabling all types. The names for built-in {kib} action types are prefixed with a `.` and include: `.email`, `.index`, `.jira`, `.opsgenie`, `.pagerduty`, `.resilient`, `.server-log`, `.servicenow`, .`servicenow-itom`, `.servicenow-sir`, `.slack`, `.swimlane`, `.teams`, `.tines`, `.xmatters`, and `.webhook`. An empty list `[]` will disable all action types.
A list of action types that are enabled. It defaults to `[*]`, enabling all types. The names for built-in {kib} action types are prefixed with a `.` and include: `.email`, `.index`, `.jira`, `.opsgenie`, `.pagerduty`, `.resilient`, `.server-log`, `.servicenow`, .`servicenow-itom`, `.servicenow-sir`, `.slack`, `.swimlane`, `.teams`, `.tines`, `.torq`, `.xmatters`, and `.webhook`. An empty list `[]` will disable all action types.
+
Disabled action types will not appear as an option when creating new connectors, but existing connectors and actions of that type will remain in {kib} and will not function.

Expand Down
11 changes: 0 additions & 11 deletions x-pack/plugins/cases/common/api/connectors/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ import { SwimlaneFieldsRT } from './swimlane';
export type ActionConnector = ActionResult;
export type ActionTypeConnector = ActionType;

export const ConnectorFieldsRt = rt.union([
JiraFieldsRT,
ResilientFieldsRT,
ServiceNowITSMFieldsRT,
ServiceNowSIRFieldsRT,
rt.null,
]);

export enum ConnectorTypes {
casesWebhook = '.cases-webhook',
jira = '.jira',
Expand Down Expand Up @@ -114,6 +106,3 @@ export type ConnectorServiceNowITSMTypeFields = rt.TypeOf<
typeof ConnectorServiceNowITSMTypeFieldsRt
>;
export type ConnectorServiceNowSIRTypeFields = rt.TypeOf<typeof ConnectorServiceNowSIRTypeFieldsRt>;

// we need to change these types back and forth for storing in ES (arrays overwrite, objects merge)
export type ConnectorFields = rt.TypeOf<typeof ConnectorFieldsRt>;
5 changes: 5 additions & 0 deletions x-pack/plugins/cases/common/api/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
CASE_COMMENT_DELETE_URL,
CASE_FIND_USER_ACTIONS_URL,
INTERNAL_BULK_GET_ATTACHMENTS_URL,
INTERNAL_CONNECTORS_URL,
} from '../constants';

export const getCaseDetailsUrl = (id: string): string => {
Expand Down Expand Up @@ -62,3 +63,7 @@ export const getCasesFromAlertsUrl = (alertId: string): string => {
export const getCaseBulkGetAttachmentsUrl = (id: string): string => {
return INTERNAL_BULK_GET_ATTACHMENTS_URL.replace('{case_id}', id);
};

export const getCaseConnectorsUrl = (id: string): string => {
return INTERNAL_CONNECTORS_URL.replace('{case_id}', id);
};
4 changes: 2 additions & 2 deletions x-pack/plugins/cases/common/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type {
CaseStatuses,
User,
ActionConnector,
CaseExternalServiceBasic,
CaseUserActionResponse,
SingleCaseMetricsResponse,
CommentResponse,
Expand All @@ -30,6 +29,7 @@ import type {
CaseSeverity,
CommentResponseExternalReferenceType,
CommentResponseTypePersistableState,
GetCaseConnectorsResponse,
} from '../api';
import type { PUSH_CASES_CAPABILITY } from '../constants';
import type { SnakeToCamelCase } from '../types';
Expand Down Expand Up @@ -81,12 +81,12 @@ export type CaseUserActions = SnakeToCamelCase<CaseUserActionResponse>;
export type FindCaseUserActions = Omit<SnakeToCamelCase<UserActionFindResponse>, 'userActions'> & {
userActions: CaseUserActions[];
};
export type CaseExternalService = SnakeToCamelCase<CaseExternalServiceBasic>;
export type Case = Omit<SnakeToCamelCase<CaseResponse>, 'comments'> & { comments: Comment[] };
export type Cases = Omit<SnakeToCamelCase<CasesFindResponse>, 'cases'> & { cases: Case[] };
export type CasesStatus = SnakeToCamelCase<CasesStatusResponse>;
export type CasesMetrics = SnakeToCamelCase<CasesMetricsResponse>;
export type CaseUpdateRequest = SnakeToCamelCase<CasePatchRequest>;
export type CaseConnectors = SnakeToCamelCase<GetCaseConnectorsResponse>;

export interface ResolvedCase {
case: Case;
Expand Down
37 changes: 34 additions & 3 deletions x-pack/plugins/cases/public/common/mock/connectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
*/

import type { ActionConnector, ActionTypeConnector } from '../../../common/api';
import { basicPush } from '../../containers/mock';
import type { CaseConnectors } from '../../containers/types';

export const connectorsMock: ActionConnector[] = [
{
id: 'servicenow-1',
actionTypeId: '.servicenow',
name: 'My Connector',
name: 'My SN connector',
config: {
apiUrl: 'https://instance1.service-now.com',
},
Expand All @@ -21,7 +23,7 @@ export const connectorsMock: ActionConnector[] = [
{
id: 'resilient-2',
actionTypeId: '.resilient',
name: 'My Connector 2',
name: 'My Resilient connector',
config: {
apiUrl: 'https://test/',
orgId: '201',
Expand Down Expand Up @@ -52,7 +54,7 @@ export const connectorsMock: ActionConnector[] = [
{
id: 'servicenow-uses-table-api',
actionTypeId: '.servicenow',
name: 'My Connector',
name: 'My deprecated SN connector',
config: {
apiUrl: 'https://instance1.service-now.com',
usesTableApi: true,
Expand Down Expand Up @@ -118,3 +120,32 @@ export const actionTypesMock: ActionTypeConnector[] = [
supportedFeatureIds: ['alerting', 'cases'],
},
];

export const getCaseConnectorsMockResponse = (
overrides: Partial<CaseConnectors[string]['push']> = {}
): CaseConnectors => {
return connectorsMock.reduce(
(acc, connector) => ({
...acc,
[connector.id]: {
id: connector.id,
name: connector.name,
type: connector.actionTypeId,
fields: null,
push: {
needsToBePushed: false,
oldestUserActionPushDate: '2023-01-17T09:46:29.813Z',
latestUserActionPushDate: '2023-01-17T09:46:29.813Z',
hasBeenPushed: true,
externalService: {
...basicPush,
connectorId: connector.id,
connectorName: connector.name,
},
...overrides,
},
},
}),
{}
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { registerConnectorsToMockActionRegistry } from '../../common/mock/regist
import { createStartServicesMock } from '../../common/lib/kibana/kibana_react.mock';
import { waitForComponentToUpdate } from '../../common/test_utils';
import { useCreateAttachments } from '../../containers/use_create_attachments';
import { useGetConnectors } from '../../containers/configure/use_connectors';
import { useGetSupportedActionConnectors } from '../../containers/configure/use_get_supported_action_connectors';
import { useGetTags } from '../../containers/use_get_tags';
import { useUpdateCase } from '../../containers/use_update_case';
import { useGetCases, DEFAULT_QUERY_PARAMS } from '../../containers/use_get_cases';
Expand All @@ -52,7 +52,7 @@ jest.mock('../../containers/use_get_action_license');
jest.mock('../../containers/use_get_tags');
jest.mock('../../containers/user_profiles/use_get_current_user_profile');
jest.mock('../../containers/user_profiles/use_bulk_get_user_profiles');
jest.mock('../../containers/configure/use_connectors');
jest.mock('../../containers/configure/use_get_supported_action_connectors');
jest.mock('../../common/lib/kibana');
jest.mock('../../common/navigation/hooks');
jest.mock('../app/use_available_owners', () => ({
Expand All @@ -66,7 +66,7 @@ const useGetTagsMock = useGetTags as jest.Mock;
const useGetCurrentUserProfileMock = useGetCurrentUserProfile as jest.Mock;
const useBulkGetUserProfilesMock = useBulkGetUserProfiles as jest.Mock;
const useKibanaMock = useKibana as jest.MockedFunction<typeof useKibana>;
const useGetConnectorsMock = useGetConnectors as jest.Mock;
const useGetConnectorsMock = useGetSupportedActionConnectors as jest.Mock;
const useCreateAttachmentsMock = useCreateAttachments as jest.Mock;
const useUpdateCaseMock = useUpdateCase as jest.Mock;
const useLicenseMock = useLicense as jest.Mock;
Expand Down
Loading

0 comments on commit 2539714

Please sign in to comment.