kibana/x-pack/plugins/alerts/common/disabled_action_groups.ts
ymao1 f3d60c519d
[Actions] Disable 'Resolved' action group for ServiceNow, Jira and IBM Resilient action types (#83829)
* Adding disabled action groups to action type definition

* Adding tests

* Adding tests

* renamed Resolved to Recovered

* fixed missing import

* fixed buggy default message behaviour

* added missing test

* fixed typing

* fixed resolved in tests

* allows alert types to specify their own custom recovery group name

* removed unnecesery field on always fires

* allows alert types to specify their own custom recovery group

* fixed mock alert types throughout unit tests

* fixed typing issues

* reduce repetition of mock data

* fixed alert type list test

* support legacy event log alert recovery syntax

* added doc

* removed unneeded change in jira

* correct callback name in siem

* renamed resolved to  recovered

* fixed mistaken rename

* Moving to alert plugin

* Updating tests

* elvated default params to alert concern instead of actions concern

* made default params optional

* Adding test

* Moving where default action params are retrieved

* Revert "Moving where default action params are retrieved"

This reverts commit 76e7608229.

* Moving where default action params are retrieved

* Cleanup

* Fixing test

* PR fixes

Co-authored-by: Gidi Meir Morris <github@gidi.io>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-09 09:45:38 -05:00

25 lines
859 B
TypeScript

/*
* 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 { RecoveredActionGroup } from './builtin_action_groups';
const DisabledActionGroupsByActionType: Record<string, string[]> = {
[RecoveredActionGroup.id]: ['.jira', '.servicenow', '.resilient'],
};
export const DisabledActionTypeIdsForActionGroup: Map<string, string[]> = new Map(
Object.entries(DisabledActionGroupsByActionType)
);
export function isActionGroupDisabledForActionTypeId(
actionGroup: string,
actionTypeId: string
): boolean {
return (
DisabledActionTypeIdsForActionGroup.has(actionGroup) &&
DisabledActionTypeIdsForActionGroup.get(actionGroup)!.includes(actionTypeId)
);
}