Debian Codegraph @

pkg/services/incident/pagerduty/pagerduty_json.go

raw
1 package pagerduty
2
3 // EventPayload represents the payload being sent to the PagerDuty Events API v2.
4 //
5 // See: https://developer.pagerduty.com/docs/events-api-v2-overview
6 type EventPayload struct {
7 // Payload contains the core incident information including summary, severity, and source.
8 Payload Payload `json:"payload"`
9 // RoutingKey is the integration key used to route the event to the correct PagerDuty service.
10 RoutingKey string `json:"routing_key"`
11 // EventAction specifies the type of event (e.g., "trigger", "acknowledge", "resolve").
12 EventAction string `json:"event_action"`
13 // DedupKey is a unique key used for incident deduplication. If not provided, PagerDuty will auto-generate one.
14 DedupKey string `json:"dedup_key,omitempty"`
15 // Details contains additional custom key-value pairs for the incident.
16 Details any `json:"details,omitempty"`
17 // Contexts provides additional context such as links or images related to the incident.
18 Contexts []PagerDutyContext `json:"contexts,omitempty"`
19 // Client identifies the monitoring client or integration sending the event.
20 Client string `json:"client,omitempty"`
21 // ClientURL is a link to the monitoring client or integration dashboard.
22 ClientURL string `json:"client_url,omitempty"`
23 }
24
25 // Payload contains the core information about the incident or event being reported.
26 // It includes a summary description, severity level, and the source of the event.
27 type Payload struct {
28 // Summary is a brief description of the incident or event.
29 Summary string `json:"summary"`
30 // Severity indicates the urgency level of the event (e.g., "info", "warning", "error", "critical").
31 Severity string `json:"severity"`
32 // Source identifies the origin of the event, such as a hostname, application name, or service.
33 Source string `json:"source"`
34 }
35
36 // PagerDutyContext provides additional context about the incident, such as links to related resources.
37 type PagerDutyContext struct {
38 // Type specifies the type of context (e.g., "link", "image").
39 Type string `json:"type"`
40 // Href is the URL for link-type contexts.
41 Href string `json:"href,omitempty"`
42 // Src is the source URL for image-type contexts.
43 Src string `json:"src,omitempty"`
44 // Text is the display text for the context.
45 Text string `json:"text,omitempty"`
46 }