forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a built-in PagerDuty action (elastic#43395)
The PagerDuty action can be used to post events via the PagerDuty Events API v2: https://v2.developer.pagerduty.com/docs/events-api-v2
- Loading branch information
Showing
9 changed files
with
949 additions
and
48 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
26 changes: 26 additions & 0 deletions
26
x-pack/legacy/plugins/actions/server/builtin_action_types/lib/post_pagerduty.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,26 @@ | ||
/* | ||
* 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 axios, { AxiosResponse } from 'axios'; | ||
import { Services } from '../../types'; | ||
|
||
interface PostPagerdutyOptions { | ||
apiUrl: string; | ||
data: any; | ||
headers: Record<string, string>; | ||
services: Services; | ||
} | ||
|
||
// post an event to pagerduty | ||
export async function postPagerduty(options: PostPagerdutyOptions): Promise<AxiosResponse> { | ||
const { apiUrl, data, headers } = options; | ||
const axiosOptions = { | ||
headers, | ||
validateStatus: () => true, | ||
}; | ||
|
||
return axios.post(apiUrl, data, axiosOptions); | ||
} |
Oops, something went wrong.