github.com/blend/go-sdk@v1.20220411.3/pagerduty/service.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package pagerduty 9 10 // Integration is an endpoint (like Nagios, email, or an API call) that generates events, which are normalized and de-duplicated by PagerDuty to create incidents. 11 type Integration struct { 12 APIObject 13 Name string `json:"name,omitempty"` 14 Service *APIObject `json:"service,omitempty"` 15 CreatedAt string `json:"created_at,omitempty"` 16 Vendor *APIObject `json:"vendor,omitempty"` 17 Type string `json:"type,omitempty"` 18 IntegrationKey string `json:"integration_key,omitempty"` 19 IntegrationEmail string `json:"integration_email,omitempty"` 20 } 21 22 // InlineModel represents when a scheduled action will occur. 23 type InlineModel struct { 24 Type string `json:"type,omitempty"` 25 Name string `json:"name,omitempty"` 26 } 27 28 // ScheduledAction contains scheduled actions for the service. 29 type ScheduledAction struct { 30 Type string `json:"type,omitempty"` 31 At InlineModel `json:"at,omitempty"` 32 ToUrgency string `json:"to_urgency"` 33 } 34 35 // IncidentUrgencyType are the incidents urgency during or outside support hours. 36 type IncidentUrgencyType struct { 37 Type string `json:"type,omitempty"` 38 Urgency string `json:"urgency,omitempty"` 39 } 40 41 // SupportHours are the support hours for the service. 42 type SupportHours struct { 43 Type string `json:"type,omitempty"` 44 Timezone string `json:"time_zone,omitempty"` 45 StartTime string `json:"start_time,omitempty"` 46 EndTime string `json:"end_time,omitempty"` 47 DaysOfWeek []uint `json:"days_of_week,omitempty"` 48 } 49 50 // IncidentUrgencyRule is the default urgency for new incidents. 51 type IncidentUrgencyRule struct { 52 Type string `json:"type,omitempty"` 53 Urgency string `json:"urgency,omitempty"` 54 DuringSupportHours *IncidentUrgencyType `json:"during_support_hours,omitempty"` 55 OutsideSupportHours *IncidentUrgencyType `json:"outside_support_hours,omitempty"` 56 } 57 58 // ListServiceRulesResponse represents a list of rules in a service 59 type ListServiceRulesResponse struct { 60 Offset uint `json:"offset,omitempty"` 61 Limit uint `json:"limit,omitempty"` 62 More bool `json:"more,omitempty"` 63 Total uint `json:"total,omitempty"` 64 Rules []ServiceRule `json:"rules,omitempty"` 65 } 66 67 // ServiceRule represents a Service rule 68 type ServiceRule struct { 69 ID string `json:"id,omitempty"` 70 Self string `json:"self,omitempty"` 71 Disabled *bool `json:"disabled,omitempty"` 72 Conditions *RuleConditions `json:"conditions,omitempty"` 73 TimeFrame *RuleTimeFrame `json:"time_frame,omitempty"` 74 Position *int `json:"position,omitempty"` 75 Actions *ServiceRuleActions `json:"actions,omitempty"` 76 } 77 78 // ServiceRuleActions represents a rule action 79 type ServiceRuleActions struct { 80 Annotate *RuleActionParameter `json:"annotate,omitempty"` 81 EventAction *RuleActionParameter `json:"event_action,omitempty"` 82 Extractions []RuleActionExtraction `json:"extractions,omitempty"` 83 Priority *RuleActionParameter `json:"priority,omitempty"` 84 Severity *RuleActionParameter `json:"severity,omitempty"` 85 Suppress *RuleActionSuppress `json:"suppress,omitempty"` 86 Suspend *RuleActionSuspend `json:"suspend,omitempty"` 87 } 88 89 // Service represents something you monitor (like a web service, email service, or database service). 90 type Service struct { 91 APIObject 92 Name string `json:"name,omitempty"` 93 Description string `json:"description,omitempty"` 94 AutoResolveTimeout *uint `json:"auto_resolve_timeout"` 95 AcknowledgementTimeout *uint `json:"acknowledgement_timeout"` 96 CreateAt string `json:"created_at,omitempty"` 97 Status string `json:"status,omitempty"` 98 LastIncidentTimestamp string `json:"last_incident_timestamp,omitempty"` 99 Integrations []Integration `json:"integrations,omitempty"` 100 EscalationPolicy EscalationPolicy `json:"escalation_policy,omitempty"` 101 Teams []Team `json:"teams,omitempty"` 102 IncidentUrgencyRule *IncidentUrgencyRule `json:"incident_urgency_rule,omitempty"` 103 SupportHours *SupportHours `json:"support_hours"` 104 ScheduledActions []ScheduledAction `json:"scheduled_actions"` 105 AlertCreation string `json:"alert_creation,omitempty"` 106 AlertGrouping string `json:"alert_grouping,omitempty"` 107 AlertGroupingTimeout *uint `json:"alert_grouping_timeout,omitempty"` 108 AlertGroupingParameters *AlertGroupingParameters `json:"alert_grouping_parameters,omitempty"` 109 } 110 111 // AlertGroupingParameters defines how alerts on the servicewill be automatically grouped into incidents 112 type AlertGroupingParameters struct { 113 Type string `json:"type"` 114 Config AlertGroupParamsConfig `json:"config"` 115 } 116 117 // AlertGroupParamsConfig is the config object on alert_grouping_parameters 118 type AlertGroupParamsConfig struct { 119 Timeout uint `json:"timeout,omitempty"` 120 Aggregate string `json:"aggregate,omitempty"` 121 Fields []string `json:"fields,omitempty"` 122 }