-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Actions] Disable 'Resolved' action group for ServiceNow, Jira and IB…
…M 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 76e7608. * Moving where default action params are retrieved * Cleanup * Fixing test * PR fixes Co-authored-by: Gidi Meir Morris <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
efe3c59
commit f3d60c5
Showing
7 changed files
with
219 additions
and
4 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
x-pack/plugins/alerts/common/disabled_action_groups.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* 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 { isActionGroupDisabledForActionTypeId } from './disabled_action_groups'; | ||
import { RecoveredActionGroup } from './builtin_action_groups'; | ||
|
||
test('returns false if action group id has no disabled types', () => { | ||
expect(isActionGroupDisabledForActionTypeId('enabledActionGroup', '.jira')).toBeFalsy(); | ||
}); | ||
|
||
test('returns false if action group id does not contains type', () => { | ||
expect(isActionGroupDisabledForActionTypeId(RecoveredActionGroup.id, '.email')).toBeFalsy(); | ||
}); | ||
|
||
test('returns true if action group id does contain type', () => { | ||
expect(isActionGroupDisabledForActionTypeId(RecoveredActionGroup.id, '.jira')).toBeTruthy(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* 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) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters