snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
0
zerver/webhooks/pagerduty/__init__.py
Normal file
0
zerver/webhooks/pagerduty/__init__.py
Normal file
29
zerver/webhooks/pagerduty/doc.md
Normal file
29
zerver/webhooks/pagerduty/doc.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Zulip PagerDuty integration
|
||||
|
||||
Get Zulip notifications for your PagerDuty services!
|
||||
|
||||
{start_tabs}
|
||||
|
||||
1. {!create-an-incoming-webhook.md!}
|
||||
|
||||
1. {!generate-webhook-url-basic.md!}
|
||||
|
||||
1. Open the **Integrations** tab, and click **Generic Webhooks (v3)**.
|
||||
Click **Add Webhook**.
|
||||
|
||||
1. Set **Webhook URL** to the URL generated above, configure the **Scope
|
||||
Type** and **Scope** you want to receive notifications for, select
|
||||
the [events](#filtering-incoming-events) you want to send under
|
||||
**Events to Send**, and click **Add Webhook**.
|
||||
|
||||
{end_tabs}
|
||||
|
||||
{!congrats.md!}
|
||||
|
||||

|
||||
|
||||
{!event-filtering-additional-feature.md!}
|
||||
|
||||
### Related documentation
|
||||
|
||||
{!webhooks-url-specification.md!}
|
||||
286
zerver/webhooks/pagerduty/fixtures/acknowledge_v2.json
Normal file
286
zerver/webhooks/pagerduty/fixtures/acknowledge_v2.json
Normal file
@@ -0,0 +1,286 @@
|
||||
{
|
||||
"messages":[
|
||||
{
|
||||
"event":"incident.acknowledge",
|
||||
"log_entries":[
|
||||
{
|
||||
"id":"RRPP3746OFFZZ742NSP1G67AWC",
|
||||
"type":"acknowledge_log_entry",
|
||||
"summary":"Acknowledged by Laura Haley",
|
||||
"self":"https://api.pagerduty.com/log_entries/RRPP3746OFFZZ742NSP1G67AWC",
|
||||
"html_url":null,
|
||||
"created_at":"2017-09-26T15:15:17Z",
|
||||
"agent":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
},
|
||||
"channel":{
|
||||
"type":"website"
|
||||
},
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"incident":{
|
||||
"id":"PRORDTY",
|
||||
"type":"incident_reference",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY"
|
||||
},
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"contexts":[
|
||||
|
||||
],
|
||||
"acknowledgement_timeout":1800,
|
||||
"event_details":{
|
||||
|
||||
}
|
||||
}
|
||||
],
|
||||
"webhook":{
|
||||
"endpoint_url":"https://requestb.in/18ao6fs1",
|
||||
"name":"V2 wabhook",
|
||||
"description":null,
|
||||
"webhook_object":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"config":{
|
||||
|
||||
},
|
||||
"outbound_integration":{
|
||||
"id":"PJFWPEP",
|
||||
"type":"outbound_integration_reference",
|
||||
"summary":"Generic V2 Webhook",
|
||||
"self":"https://api.pagerduty.com/outbound_integrations/PJFWPEP",
|
||||
"html_url":null
|
||||
},
|
||||
"accounts_addon":null,
|
||||
"id":"PKT9NNX",
|
||||
"type":"webhook",
|
||||
"summary":"V2 wabhook",
|
||||
"self":"https://api.pagerduty.com/webhooks/PKT9NNX",
|
||||
"html_url":null
|
||||
},
|
||||
"incident":{
|
||||
"incident_number":33,
|
||||
"title":"My new incident",
|
||||
"description":"My new incident",
|
||||
"created_at":"2017-09-26T15:14:36Z",
|
||||
"status":"acknowledged",
|
||||
"pending_actions":[
|
||||
{
|
||||
"type":"unacknowledge",
|
||||
"at":"2017-09-26T15:45:17Z"
|
||||
},
|
||||
{
|
||||
"type":"resolve",
|
||||
"at":"2017-09-26T19:14:36Z"
|
||||
}
|
||||
],
|
||||
"incident_key":null,
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"name":"Production XDB Cluster",
|
||||
"description":"This service was created during onboarding on July 5, 2017.",
|
||||
"auto_resolve_timeout":14400,
|
||||
"acknowledgement_timeout":1800,
|
||||
"created_at":"2017-07-05T17:33:09Z",
|
||||
"status":"warning",
|
||||
"last_incident_timestamp":"2017-09-26T15:14:36Z",
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"incident_urgency_rule":{
|
||||
"type":"constant",
|
||||
"urgency":"high"
|
||||
},
|
||||
"scheduled_actions":[
|
||||
|
||||
],
|
||||
"support_hours":null,
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"addons":[
|
||||
|
||||
],
|
||||
"privilege":null,
|
||||
"alert_creation":"create_alerts_and_incidents",
|
||||
"integrations":[
|
||||
{
|
||||
"id":"PUAYF96",
|
||||
"type":"generic_events_api_inbound_integration_reference",
|
||||
"summary":"API",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/PUAYF96",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/PUAYF96"
|
||||
},
|
||||
{
|
||||
"id":"P90GZUH",
|
||||
"type":"generic_email_inbound_integration_reference",
|
||||
"summary":"Email",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/P90GZUH",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/P90GZUH"
|
||||
}
|
||||
],
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"type":"service",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"assignments":[
|
||||
{
|
||||
"at":"2017-09-26T15:14:36Z",
|
||||
"assignee":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
}
|
||||
}
|
||||
],
|
||||
"acknowledgements":[
|
||||
{
|
||||
"at":"2017-09-26T15:15:17Z",
|
||||
"acknowledger":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
}
|
||||
}
|
||||
],
|
||||
"last_status_change_at":"2017-09-26T15:15:17Z",
|
||||
"last_status_change_by":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
},
|
||||
"first_trigger_log_entry":{
|
||||
"id":"R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"type":"trigger_log_entry_reference",
|
||||
"summary":"Triggered through the website",
|
||||
"self":"https://api.pagerduty.com/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E"
|
||||
},
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"privilege":null,
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"alert_counts":{
|
||||
"all":0,
|
||||
"triggered":0,
|
||||
"resolved":0
|
||||
},
|
||||
"impacted_services":[
|
||||
{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
}
|
||||
],
|
||||
"is_mergeable":true,
|
||||
"basic_alert_grouping":null,
|
||||
"alert_grouping":null,
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"external_references":[
|
||||
{
|
||||
"id":"PLF5V5G",
|
||||
"type":"incident_external_reference",
|
||||
"summary":"Slack",
|
||||
"self":null,
|
||||
"html_url":null,
|
||||
"external_id":"1506438878.000302",
|
||||
"external_url":"http://webdemo.slack.com/archives/C6975FLAZ/p1506438878.000302",
|
||||
"sync":false,
|
||||
"webhook":{
|
||||
"id":"PRXV5AH",
|
||||
"type":"webhook_reference",
|
||||
"summary":"Slack M2M",
|
||||
"self":"https://api.pagerduty.com/webhooks/PRXV5AH",
|
||||
"html_url":null
|
||||
}
|
||||
}
|
||||
],
|
||||
"importance":null,
|
||||
"incidents_responders":[
|
||||
|
||||
],
|
||||
"responder_requests":[
|
||||
|
||||
],
|
||||
"subscriber_requests":[
|
||||
|
||||
],
|
||||
"urgency":"high",
|
||||
"id":"PRORDTY",
|
||||
"type":"incident",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY",
|
||||
"alerts":[
|
||||
{
|
||||
"alert_key":"c24117fc42e44b44b4d6876190583378"
|
||||
},
|
||||
{
|
||||
"alert_key":"2d6ee0a6b58040f7996a4047ae5edcd7"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id":"82a33960-a2cd-11e7-8f69-22000affca53",
|
||||
"created_on":"2017-09-26T15:15:17Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
53
zerver/webhooks/pagerduty/fixtures/acknowledged_v3.json
Normal file
53
zerver/webhooks/pagerduty/fixtures/acknowledged_v3.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"event": {
|
||||
"id": "01BZYK8N47N5JG55J1EEEHPEJI",
|
||||
"event_type": "incident.acknowledged",
|
||||
"resource_type": "incident",
|
||||
"occurred_at": "2021-06-04T13:55:30.394Z",
|
||||
"agent": {
|
||||
"html_url": "https://pig208.pagerduty.com/users/PJ0LVEB",
|
||||
"id": "PJ0LVEB",
|
||||
"self": "https://api.pagerduty.com/users/PJ0LVEB",
|
||||
"summary": "PIG 208",
|
||||
"type": "user_reference"
|
||||
},
|
||||
"client": null,
|
||||
"data": {
|
||||
"id": "PQ1K5C8",
|
||||
"type": "incident",
|
||||
"self": "https://api.pagerduty.com/incidents/PQ1K5C8",
|
||||
"html_url": "https://pig208.pagerduty.com/incidents/PQ1K5C8",
|
||||
"number": 10,
|
||||
"status": "acknowledged",
|
||||
"title": "Test Incident",
|
||||
"service": {
|
||||
"html_url": "https://pig208.pagerduty.com/services/PA2P440",
|
||||
"id": "PA2P440",
|
||||
"self": "https://api.pagerduty.com/services/PA2P440",
|
||||
"summary": "pig208",
|
||||
"type": "service_reference"
|
||||
},
|
||||
"assignees": [
|
||||
{
|
||||
"html_url": "https://pig208.pagerduty.com/users/PJ0LVEB",
|
||||
"id": "PJ0LVEB",
|
||||
"self": "https://api.pagerduty.com/users/PJ0LVEB",
|
||||
"summary": "PIG 208",
|
||||
"type": "user_reference"
|
||||
}
|
||||
],
|
||||
"escalation_policy": {
|
||||
"html_url": "https://pig208.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"id": "PY82TC6",
|
||||
"self": "https://api.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"summary": "Default",
|
||||
"type": "escalation_policy_reference"
|
||||
},
|
||||
"teams": [],
|
||||
"priority": null,
|
||||
"urgency": "high",
|
||||
"conference_bridge": null,
|
||||
"resolve_reason": null
|
||||
}
|
||||
}
|
||||
}
|
||||
278
zerver/webhooks/pagerduty/fixtures/assign_v2.json
Normal file
278
zerver/webhooks/pagerduty/fixtures/assign_v2.json
Normal file
@@ -0,0 +1,278 @@
|
||||
{
|
||||
"messages":[
|
||||
{
|
||||
"event":"incident.assign",
|
||||
"log_entries":[
|
||||
{
|
||||
"id":"R6XNGC35VF6U1TUSVIE2DWXD4Z",
|
||||
"type":"assign_log_entry",
|
||||
"summary":"Assigned to Wiley Jacobson by Laura Haley",
|
||||
"self":"https://api.pagerduty.com/log_entries/R6XNGC35VF6U1TUSVIE2DWXD4Z",
|
||||
"html_url":null,
|
||||
"created_at":"2017-09-26T15:16:05Z",
|
||||
"agent":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
},
|
||||
"channel":{
|
||||
"type":"website"
|
||||
},
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"incident":{
|
||||
"id":"PRORDTY",
|
||||
"type":"incident_reference",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY"
|
||||
},
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"contexts":[
|
||||
|
||||
],
|
||||
"assignees":[
|
||||
{
|
||||
"id":"PFBSJ2Z",
|
||||
"type":"user_reference",
|
||||
"summary":"Wiley Jacobson",
|
||||
"self":"https://api.pagerduty.com/users/PFBSJ2Z",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/PFBSJ2Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"webhook":{
|
||||
"endpoint_url":"https://requestb.in/18ao6fs1",
|
||||
"name":"V2 wabhook",
|
||||
"description":null,
|
||||
"webhook_object":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"config":{
|
||||
|
||||
},
|
||||
"outbound_integration":{
|
||||
"id":"PJFWPEP",
|
||||
"type":"outbound_integration_reference",
|
||||
"summary":"Generic V2 Webhook",
|
||||
"self":"https://api.pagerduty.com/outbound_integrations/PJFWPEP",
|
||||
"html_url":null
|
||||
},
|
||||
"accounts_addon":null,
|
||||
"id":"PKT9NNX",
|
||||
"type":"webhook",
|
||||
"summary":"V2 wabhook",
|
||||
"self":"https://api.pagerduty.com/webhooks/PKT9NNX",
|
||||
"html_url":null
|
||||
},
|
||||
"incident":{
|
||||
"incident_number":33,
|
||||
"title":"My new incident",
|
||||
"description":"My new incident",
|
||||
"created_at":"2017-09-26T15:14:36Z",
|
||||
"status":"triggered",
|
||||
"pending_actions":[
|
||||
{
|
||||
"type":"resolve",
|
||||
"at":"2017-09-26T19:14:36Z"
|
||||
}
|
||||
],
|
||||
"incident_key":null,
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"name":"Production XDB Cluster",
|
||||
"description":"This service was created during onboarding on July 5, 2017.",
|
||||
"auto_resolve_timeout":14400,
|
||||
"acknowledgement_timeout":1800,
|
||||
"created_at":"2017-07-05T17:33:09Z",
|
||||
"status":"critical",
|
||||
"last_incident_timestamp":"2017-09-26T15:14:36Z",
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"incident_urgency_rule":{
|
||||
"type":"constant",
|
||||
"urgency":"high"
|
||||
},
|
||||
"scheduled_actions":[
|
||||
|
||||
],
|
||||
"support_hours":null,
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"addons":[
|
||||
|
||||
],
|
||||
"privilege":null,
|
||||
"alert_creation":"create_alerts_and_incidents",
|
||||
"integrations":[
|
||||
{
|
||||
"id":"PUAYF96",
|
||||
"type":"generic_events_api_inbound_integration_reference",
|
||||
"summary":"API",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/PUAYF96",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/PUAYF96"
|
||||
},
|
||||
{
|
||||
"id":"P90GZUH",
|
||||
"type":"generic_email_inbound_integration_reference",
|
||||
"summary":"Email",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/P90GZUH",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/P90GZUH"
|
||||
}
|
||||
],
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"type":"service",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"assignments":[
|
||||
{
|
||||
"at":"2017-09-26T15:16:05Z",
|
||||
"assignee":{
|
||||
"id":"PFBSJ2Z",
|
||||
"type":"user_reference",
|
||||
"summary":"Wiley Jacobson",
|
||||
"self":"https://api.pagerduty.com/users/PFBSJ2Z",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/PFBSJ2Z"
|
||||
}
|
||||
}
|
||||
],
|
||||
"acknowledgements":[
|
||||
|
||||
],
|
||||
"last_status_change_at":"2017-09-26T15:16:05Z",
|
||||
"last_status_change_by":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"first_trigger_log_entry":{
|
||||
"id":"R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"type":"trigger_log_entry_reference",
|
||||
"summary":"Triggered through the website",
|
||||
"self":"https://api.pagerduty.com/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E"
|
||||
},
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"privilege":null,
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"alert_counts":{
|
||||
"all":0,
|
||||
"triggered":0,
|
||||
"resolved":0
|
||||
},
|
||||
"impacted_services":[
|
||||
{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
}
|
||||
],
|
||||
"is_mergeable":true,
|
||||
"basic_alert_grouping":null,
|
||||
"alert_grouping":null,
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"external_references":[
|
||||
{
|
||||
"id":"PLF5V5G",
|
||||
"type":"incident_external_reference",
|
||||
"summary":"Slack",
|
||||
"self":null,
|
||||
"html_url":null,
|
||||
"external_id":"1506438878.000302",
|
||||
"external_url":"http://webdemo.slack.com/archives/C6975FLAZ/p1506438878.000302",
|
||||
"sync":false,
|
||||
"webhook":{
|
||||
"id":"PRXV5AH",
|
||||
"type":"webhook_reference",
|
||||
"summary":"Slack M2M",
|
||||
"self":"https://api.pagerduty.com/webhooks/PRXV5AH",
|
||||
"html_url":null
|
||||
}
|
||||
}
|
||||
],
|
||||
"importance":null,
|
||||
"incidents_responders":[
|
||||
|
||||
],
|
||||
"responder_requests":[
|
||||
|
||||
],
|
||||
"subscriber_requests":[
|
||||
|
||||
],
|
||||
"urgency":"high",
|
||||
"id":"PRORDTY",
|
||||
"type":"incident",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY",
|
||||
"alerts":[
|
||||
{
|
||||
"alert_key":"c24117fc42e44b44b4d6876190583378"
|
||||
},
|
||||
{
|
||||
"alert_key":"2d6ee0a6b58040f7996a4047ae5edcd7"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id":"9e7850d0-a2cd-11e7-8f69-22000affca53",
|
||||
"created_on":"2017-09-26T15:16:05Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
53
zerver/webhooks/pagerduty/fixtures/reassigned_v3.json
Normal file
53
zerver/webhooks/pagerduty/fixtures/reassigned_v3.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"event": {
|
||||
"id": "01BZY282OVDQMFPDC3VB98DR1L",
|
||||
"event_type": "incident.reassigned",
|
||||
"resource_type": "incident",
|
||||
"occurred_at": "2021-06-04T10:17:54.838Z",
|
||||
"agent": {
|
||||
"html_url": "https://pig208.pagerduty.com/users/PJ0LVEB",
|
||||
"id": "PJ0LVEB",
|
||||
"self": "https://api.pagerduty.com/users/PJ0LVEB",
|
||||
"summary": "PIG 208",
|
||||
"type": "user_reference"
|
||||
},
|
||||
"client": null,
|
||||
"data": {
|
||||
"id": "PIQUG8X",
|
||||
"type": "incident",
|
||||
"self": "https://api.pagerduty.com/incidents/PIQUG8X",
|
||||
"html_url": "https://pig208.pagerduty.com/incidents/PIQUG8X",
|
||||
"number": 3,
|
||||
"status": "triggered",
|
||||
"title": "Test Incident",
|
||||
"service": {
|
||||
"html_url": "https://pig208.pagerduty.com/services/PA2P440",
|
||||
"id": "PA2P440",
|
||||
"self": "https://api.pagerduty.com/services/PA2P440",
|
||||
"summary": "pig208",
|
||||
"type": "service_reference"
|
||||
},
|
||||
"assignees": [
|
||||
{
|
||||
"html_url": "https://pig208.pagerduty.com/users/PI9DT01",
|
||||
"id": "PI9DT01",
|
||||
"self": "https://api.pagerduty.com/users/PI9DT01",
|
||||
"summary": "Test User",
|
||||
"type": "user_reference"
|
||||
}
|
||||
],
|
||||
"escalation_policy": {
|
||||
"html_url": "https://pig208.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"id": "PY82TC6",
|
||||
"self": "https://api.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"summary": "Default",
|
||||
"type": "escalation_policy_reference"
|
||||
},
|
||||
"teams": [],
|
||||
"priority": null,
|
||||
"urgency": "high",
|
||||
"conference_bridge": null,
|
||||
"resolve_reason": null
|
||||
}
|
||||
}
|
||||
}
|
||||
270
zerver/webhooks/pagerduty/fixtures/resolve_v2.json
Normal file
270
zerver/webhooks/pagerduty/fixtures/resolve_v2.json
Normal file
@@ -0,0 +1,270 @@
|
||||
{
|
||||
"messages":[
|
||||
{
|
||||
"event":"incident.resolve",
|
||||
"log_entries":[
|
||||
{
|
||||
"id":"RNAJ8DLJGWHBXXYX1CC5G50C9O",
|
||||
"type":"resolve_log_entry",
|
||||
"summary":"Resolved by Laura Haley",
|
||||
"self":"https://api.pagerduty.com/log_entries/RNAJ8DLJGWHBXXYX1CC5G50C9O",
|
||||
"html_url":null,
|
||||
"created_at":"2017-09-26T15:18:09+00:00",
|
||||
"agent":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
},
|
||||
"channel":{
|
||||
"type":"website"
|
||||
},
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"incident":{
|
||||
"id":"PRORDTY",
|
||||
"type":"incident_reference",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY"
|
||||
},
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"contexts":[
|
||||
|
||||
],
|
||||
"event_details":{
|
||||
|
||||
}
|
||||
}
|
||||
],
|
||||
"webhook":{
|
||||
"endpoint_url":"https://requestb.in/18ao6fs1",
|
||||
"name":"V2 wabhook",
|
||||
"description":null,
|
||||
"webhook_object":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"config":{
|
||||
|
||||
},
|
||||
"outbound_integration":{
|
||||
"id":"PJFWPEP",
|
||||
"type":"outbound_integration_reference",
|
||||
"summary":"Generic V2 Webhook",
|
||||
"self":"https://api.pagerduty.com/outbound_integrations/PJFWPEP",
|
||||
"html_url":null
|
||||
},
|
||||
"accounts_addon":null,
|
||||
"id":"PKT9NNX",
|
||||
"type":"webhook",
|
||||
"summary":"V2 wabhook",
|
||||
"self":"https://api.pagerduty.com/webhooks/PKT9NNX",
|
||||
"html_url":null
|
||||
},
|
||||
"incident":{
|
||||
"incident_number":33,
|
||||
"title":"My new incident",
|
||||
"description":"My new incident",
|
||||
"created_at":"2017-09-26T15:14:36Z",
|
||||
"status":"resolved",
|
||||
"pending_actions":[
|
||||
|
||||
],
|
||||
"incident_key":null,
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"name":"Production XDB Cluster",
|
||||
"description":"This service was created during onboarding on July 5, 2017.",
|
||||
"auto_resolve_timeout":14400,
|
||||
"acknowledgement_timeout":1800,
|
||||
"created_at":"2017-07-05T17:33:09Z",
|
||||
"status":"active",
|
||||
"last_incident_timestamp":"2017-09-26T15:14:36Z",
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"incident_urgency_rule":{
|
||||
"type":"constant",
|
||||
"urgency":"high"
|
||||
},
|
||||
"scheduled_actions":[
|
||||
|
||||
],
|
||||
"support_hours":null,
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"addons":[
|
||||
|
||||
],
|
||||
"privilege":null,
|
||||
"alert_creation":"create_alerts_and_incidents",
|
||||
"integrations":[
|
||||
{
|
||||
"id":"PUAYF96",
|
||||
"type":"generic_events_api_inbound_integration_reference",
|
||||
"summary":"API",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/PUAYF96",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/PUAYF96"
|
||||
},
|
||||
{
|
||||
"id":"P90GZUH",
|
||||
"type":"generic_email_inbound_integration_reference",
|
||||
"summary":"Email",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/P90GZUH",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/P90GZUH"
|
||||
}
|
||||
],
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"type":"service",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"assignments":[
|
||||
{
|
||||
"at":"2017-09-26T15:16:05Z",
|
||||
"assignee":{
|
||||
"id":"PFBSJ2Z",
|
||||
"type":"user_reference",
|
||||
"summary":"Wiley Jacobson",
|
||||
"self":"https://api.pagerduty.com/users/PFBSJ2Z",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/PFBSJ2Z"
|
||||
}
|
||||
}
|
||||
],
|
||||
"acknowledgements":[
|
||||
|
||||
],
|
||||
"last_status_change_at":"2017-09-26T15:18:09Z",
|
||||
"last_status_change_by":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
},
|
||||
"first_trigger_log_entry":{
|
||||
"id":"R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"type":"trigger_log_entry_reference",
|
||||
"summary":"Triggered through the website",
|
||||
"self":"https://api.pagerduty.com/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E"
|
||||
},
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"privilege":null,
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"alert_counts":{
|
||||
"all":0,
|
||||
"triggered":0,
|
||||
"resolved":0
|
||||
},
|
||||
"impacted_services":[
|
||||
{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
}
|
||||
],
|
||||
"is_mergeable":true,
|
||||
"basic_alert_grouping":null,
|
||||
"alert_grouping":null,
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"external_references":[
|
||||
{
|
||||
"id":"PLF5V5G",
|
||||
"type":"incident_external_reference",
|
||||
"summary":"Slack",
|
||||
"self":null,
|
||||
"html_url":null,
|
||||
"external_id":"1506438878.000302",
|
||||
"external_url":"http://webdemo.slack.com/archives/C6975FLAZ/p1506438878.000302",
|
||||
"sync":false,
|
||||
"webhook":{
|
||||
"id":"PRXV5AH",
|
||||
"type":"webhook_reference",
|
||||
"summary":"Slack M2M",
|
||||
"self":"https://api.pagerduty.com/webhooks/PRXV5AH",
|
||||
"html_url":null
|
||||
}
|
||||
}
|
||||
],
|
||||
"importance":null,
|
||||
"resolve_reason":null,
|
||||
"incidents_responders":[
|
||||
|
||||
],
|
||||
"responder_requests":[
|
||||
|
||||
],
|
||||
"subscriber_requests":[
|
||||
|
||||
],
|
||||
"urgency":"high",
|
||||
"id":"PRORDTY",
|
||||
"type":"incident",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY",
|
||||
"alerts":[
|
||||
{
|
||||
"alert_key":"c24117fc42e44b44b4d6876190583378"
|
||||
},
|
||||
{
|
||||
"alert_key":"2d6ee0a6b58040f7996a4047ae5edcd7"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id":"e82195c0-a2cd-11e7-8f69-22000affca53",
|
||||
"created_on":"2017-09-26T15:18:09Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
45
zerver/webhooks/pagerduty/fixtures/resolved_v3.json
Normal file
45
zerver/webhooks/pagerduty/fixtures/resolved_v3.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"event": {
|
||||
"id": "01BZYH1JJY09P9LEIST8HG2PMN",
|
||||
"event_type": "incident.resolved",
|
||||
"resource_type": "incident",
|
||||
"occurred_at": "2021-06-04T13:16:53.816Z",
|
||||
"agent": {
|
||||
"html_url": "https://pig208.pagerduty.com/users/PJ0LVEB",
|
||||
"id": "PJ0LVEB",
|
||||
"self": "https://api.pagerduty.com/users/PJ0LVEB",
|
||||
"summary": "PIG 208",
|
||||
"type": "user_reference"
|
||||
},
|
||||
"client": null,
|
||||
"data": {
|
||||
"id": "PCPZE64",
|
||||
"type": "incident",
|
||||
"self": "https://api.pagerduty.com/incidents/PCPZE64",
|
||||
"html_url": "https://pig208.pagerduty.com/incidents/PCPZE64",
|
||||
"number": 6,
|
||||
"status": "resolved",
|
||||
"title": "Test Incident",
|
||||
"service": {
|
||||
"html_url": "https://pig208.pagerduty.com/services/PA2P440",
|
||||
"id": "PA2P440",
|
||||
"self": "https://api.pagerduty.com/services/PA2P440",
|
||||
"summary": "pig208",
|
||||
"type": "service_reference"
|
||||
},
|
||||
"assignees": [],
|
||||
"escalation_policy": {
|
||||
"html_url": "https://pig208.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"id": "PY82TC6",
|
||||
"self": "https://api.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"summary": "Default",
|
||||
"type": "escalation_policy_reference"
|
||||
},
|
||||
"teams": [],
|
||||
"priority": null,
|
||||
"urgency": "high",
|
||||
"conference_bridge": null,
|
||||
"resolve_reason": null
|
||||
}
|
||||
}
|
||||
}
|
||||
260
zerver/webhooks/pagerduty/fixtures/trigger_v2.json
Normal file
260
zerver/webhooks/pagerduty/fixtures/trigger_v2.json
Normal file
@@ -0,0 +1,260 @@
|
||||
{
|
||||
"messages":[
|
||||
{
|
||||
"event":"incident.trigger",
|
||||
"log_entries":[
|
||||
{
|
||||
"id":"R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"type":"trigger_log_entry",
|
||||
"summary":"Triggered through the website",
|
||||
"self":"https://api.pagerduty.com/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"created_at":"2017-09-26T15:14:36Z",
|
||||
"agent":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
},
|
||||
"channel":{
|
||||
"type":"web_trigger",
|
||||
"summary":"My new incident",
|
||||
"subject":"My new incident",
|
||||
"details":"Oh my gosh"
|
||||
},
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"incident":{
|
||||
"id":"PRORDTY",
|
||||
"type":"incident_reference",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY"
|
||||
},
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"contexts":[
|
||||
|
||||
],
|
||||
"event_details":{
|
||||
"description":"My new incident"
|
||||
}
|
||||
}
|
||||
],
|
||||
"webhook":{
|
||||
"endpoint_url":"https://requestb.in/18ao6fs1",
|
||||
"name":"V2 wabhook",
|
||||
"description":null,
|
||||
"webhook_object":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"config":{
|
||||
|
||||
},
|
||||
"outbound_integration":{
|
||||
"id":"PJFWPEP",
|
||||
"type":"outbound_integration_reference",
|
||||
"summary":"Generic V2 Webhook",
|
||||
"self":"https://api.pagerduty.com/outbound_integrations/PJFWPEP",
|
||||
"html_url":null
|
||||
},
|
||||
"accounts_addon":null,
|
||||
"id":"PKT9NNX",
|
||||
"type":"webhook",
|
||||
"summary":"V2 wabhook",
|
||||
"self":"https://api.pagerduty.com/webhooks/PKT9NNX",
|
||||
"html_url":null
|
||||
},
|
||||
"incident":{
|
||||
"incident_number":33,
|
||||
"title":"My new incident",
|
||||
"description":"My new incident",
|
||||
"created_at":"2017-09-26T15:14:36Z",
|
||||
"status":"triggered",
|
||||
"pending_actions":[
|
||||
{
|
||||
"type":"escalate",
|
||||
"at":"2017-09-26T15:44:36Z"
|
||||
},
|
||||
{
|
||||
"type":"resolve",
|
||||
"at":"2017-09-26T19:14:36Z"
|
||||
}
|
||||
],
|
||||
"incident_key":null,
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"name":"Production XDB Cluster",
|
||||
"description":"This service was created during onboarding on July 5, 2017.",
|
||||
"auto_resolve_timeout":14400,
|
||||
"acknowledgement_timeout":1800,
|
||||
"created_at":"2017-07-05T17:33:09Z",
|
||||
"status":"critical",
|
||||
"last_incident_timestamp":"2017-09-26T15:14:36Z",
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"incident_urgency_rule":{
|
||||
"type":"constant",
|
||||
"urgency":"high"
|
||||
},
|
||||
"scheduled_actions":[
|
||||
|
||||
],
|
||||
"support_hours":null,
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"addons":[
|
||||
|
||||
],
|
||||
"privilege":null,
|
||||
"alert_creation":"create_alerts_and_incidents",
|
||||
"integrations":[
|
||||
{
|
||||
"id":"PUAYF96",
|
||||
"type":"generic_events_api_inbound_integration_reference",
|
||||
"summary":"API",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/PUAYF96",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/PUAYF96"
|
||||
},
|
||||
{
|
||||
"id":"P90GZUH",
|
||||
"type":"generic_email_inbound_integration_reference",
|
||||
"summary":"Email",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/P90GZUH",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/P90GZUH"
|
||||
}
|
||||
],
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"type":"service",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"assignments":[
|
||||
{
|
||||
"at":"2017-09-26T15:14:36Z",
|
||||
"assignee":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
}
|
||||
}
|
||||
],
|
||||
"acknowledgements":[
|
||||
|
||||
],
|
||||
"last_status_change_at":"2017-09-26T15:14:36Z",
|
||||
"last_status_change_by":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"first_trigger_log_entry":{
|
||||
"id":"R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"type":"trigger_log_entry_reference",
|
||||
"summary":"Triggered through the website",
|
||||
"self":"https://api.pagerduty.com/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E"
|
||||
},
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"privilege":null,
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"alert_counts":{
|
||||
"all":0,
|
||||
"triggered":0,
|
||||
"resolved":0
|
||||
},
|
||||
"impacted_services":[
|
||||
{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
}
|
||||
],
|
||||
"is_mergeable":true,
|
||||
"basic_alert_grouping":null,
|
||||
"alert_grouping":null,
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"external_references":[
|
||||
|
||||
],
|
||||
"importance":null,
|
||||
"incidents_responders":[
|
||||
|
||||
],
|
||||
"responder_requests":[
|
||||
|
||||
],
|
||||
"subscriber_requests":[
|
||||
|
||||
],
|
||||
"urgency":"high",
|
||||
"id":"PRORDTY",
|
||||
"type":"incident",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY",
|
||||
"alerts":[
|
||||
{
|
||||
"alert_key":"c24117fc42e44b44b4d6876190583378"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id":"69a7ced0-a2cd-11e7-a799-22000a15839c",
|
||||
"created_on":"2017-09-26T15:14:36Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
{
|
||||
"messages":[
|
||||
{
|
||||
"event":"incident.trigger",
|
||||
"log_entries":[
|
||||
{
|
||||
"id":"R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"type":"trigger_log_entry",
|
||||
"summary":"Triggered through the website",
|
||||
"self":"https://api.pagerduty.com/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"created_at":"2017-09-26T15:14:36Z",
|
||||
"agent":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
},
|
||||
"channel":{
|
||||
"type":"web_trigger",
|
||||
"summary":"My new incident",
|
||||
"subject":"My new incident",
|
||||
"details":"Oh my gosh"
|
||||
},
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"incident":{
|
||||
"id":"PRORDTY",
|
||||
"type":"incident_reference",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY"
|
||||
},
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"contexts":[
|
||||
|
||||
],
|
||||
"event_details":{
|
||||
"description":"My new incident"
|
||||
}
|
||||
}
|
||||
],
|
||||
"webhook":{
|
||||
"endpoint_url":"https://requestb.in/18ao6fs1",
|
||||
"name":"V2 wabhook",
|
||||
"description":null,
|
||||
"webhook_object":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"config":{
|
||||
|
||||
},
|
||||
"outbound_integration":{
|
||||
"id":"PJFWPEP",
|
||||
"type":"outbound_integration_reference",
|
||||
"summary":"Generic V2 Webhook",
|
||||
"self":"https://api.pagerduty.com/outbound_integrations/PJFWPEP",
|
||||
"html_url":null
|
||||
},
|
||||
"accounts_addon":null,
|
||||
"id":"PKT9NNX",
|
||||
"type":"webhook",
|
||||
"summary":"V2 wabhook",
|
||||
"self":"https://api.pagerduty.com/webhooks/PKT9NNX",
|
||||
"html_url":null
|
||||
},
|
||||
"incident":{
|
||||
"incident_number":33,
|
||||
"title":"My new incident",
|
||||
"description":"My new incident",
|
||||
"created_at":"2017-09-26T15:14:36Z",
|
||||
"status":"triggered",
|
||||
"pending_actions":[
|
||||
{
|
||||
"type":"escalate",
|
||||
"at":"2017-09-26T15:44:36Z"
|
||||
},
|
||||
{
|
||||
"type":"resolve",
|
||||
"at":"2017-09-26T19:14:36Z"
|
||||
}
|
||||
],
|
||||
"incident_key":null,
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"name":"Production XDB Cluster",
|
||||
"description":"This service was created during onboarding on July 5, 2017.",
|
||||
"auto_resolve_timeout":14400,
|
||||
"acknowledgement_timeout":1800,
|
||||
"created_at":"2017-07-05T17:33:09Z",
|
||||
"status":"critical",
|
||||
"last_incident_timestamp":"2017-09-26T15:14:36Z",
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"incident_urgency_rule":{
|
||||
"type":"constant",
|
||||
"urgency":"high"
|
||||
},
|
||||
"scheduled_actions":[
|
||||
|
||||
],
|
||||
"support_hours":null,
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"addons":[
|
||||
|
||||
],
|
||||
"privilege":null,
|
||||
"alert_creation":"create_alerts_and_incidents",
|
||||
"integrations":[
|
||||
{
|
||||
"id":"PUAYF96",
|
||||
"type":"generic_events_api_inbound_integration_reference",
|
||||
"summary":"API",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/PUAYF96",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/PUAYF96"
|
||||
},
|
||||
{
|
||||
"id":"P90GZUH",
|
||||
"type":"generic_email_inbound_integration_reference",
|
||||
"summary":"Email",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/P90GZUH",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/P90GZUH"
|
||||
}
|
||||
],
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"type":"service",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"assignments":[],
|
||||
"acknowledgements":[
|
||||
|
||||
],
|
||||
"last_status_change_at":"2017-09-26T15:14:36Z",
|
||||
"last_status_change_by":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"first_trigger_log_entry":{
|
||||
"id":"R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"type":"trigger_log_entry_reference",
|
||||
"summary":"Triggered through the website",
|
||||
"self":"https://api.pagerduty.com/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E"
|
||||
},
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"privilege":null,
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"alert_counts":{
|
||||
"all":0,
|
||||
"triggered":0,
|
||||
"resolved":0
|
||||
},
|
||||
"impacted_services":[
|
||||
{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
}
|
||||
],
|
||||
"is_mergeable":true,
|
||||
"basic_alert_grouping":null,
|
||||
"alert_grouping":null,
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"external_references":[
|
||||
|
||||
],
|
||||
"importance":null,
|
||||
"incidents_responders":[
|
||||
|
||||
],
|
||||
"responder_requests":[
|
||||
|
||||
],
|
||||
"subscriber_requests":[
|
||||
|
||||
],
|
||||
"urgency":"high",
|
||||
"id":"PRORDTY",
|
||||
"type":"incident",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY",
|
||||
"alerts":[
|
||||
{
|
||||
"alert_key":"c24117fc42e44b44b4d6876190583378"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id":"69a7ced0-a2cd-11e7-a799-22000a15839c",
|
||||
"created_on":"2017-09-26T15:14:36Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
53
zerver/webhooks/pagerduty/fixtures/triggered_v3.json
Normal file
53
zerver/webhooks/pagerduty/fixtures/triggered_v3.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"event": {
|
||||
"id": "01BZYIL05THJDFF2Y08X9SVMTU",
|
||||
"event_type": "incident.triggered",
|
||||
"resource_type": "incident",
|
||||
"occurred_at": "2021-06-04T13:35:29.781Z",
|
||||
"agent": {
|
||||
"html_url": "https://pig208.pagerduty.com/users/PJ0LVEB",
|
||||
"id": "PJ0LVEB",
|
||||
"self": "https://api.pagerduty.com/users/PJ0LVEB",
|
||||
"summary": "PIG 208",
|
||||
"type": "user_reference"
|
||||
},
|
||||
"client": null,
|
||||
"data": {
|
||||
"id": "PFQZPSY",
|
||||
"type": "incident",
|
||||
"self": "https://api.pagerduty.com/incidents/PFQZPSY",
|
||||
"html_url": "https://pig208.pagerduty.com/incidents/PFQZPSY",
|
||||
"number": 9,
|
||||
"status": "triggered",
|
||||
"title": "Test Incident 3",
|
||||
"service": {
|
||||
"html_url": "https://pig208.pagerduty.com/services/PA2P440",
|
||||
"id": "PA2P440",
|
||||
"self": "https://api.pagerduty.com/services/PA2P440",
|
||||
"summary": "pig208",
|
||||
"type": "service_reference"
|
||||
},
|
||||
"assignees": [
|
||||
{
|
||||
"html_url": "https://pig208.pagerduty.com/users/PJ0LVEB",
|
||||
"id": "PJ0LVEB",
|
||||
"self": "https://api.pagerduty.com/users/PJ0LVEB",
|
||||
"summary": "PIG 208",
|
||||
"type": "user_reference"
|
||||
}
|
||||
],
|
||||
"escalation_policy": {
|
||||
"html_url": "https://pig208.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"id": "PY82TC6",
|
||||
"self": "https://api.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"summary": "Default",
|
||||
"type": "escalation_policy_reference"
|
||||
},
|
||||
"teams": [],
|
||||
"priority": null,
|
||||
"urgency": "high",
|
||||
"conference_bridge": null,
|
||||
"resolve_reason": null
|
||||
}
|
||||
}
|
||||
}
|
||||
53
zerver/webhooks/pagerduty/fixtures/unacknowledged_v3.json
Normal file
53
zerver/webhooks/pagerduty/fixtures/unacknowledged_v3.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"event": {
|
||||
"id": "01BZYK5B3WC0QI62S87MJX7FCD",
|
||||
"event_type": "incident.unacknowledged",
|
||||
"resource_type": "incident",
|
||||
"occurred_at": "2021-06-04T13:54:23.185Z",
|
||||
"agent": {
|
||||
"html_url": "https://pig208.pagerduty.com/users/PJ0LVEB",
|
||||
"id": "PJ0LVEB",
|
||||
"self": "https://api.pagerduty.com/users/PJ0LVEB",
|
||||
"summary": "PIG 208",
|
||||
"type": "user_reference"
|
||||
},
|
||||
"client": null,
|
||||
"data": {
|
||||
"id": "PQ1K5C8",
|
||||
"type": "incident",
|
||||
"self": "https://api.pagerduty.com/incidents/PQ1K5C8",
|
||||
"html_url": "https://pig208.pagerduty.com/incidents/PQ1K5C8",
|
||||
"number": 10,
|
||||
"status": "triggered",
|
||||
"title": "Test Incident",
|
||||
"service": {
|
||||
"html_url": "https://pig208.pagerduty.com/services/PA2P440",
|
||||
"id": "PA2P440",
|
||||
"self": "https://api.pagerduty.com/services/PA2P440",
|
||||
"summary": "pig208",
|
||||
"type": "service_reference"
|
||||
},
|
||||
"assignees": [
|
||||
{
|
||||
"html_url": "https://pig208.pagerduty.com/users/PJ0LVEB",
|
||||
"id": "PJ0LVEB",
|
||||
"self": "https://api.pagerduty.com/users/PJ0LVEB",
|
||||
"summary": "PIG 208",
|
||||
"type": "user_reference"
|
||||
}
|
||||
],
|
||||
"escalation_policy": {
|
||||
"html_url": "https://pig208.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"id": "PY82TC6",
|
||||
"self": "https://api.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"summary": "Default",
|
||||
"type": "escalation_policy_reference"
|
||||
},
|
||||
"teams": [],
|
||||
"priority": null,
|
||||
"urgency": "high",
|
||||
"conference_bridge": null,
|
||||
"resolve_reason": null
|
||||
}
|
||||
}
|
||||
}
|
||||
278
zerver/webhooks/pagerduty/fixtures/unsupported_v2.json
Normal file
278
zerver/webhooks/pagerduty/fixtures/unsupported_v2.json
Normal file
@@ -0,0 +1,278 @@
|
||||
{
|
||||
"messages":[
|
||||
{
|
||||
"event":"incident.unsupported",
|
||||
"log_entries":[
|
||||
{
|
||||
"id":"R6XNGC35VF6U1TUSVIE2DWXD4Z",
|
||||
"type":"assign_log_entry",
|
||||
"summary":"Assigned to Wiley Jacobson by Laura Haley",
|
||||
"self":"https://api.pagerduty.com/log_entries/R6XNGC35VF6U1TUSVIE2DWXD4Z",
|
||||
"html_url":null,
|
||||
"created_at":"2017-09-26T15:16:05Z",
|
||||
"agent":{
|
||||
"id":"P553OPV",
|
||||
"type":"user_reference",
|
||||
"summary":"Laura Haley",
|
||||
"self":"https://api.pagerduty.com/users/P553OPV",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/P553OPV"
|
||||
},
|
||||
"channel":{
|
||||
"type":"website"
|
||||
},
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"incident":{
|
||||
"id":"PRORDTY",
|
||||
"type":"incident_reference",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY"
|
||||
},
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"contexts":[
|
||||
|
||||
],
|
||||
"assignees":[
|
||||
{
|
||||
"id":"PFBSJ2Z",
|
||||
"type":"user_reference",
|
||||
"summary":"Wiley Jacobson",
|
||||
"self":"https://api.pagerduty.com/users/PFBSJ2Z",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/PFBSJ2Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"webhook":{
|
||||
"endpoint_url":"https://requestb.in/18ao6fs1",
|
||||
"name":"V2 wabhook",
|
||||
"description":null,
|
||||
"webhook_object":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"config":{
|
||||
|
||||
},
|
||||
"outbound_integration":{
|
||||
"id":"PJFWPEP",
|
||||
"type":"outbound_integration_reference",
|
||||
"summary":"Generic V2 Webhook",
|
||||
"self":"https://api.pagerduty.com/outbound_integrations/PJFWPEP",
|
||||
"html_url":null
|
||||
},
|
||||
"accounts_addon":null,
|
||||
"id":"PKT9NNX",
|
||||
"type":"webhook",
|
||||
"summary":"V2 wabhook",
|
||||
"self":"https://api.pagerduty.com/webhooks/PKT9NNX",
|
||||
"html_url":null
|
||||
},
|
||||
"incident":{
|
||||
"incident_number":33,
|
||||
"title":"My new incident",
|
||||
"description":"My new incident",
|
||||
"created_at":"2017-09-26T15:14:36Z",
|
||||
"status":"triggered",
|
||||
"pending_actions":[
|
||||
{
|
||||
"type":"resolve",
|
||||
"at":"2017-09-26T19:14:36Z"
|
||||
}
|
||||
],
|
||||
"incident_key":null,
|
||||
"service":{
|
||||
"id":"PN49J75",
|
||||
"name":"Production XDB Cluster",
|
||||
"description":"This service was created during onboarding on July 5, 2017.",
|
||||
"auto_resolve_timeout":14400,
|
||||
"acknowledgement_timeout":1800,
|
||||
"created_at":"2017-07-05T17:33:09Z",
|
||||
"status":"critical",
|
||||
"last_incident_timestamp":"2017-09-26T15:14:36Z",
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"incident_urgency_rule":{
|
||||
"type":"constant",
|
||||
"urgency":"high"
|
||||
},
|
||||
"scheduled_actions":[
|
||||
|
||||
],
|
||||
"support_hours":null,
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"addons":[
|
||||
|
||||
],
|
||||
"privilege":null,
|
||||
"alert_creation":"create_alerts_and_incidents",
|
||||
"integrations":[
|
||||
{
|
||||
"id":"PUAYF96",
|
||||
"type":"generic_events_api_inbound_integration_reference",
|
||||
"summary":"API",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/PUAYF96",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/PUAYF96"
|
||||
},
|
||||
{
|
||||
"id":"P90GZUH",
|
||||
"type":"generic_email_inbound_integration_reference",
|
||||
"summary":"Email",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75/integrations/P90GZUH",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75/integrations/P90GZUH"
|
||||
}
|
||||
],
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"type":"service",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"assignments":[
|
||||
{
|
||||
"at":"2017-09-26T15:16:05Z",
|
||||
"assignee":{
|
||||
"id":"PFBSJ2Z",
|
||||
"type":"user_reference",
|
||||
"summary":"Wiley Jacobson",
|
||||
"self":"https://api.pagerduty.com/users/PFBSJ2Z",
|
||||
"html_url":"https://webdemo.pagerduty.com/users/PFBSJ2Z"
|
||||
}
|
||||
}
|
||||
],
|
||||
"acknowledgements":[
|
||||
|
||||
],
|
||||
"last_status_change_at":"2017-09-26T15:16:05Z",
|
||||
"last_status_change_by":{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
},
|
||||
"first_trigger_log_entry":{
|
||||
"id":"R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"type":"trigger_log_entry_reference",
|
||||
"summary":"Triggered through the website",
|
||||
"self":"https://api.pagerduty.com/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY/log_entries/R2XGXEI3W0FHMSDXHDIBQGBQ5E"
|
||||
},
|
||||
"escalation_policy":{
|
||||
"id":"PINYWEF",
|
||||
"type":"escalation_policy_reference",
|
||||
"summary":"Default",
|
||||
"self":"https://api.pagerduty.com/escalation_policies/PINYWEF",
|
||||
"html_url":"https://webdemo.pagerduty.com/escalation_policies/PINYWEF"
|
||||
},
|
||||
"privilege":null,
|
||||
"teams":[
|
||||
{
|
||||
"id":"P4SI59S",
|
||||
"type":"team_reference",
|
||||
"summary":"Engineering",
|
||||
"self":"https://api.pagerduty.com/teams/P4SI59S",
|
||||
"html_url":"https://webdemo.pagerduty.com/teams/P4SI59S"
|
||||
}
|
||||
],
|
||||
"alert_counts":{
|
||||
"all":0,
|
||||
"triggered":0,
|
||||
"resolved":0
|
||||
},
|
||||
"impacted_services":[
|
||||
{
|
||||
"id":"PN49J75",
|
||||
"type":"service_reference",
|
||||
"summary":"Production XDB Cluster",
|
||||
"self":"https://api.pagerduty.com/services/PN49J75",
|
||||
"html_url":"https://webdemo.pagerduty.com/services/PN49J75"
|
||||
}
|
||||
],
|
||||
"is_mergeable":true,
|
||||
"basic_alert_grouping":null,
|
||||
"alert_grouping":null,
|
||||
"metadata":{
|
||||
|
||||
},
|
||||
"external_references":[
|
||||
{
|
||||
"id":"PLF5V5G",
|
||||
"type":"incident_external_reference",
|
||||
"summary":"Slack",
|
||||
"self":null,
|
||||
"html_url":null,
|
||||
"external_id":"1506438878.000302",
|
||||
"external_url":"http://webdemo.slack.com/archives/C6975FLAZ/p1506438878.000302",
|
||||
"sync":false,
|
||||
"webhook":{
|
||||
"id":"PRXV5AH",
|
||||
"type":"webhook_reference",
|
||||
"summary":"Slack M2M",
|
||||
"self":"https://api.pagerduty.com/webhooks/PRXV5AH",
|
||||
"html_url":null
|
||||
}
|
||||
}
|
||||
],
|
||||
"importance":null,
|
||||
"incidents_responders":[
|
||||
|
||||
],
|
||||
"responder_requests":[
|
||||
|
||||
],
|
||||
"subscriber_requests":[
|
||||
|
||||
],
|
||||
"urgency":"high",
|
||||
"id":"PRORDTY",
|
||||
"type":"incident",
|
||||
"summary":"[#33] My new incident",
|
||||
"self":"https://api.pagerduty.com/incidents/PRORDTY",
|
||||
"html_url":"https://webdemo.pagerduty.com/incidents/PRORDTY",
|
||||
"alerts":[
|
||||
{
|
||||
"alert_key":"c24117fc42e44b44b4d6876190583378"
|
||||
},
|
||||
{
|
||||
"alert_key":"2d6ee0a6b58040f7996a4047ae5edcd7"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id":"9e7850d0-a2cd-11e7-8f69-22000affca53",
|
||||
"created_on":"2017-09-26T15:16:05Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
53
zerver/webhooks/pagerduty/fixtures/unsupported_v3.json
Normal file
53
zerver/webhooks/pagerduty/fixtures/unsupported_v3.json
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"event": {
|
||||
"id": "01BZY282OVDQMFPDC3VB98DR1L",
|
||||
"event_type": "incident.unsupported",
|
||||
"resource_type": "incident",
|
||||
"occurred_at": "2021-06-04T10:17:54.838Z",
|
||||
"agent": {
|
||||
"html_url": "https://pig208.pagerduty.com/users/PJ0LVEB",
|
||||
"id": "PJ0LVEB",
|
||||
"self": "https://api.pagerduty.com/users/PJ0LVEB",
|
||||
"summary": "PIG 208",
|
||||
"type": "user_reference"
|
||||
},
|
||||
"client": null,
|
||||
"data": {
|
||||
"id": "PIQUG8X",
|
||||
"type": "incident",
|
||||
"self": "https://api.pagerduty.com/incidents/PIQUG8X",
|
||||
"html_url": "https://pig208.pagerduty.com/incidents/PIQUG8X",
|
||||
"number": 3,
|
||||
"status": "triggered",
|
||||
"title": "Test Incident",
|
||||
"service": {
|
||||
"html_url": "https://pig208.pagerduty.com/services/PA2P440",
|
||||
"id": "PA2P440",
|
||||
"self": "https://api.pagerduty.com/services/PA2P440",
|
||||
"summary": "pig208",
|
||||
"type": "service_reference"
|
||||
},
|
||||
"assignees": [
|
||||
{
|
||||
"html_url": "https://pig208.pagerduty.com/users/PI9DT01",
|
||||
"id": "PI9DT01",
|
||||
"self": "https://api.pagerduty.com/users/PI9DT01",
|
||||
"summary": "Test User",
|
||||
"type": "user_reference"
|
||||
}
|
||||
],
|
||||
"escalation_policy": {
|
||||
"html_url": "https://pig208.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"id": "PY82TC6",
|
||||
"self": "https://api.pagerduty.com/escalation_policies/PY82TC6",
|
||||
"summary": "Default",
|
||||
"type": "escalation_policy_reference"
|
||||
},
|
||||
"teams": [],
|
||||
"priority": null,
|
||||
"urgency": "high",
|
||||
"conference_bridge": null,
|
||||
"resolve_reason": null
|
||||
}
|
||||
}
|
||||
}
|
||||
55
zerver/webhooks/pagerduty/tests.py
Normal file
55
zerver/webhooks/pagerduty/tests.py
Normal file
@@ -0,0 +1,55 @@
|
||||
from zerver.lib.test_classes import WebhookTestCase
|
||||
|
||||
|
||||
class PagerDutyHookTests(WebhookTestCase):
|
||||
V2_TOPIC = "Incident My new incident (#33)"
|
||||
|
||||
def test_trigger_v2(self) -> None:
|
||||
expected_message = "Incident [My new incident (#33)](https://webdemo.pagerduty.com/incidents/PRORDTY) triggered by [Production XDB Cluster](https://webdemo.pagerduty.com/services/PN49J75) (assigned to [Laura Haley](https://webdemo.pagerduty.com/users/P553OPV))."
|
||||
self.check_webhook("trigger_v2", self.V2_TOPIC, expected_message)
|
||||
|
||||
def test_triggerer_v3(self) -> None:
|
||||
expected_message = "Incident [Test Incident 3 (#9)](https://pig208.pagerduty.com/incidents/PFQZPSY) triggered by [pig208](https://pig208.pagerduty.com/services/PA2P440) (assigned to [PIG 208](https://pig208.pagerduty.com/users/PJ0LVEB))."
|
||||
self.check_webhook("triggered_v3", "Incident Test Incident 3 (#9)", expected_message)
|
||||
|
||||
def test_trigger_without_assignee_v2(self) -> None:
|
||||
expected_message = "Incident [My new incident (#33)](https://webdemo.pagerduty.com/incidents/PRORDTY) triggered by [Production XDB Cluster](https://webdemo.pagerduty.com/services/PN49J75) (assigned to nobody)."
|
||||
self.check_webhook("trigger_without_assignee_v2", self.V2_TOPIC, expected_message)
|
||||
|
||||
def test_unacknowledged_v3(self) -> None:
|
||||
expected_message = "Incident [Test Incident (#10)](https://pig208.pagerduty.com/incidents/PQ1K5C8) unacknowledged by [pig208](https://pig208.pagerduty.com/services/PA2P440) (assigned to [PIG 208](https://pig208.pagerduty.com/users/PJ0LVEB))."
|
||||
self.check_webhook("unacknowledged_v3", "Incident Test Incident (#10)", expected_message)
|
||||
|
||||
def test_resolved_v2(self) -> None:
|
||||
expected_message = "Incident [My new incident (#33)](https://webdemo.pagerduty.com/incidents/PRORDTY) resolved by [Laura Haley](https://webdemo.pagerduty.com/users/P553OPV)."
|
||||
self.check_webhook("resolve_v2", self.V2_TOPIC, expected_message)
|
||||
|
||||
def test_resolved_v3(self) -> None:
|
||||
expected_message = "Incident [Test Incident (#6)](https://pig208.pagerduty.com/incidents/PCPZE64) resolved by [PIG 208](https://pig208.pagerduty.com/users/PJ0LVEB)."
|
||||
self.check_webhook("resolved_v3", "Incident Test Incident (#6)", expected_message)
|
||||
|
||||
def test_acknowledged_v3(self) -> None:
|
||||
expected_message = "Incident [Test Incident (#10)](https://pig208.pagerduty.com/incidents/PQ1K5C8) acknowledged by [PIG 208](https://pig208.pagerduty.com/users/PJ0LVEB)."
|
||||
self.check_webhook("acknowledged_v3", "Incident Test Incident (#10)", expected_message)
|
||||
|
||||
def test_acknowledge_v2(self) -> None:
|
||||
expected_message = "Incident [My new incident (#33)](https://webdemo.pagerduty.com/incidents/PRORDTY) acknowledged by [Laura Haley](https://webdemo.pagerduty.com/users/P553OPV)."
|
||||
self.check_webhook("acknowledge_v2", self.V2_TOPIC, expected_message)
|
||||
|
||||
def test_incident_assigned_v2(self) -> None:
|
||||
expected_message = "Incident [My new incident (#33)](https://webdemo.pagerduty.com/incidents/PRORDTY) assigned to [Wiley Jacobson](https://webdemo.pagerduty.com/users/PFBSJ2Z)."
|
||||
self.check_webhook("assign_v2", self.V2_TOPIC, expected_message)
|
||||
|
||||
def test_reassigned_v3(self) -> None:
|
||||
expected_message = "Incident [Test Incident (#3)](https://pig208.pagerduty.com/incidents/PIQUG8X) reassigned to [Test User](https://pig208.pagerduty.com/users/PI9DT01)."
|
||||
self.check_webhook("reassigned_v3", "Incident Test Incident (#3)", expected_message)
|
||||
|
||||
def test_unsupported_webhook_event(self) -> None:
|
||||
for version in range(2, 4):
|
||||
payload = self.get_body(f"unsupported_v{version}")
|
||||
result = self.client_post(self.url, payload, content_type="application/json")
|
||||
self.assert_json_success(result)
|
||||
self.assert_in_response(
|
||||
"The 'incident.unsupported' event isn't currently supported by the PagerDuty webhook; ignoring",
|
||||
result,
|
||||
)
|
||||
192
zerver/webhooks/pagerduty/view.py
Normal file
192
zerver/webhooks/pagerduty/view.py
Normal file
@@ -0,0 +1,192 @@
|
||||
from typing import TypeAlias
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
|
||||
from zerver.decorator import webhook_view
|
||||
from zerver.lib.exceptions import UnsupportedWebhookEventTypeError
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.typed_endpoint import JsonBodyPayload, typed_endpoint
|
||||
from zerver.lib.validator import WildValue, check_int, check_none_or, check_string
|
||||
from zerver.lib.webhooks.common import check_send_webhook_message
|
||||
from zerver.models import UserProfile
|
||||
|
||||
FormatDictType: TypeAlias = dict[str, str | int]
|
||||
|
||||
PAGER_DUTY_EVENT_NAMES_V2 = {
|
||||
"incident.trigger": "triggered",
|
||||
"incident.acknowledge": "acknowledged",
|
||||
"incident.resolve": "resolved",
|
||||
"incident.assign": "assigned",
|
||||
}
|
||||
|
||||
PAGER_DUTY_EVENT_NAMES_V3 = {
|
||||
"incident.triggered": "triggered",
|
||||
"incident.acknowledged": "acknowledged",
|
||||
"incident.unacknowledged": "unacknowledged",
|
||||
"incident.resolved": "resolved",
|
||||
"incident.reassigned": "reassigned",
|
||||
}
|
||||
|
||||
ALL_EVENT_TYPES = [
|
||||
"resolved",
|
||||
"assigned",
|
||||
"unacknowledged",
|
||||
"acknowledged",
|
||||
"triggered",
|
||||
"reassigned",
|
||||
]
|
||||
|
||||
AGENT_TEMPLATE = "[{username}]({url})"
|
||||
|
||||
INCIDENT_WITH_SERVICE_AND_ASSIGNEE = (
|
||||
"Incident [{incident_num_title}]({incident_url}) {action} by [{service_name}]"
|
||||
"({service_url}) (assigned to {assignee_info})."
|
||||
)
|
||||
|
||||
NUM_TITLE = "{incident_title} (#{incident_num})"
|
||||
|
||||
INCIDENT_WITH_ASSIGNEE = """
|
||||
Incident [{incident_num_title}]({incident_url}) {action} by {assignee_info}.
|
||||
""".strip()
|
||||
|
||||
INCIDENT_ASSIGNED = """
|
||||
Incident [{incident_num_title}]({incident_url}) {action} to {assignee_info}.
|
||||
""".strip()
|
||||
|
||||
INCIDENT_RESOLVED_WITH_AGENT = """
|
||||
Incident [{incident_num_title}]({incident_url}) resolved by {agent_info}.
|
||||
""".strip()
|
||||
|
||||
INCIDENT_RESOLVED = """
|
||||
Incident [{incident_num_title}]({incident_url}) resolved.
|
||||
""".strip()
|
||||
|
||||
|
||||
def build_pagerduty_formatdict_v2(message: WildValue) -> FormatDictType:
|
||||
format_dict: FormatDictType = {}
|
||||
format_dict["action"] = PAGER_DUTY_EVENT_NAMES_V2[message["event"].tame(check_string)]
|
||||
|
||||
format_dict["incident_id"] = message["incident"]["id"].tame(check_string)
|
||||
format_dict["incident_num_title"] = NUM_TITLE.format(
|
||||
incident_num=message["incident"]["incident_number"].tame(check_int),
|
||||
incident_title=message["incident"]["title"].tame(check_string),
|
||||
)
|
||||
format_dict["incident_url"] = message["incident"]["html_url"].tame(check_string)
|
||||
|
||||
format_dict["service_name"] = message["incident"]["service"]["name"].tame(check_string)
|
||||
format_dict["service_url"] = message["incident"]["service"]["html_url"].tame(check_string)
|
||||
|
||||
assignments = message["incident"]["assignments"]
|
||||
if assignments:
|
||||
assignee = assignments[0]["assignee"]
|
||||
format_dict["assignee_info"] = AGENT_TEMPLATE.format(
|
||||
username=assignee["summary"].tame(check_string),
|
||||
url=assignee["html_url"].tame(check_string),
|
||||
)
|
||||
else:
|
||||
format_dict["assignee_info"] = "nobody"
|
||||
|
||||
last_status_change_by = message["incident"].get("last_status_change_by")
|
||||
if last_status_change_by is not None:
|
||||
format_dict["agent_info"] = AGENT_TEMPLATE.format(
|
||||
username=last_status_change_by["summary"].tame(check_string),
|
||||
url=last_status_change_by["html_url"].tame(check_string),
|
||||
)
|
||||
|
||||
return format_dict
|
||||
|
||||
|
||||
def build_pagerduty_formatdict_v3(event: WildValue) -> FormatDictType:
|
||||
format_dict: FormatDictType = {}
|
||||
format_dict["action"] = PAGER_DUTY_EVENT_NAMES_V3[event["event_type"].tame(check_string)]
|
||||
|
||||
format_dict["incident_id"] = event["data"]["id"].tame(check_string)
|
||||
format_dict["incident_url"] = event["data"]["html_url"].tame(check_string)
|
||||
format_dict["incident_num_title"] = NUM_TITLE.format(
|
||||
incident_num=event["data"]["number"].tame(check_int),
|
||||
incident_title=event["data"]["title"].tame(check_string),
|
||||
)
|
||||
|
||||
format_dict["service_name"] = event["data"]["service"]["summary"].tame(check_string)
|
||||
format_dict["service_url"] = event["data"]["service"]["html_url"].tame(check_string)
|
||||
|
||||
assignees = event["data"]["assignees"]
|
||||
if assignees:
|
||||
assignee = assignees[0]
|
||||
format_dict["assignee_info"] = AGENT_TEMPLATE.format(
|
||||
username=assignee["summary"].tame(check_string),
|
||||
url=assignee["html_url"].tame(check_string),
|
||||
)
|
||||
else:
|
||||
format_dict["assignee_info"] = "nobody"
|
||||
|
||||
agent = event.get("agent")
|
||||
if agent is not None:
|
||||
format_dict["agent_info"] = AGENT_TEMPLATE.format(
|
||||
username=agent["summary"].tame(check_string),
|
||||
url=agent["html_url"].tame(check_string),
|
||||
)
|
||||
|
||||
return format_dict
|
||||
|
||||
|
||||
def send_formatted_pagerduty(
|
||||
request: HttpRequest,
|
||||
user_profile: UserProfile,
|
||||
message_type: str,
|
||||
format_dict: FormatDictType,
|
||||
) -> None:
|
||||
if message_type in (
|
||||
"incident.trigger",
|
||||
"incident.triggered",
|
||||
"incident.unacknowledge",
|
||||
"incident.unacknowledged",
|
||||
):
|
||||
template = INCIDENT_WITH_SERVICE_AND_ASSIGNEE
|
||||
elif message_type in ("incident.resolve", "incident.resolved"):
|
||||
if "agent_info" in format_dict:
|
||||
template = INCIDENT_RESOLVED_WITH_AGENT
|
||||
else:
|
||||
template = INCIDENT_RESOLVED # nocoverage
|
||||
elif message_type in ("incident.assign", "incident.reassigned"):
|
||||
template = INCIDENT_ASSIGNED
|
||||
else:
|
||||
template = INCIDENT_WITH_ASSIGNEE
|
||||
|
||||
topic_name = "Incident {incident_num_title}".format(**format_dict)
|
||||
body = template.format(**format_dict)
|
||||
assert isinstance(format_dict["action"], str)
|
||||
check_send_webhook_message(request, user_profile, topic_name, body, format_dict["action"])
|
||||
|
||||
|
||||
@webhook_view("PagerDuty", all_event_types=ALL_EVENT_TYPES)
|
||||
@typed_endpoint
|
||||
def api_pagerduty_webhook(
|
||||
request: HttpRequest,
|
||||
user_profile: UserProfile,
|
||||
*,
|
||||
payload: JsonBodyPayload[WildValue],
|
||||
) -> HttpResponse:
|
||||
messages = payload.get("messages")
|
||||
if messages:
|
||||
for message in messages:
|
||||
message_event = message.get("event").tame(check_none_or(check_string))
|
||||
|
||||
if message_event not in PAGER_DUTY_EVENT_NAMES_V2:
|
||||
raise UnsupportedWebhookEventTypeError(message_event)
|
||||
|
||||
format_dict = build_pagerduty_formatdict_v2(message)
|
||||
send_formatted_pagerduty(request, user_profile, message_event, format_dict)
|
||||
else:
|
||||
if "event" in payload:
|
||||
# V3 has no "messages" field, and it has key "event" instead
|
||||
event = payload["event"]
|
||||
event_type = event.get("event_type").tame(check_none_or(check_string))
|
||||
|
||||
if event_type not in PAGER_DUTY_EVENT_NAMES_V3:
|
||||
raise UnsupportedWebhookEventTypeError(event_type)
|
||||
|
||||
format_dict = build_pagerduty_formatdict_v3(event)
|
||||
send_formatted_pagerduty(request, user_profile, event_type, format_dict)
|
||||
|
||||
return json_success(request)
|
||||
Reference in New Issue
Block a user