-
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.
[7.x] Added default dedupKey value as an {{alertInstanceId}} to provi…
…de grouping functionality for PagerDuty incidents. (#83226) (#83985) * Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. (#83226) * Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. Set default savedObjectId as {{alertInstanceId}} for ServiceNow, Resilient and Jira * fixed comment * fixed due to comments * fixed doc * fixed due to comments * fixed type checks
- Loading branch information
1 parent
674179d
commit 8a0c7be
Showing
13 changed files
with
92 additions
and
14 deletions.
There are no files selected for viewing
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
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
25 changes: 25 additions & 0 deletions
25
...plugins/triggers_actions_ui/public/application/lib/get_defaults_for_action_params.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,25 @@ | ||
/* | ||
* 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 { ResolvedActionGroup } from '../../../../alerts/common'; | ||
import { AlertProvidedActionVariables } from './action_variables'; | ||
import { getDefaultsForActionParams } from './get_defaults_for_action_params'; | ||
|
||
describe('getDefaultsForActionParams', () => { | ||
test('pagerduty defaults', async () => { | ||
expect(getDefaultsForActionParams('.pagerduty', 'test')).toEqual({ | ||
dedupKey: `{{${AlertProvidedActionVariables.alertId}}}:{{${AlertProvidedActionVariables.alertInstanceId}}}`, | ||
eventAction: 'trigger', | ||
}); | ||
}); | ||
|
||
test('pagerduty defaults for resolved action group', async () => { | ||
expect(getDefaultsForActionParams('.pagerduty', ResolvedActionGroup.id)).toEqual({ | ||
dedupKey: `{{${AlertProvidedActionVariables.alertId}}}:{{${AlertProvidedActionVariables.alertInstanceId}}}`, | ||
eventAction: 'resolve', | ||
}); | ||
}); | ||
}); |
25 changes: 25 additions & 0 deletions
25
x-pack/plugins/triggers_actions_ui/public/application/lib/get_defaults_for_action_params.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,25 @@ | ||
/* | ||
* 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 { AlertActionParam, ResolvedActionGroup } from '../../../../alerts/common'; | ||
import { AlertProvidedActionVariables } from './action_variables'; | ||
|
||
export const getDefaultsForActionParams = ( | ||
actionTypeId: string, | ||
actionGroupId: string | ||
): Record<string, AlertActionParam> | undefined => { | ||
switch (actionTypeId) { | ||
case '.pagerduty': | ||
const pagerDutyDefaults = { | ||
dedupKey: `{{${AlertProvidedActionVariables.alertId}}}:{{${AlertProvidedActionVariables.alertInstanceId}}}`, | ||
eventAction: 'trigger', | ||
}; | ||
if (actionGroupId === ResolvedActionGroup.id) { | ||
pagerDutyDefaults.eventAction = 'resolve'; | ||
} | ||
return pagerDutyDefaults; | ||
} | ||
}; |
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