Documentation ¶
Index ¶
- Constants
- func Register()
- type ContactMethod
- type Context
- type ContextImage
- type ContextLink
- type Error
- type ErrorResponse
- type EscalationPolicy
- type EscalationPolicyRef
- type EscalationPolicyResponse
- type EscalationRule
- type EscalationTarget
- type Event
- type EventBody
- type EventImage
- type EventPayload
- type EventResult
- type IncidentCounts
- type Integration
- type NotificationRule
- type Oncall
- type OncallsByLevel
- type OncallsResponse
- type Override
- type PolicyService
- type Response
- type Restriction
- type Schedule
- type ScheduleLayer
- type ScheduleLayerEntry
- type ScheduleRef
- type SchedulesResponse
- type Service
- type ServiceRef
- type ServicesResponse
- type SubSchedule
- type Team
- type TeamRef
- type TeamsResponse
- type User
- type UserRef
- type UsersResponse
Constants ¶
const CacheKey = `pagerduty.policy_cache`
the key name used for caching the full escalation policy
const DefaultCacheInterval = "1h"
const DefaultTopicInterval = "10m"
const OncallUsage = `` /* 188-byte string literal not displayed */
const PageDefaultMessage = `your presence is requested in the chat room`
const PageUsage = `` /* 425-byte string literal not displayed */
const PagerdutyTokenKey = `pagerduty.token`
the hal.secrets key that should contain the pagerduty auth token
const V1EventEndpoint = `https://events.pagerduty.com/generic/2010-04-15/create_event.json`
https://developer.pagerduty.com/documentation/integration/events/trigger
const V2EventEndpoint = `https://events.pagerduty.com/v2/enqueue`
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContactMethod ¶
type Context ¶
type Context interface {
GetType() string
}
Context is an interface for the contexts field in V1 PD events.
type ContextImage ¶
type ContextImage struct { Type string `json:"type"` Src string `json:"src"` Href string `json:"href,omitempty"` Alt string `json:"alt,omitempty"` }
func (*ContextImage) GetType ¶
func (c *ContextImage) GetType() string
type ContextLink ¶
type ContextLink struct { Type string `json:"type"` Href string `json:"href"` Text string `json:"text,omitempty"` }
func (*ContextLink) GetType ¶
func (c *ContextLink) GetType() string
type ErrorResponse ¶
type ErrorResponse struct {
Error Error `json:"error"`
}
type EscalationPolicy ¶
type EscalationPolicy struct { Id string `json:"id"` Summary string `json:"summary"` Type string `json:"type"` Self string `json:"self"` HtmlUrl string `json:"html_url"` Name string `json:"name"` Description string `json:"description"` NumLoops int `json:"num_loops"` RepeatEnabled bool `json:"repeat_enabled"` EscalationRules []EscalationRule `json:"escalation_rules"` ServiceRefs []ServiceRef `json:"services"` TeamRefs []TeamRef `json:"teams"` }
func GetEscalationPolicies ¶
func GetEscalationPolicies(token string, params map[string][]string) ([]EscalationPolicy, error)
type EscalationPolicyRef ¶
type EscalationPolicyResponse ¶
type EscalationPolicyResponse struct { EscalationPolicies []EscalationPolicy `json:"escalation_policies"` Offset int `json:"offset"` Limit int `json:"limit"` More bool `json:"more"` Total int `json:"total,omitempty"` }
type EscalationRule ¶
type EscalationRule struct { Id string `json:"id"` EscalationDelayInMinutes int `json:"escalation_delay_in_minutes"` Targets []EscalationTarget `json:"targets"` }
type EscalationTarget ¶
type Event ¶
type Event struct { ServiceKey string `json:"service_key"` EventType string `json:"event_type"` Description string `json:"description"` IncidentKey string `json:"incident_key,omitempty"` Details map[string]interface{} `json:"details,omitempty"` // arbitrary json Client string `json:"client,omitempty"` ClientUrl string `json:"client_url,omitempty"` Contexts []Context `json:"contexts,omitempty"` }
func NewEvent ¶
NewEvent returns an initialized Event structure. You probably don't want to use this and instead use NewTrigger/NewAck/NewResolve.
func NewResolve ¶
func NewTrigger ¶
type EventBody ¶
type EventBody struct { RoutingKey string `json:"routing_key"` Action string `json:"event_action"` // e.g. "trigger" DedupKey string `json:"dedup_key,omitempty"` // arbitrary key for server-side dedup Payload EventPayload `json:"payload"` Images []EventImage `json:"images"` Client string `json:"client"` // e.g. "Scorebot/#core" ClientUrl string `json:"client_url"` // e.g. "https://scorebot.prod.netflix.net" }
func NewV2Event ¶
type EventImage ¶
type EventPayload ¶
type EventPayload struct { Summary string `json:"summary"` // high-level text Severity string `json:"severity"` // enum: info, warning, error, critical Source string `json:"source,omitempty"` // e.g. hostname, IP, ARN Component string `json:"component,omitempty"` // e.g. "mysql", "keepalive" Group string `json:"group,omitempty"` // e.g. "www", "prod-data" Class string `json:"class,omitempty"` // e.g. "High CPU", "Latency" Custom map[string]string `json:"custom_details"` }
data structures for the PagerDuty Common Event Format Timestamp
type EventResult ¶
type IncidentCounts ¶
type Integration ¶
type Integration struct { Id string `json:"id"` Type string `json:"type"` Summary string `json:"summary"` Self string `json:"self"` HtmlUrl string `json:"html_url"` Name string `json:"name"` CreatedAt string `json:"created_at"` IntegrationKey string `json:"integration_key"` IntegrationEmail string `json:"integration_email"` }
type NotificationRule ¶
type Oncall ¶
type Oncall struct { EscalationPolicy EscalationPolicy `json:"escalation_policy"` User User `json:"user"` Schedule Schedule `json:"schedule"` EscalationLevel int `json:"escalation_level"` Start *time.Time `json:"start"` End *time.Time `json:"end"` }
func GetOncalls ¶
https://v2.developer.pagerduty.com/v2/page/api-reference#!/On-Calls/get_oncalls TODO: figure out if query should be a typed struct or validated
func GetUsersOncall ¶
type OncallsByLevel ¶
type OncallsByLevel []Oncall
OncallsByLevel provides sorting by oncall level for []Oncall.
func (OncallsByLevel) Len ¶
func (a OncallsByLevel) Len() int
func (OncallsByLevel) Less ¶
func (a OncallsByLevel) Less(i, j int) bool
func (OncallsByLevel) Swap ¶
func (a OncallsByLevel) Swap(i, j int)
type OncallsResponse ¶
type PolicyService ¶
type Response ¶
type Response struct { Status string `json:"status"` Message string `json:"message"` IncidentKey string `json:"incident_key,omitempty"` Errors []string `json:"errors,omitempty"` StatusCode int `json:""` }
func NewResponse ¶
type Restriction ¶
type Schedule ¶
type Schedule struct { Id string `json:"id"` Summary string `json:"summary"` Type string `json:"type"` Self string `json:"self"` HtmlUrl string `json:"html_url"` ScheduleLayers []ScheduleLayer `json:"schedule_layers"` Timezone string `json:"time_zone"` Name string `json:"name"` Description string `json:"description"` FinalSchedule SubSchedule `json:"final_schedule,omitempty"` OverridesSubSchedule SubSchedule `json:"overrides_subschedule,omitempty"` EscalationPolicies []EscalationPolicy `json:"escalation_policies"` Users []UserRef `json:"users"` }
type ScheduleLayer ¶
type ScheduleLayer struct { Id string `json:"id,omitempty"` Start *time.Time `json:"start"` End *time.Time `json:"end,omitempty"` Type string `json:"type"` Summary string `json:"summary"` Self string `json:"self"` HtmlUrl string `json:"html_url"` Users []UserRef `json:"users"` Restrictions []Restriction `json:"restrictions"` RotationVirtualStart string `json:"rotation_virtual_start"` RotationTurnLengthSeconds int `json:"rotation_turn_length_seconds"` Name string `json:"name"` RenderedScheduleEntries []ScheduleLayerEntry `json:"rendered_schedule_entries"` RenderedCoveragePercentage float64 `json:"rendered_coverage_percentage"` }
type ScheduleLayerEntry ¶
type ScheduleRef ¶
type SchedulesResponse ¶
type Service ¶
type Service struct { Id string `json:"id"` Type string `json:"type"` Name string `json:"name"` ServiceUrl string `json:"service_url"` ServiceKey string `json:"service_key"` AutoResolveTimeout int `json:"auto_resolve_timeout"` AcknowledgementTimeout int `json:"acknowledgement_timeout"` CreatedAt string `json:"created_at"` Status string `json:"status"` LastIncidentTimestamp string `json:"last_incident_timestamp"` EmailIncidentCreation string `json:"email_incident_creation"` IncidentCounts IncidentCounts `json:"incident_counts"` EmailFilterMode string `json:"email_filter_mode"` Description string `json:"description"` Integrations []Integration `json:"integrations"` EscalationPolicy EscalationPolicy `json:"escalation_policy"` Teams []Team `json:"teams"` }
Service represents a Pagerduty service object from /api/v1/services/:id
func GetService ¶
type ServiceRef ¶
type ServicesResponse ¶
type SubSchedule ¶
type SubSchedule struct { Name string `json:"name"` RenderedScheduleEntries []ScheduleLayerEntry `json:"rendered_schedule_entries"` RenderedCoveragePercentage float64 `json:"rendered_coverage_percentage"` }
type Team ¶
type TeamsResponse ¶
type User ¶
type User struct { Id string `json:"id"` Type string `json:"type"` Summary string `json:"summary"` Self string `json:"self"` HtmlUrl string `json:"html_url"` Name string `json:"name"` Email string `json:"email"` JobTitle string `json:"job_title"` Timezone string `json:"time_zone"` Color string `json:"color"` Role string `json:"role,omitempty"` AvatarUrl string `json:"avatar_url,omitempty"` Description string `json:"description,omitempty"` Billed bool `json:"billed,omitempty"` UserUrl string `json:"user_url,omitempty"` InvitationSent bool `json:"invitation_sent,omitempty"` MarketingOptOut bool `json:"marketing_opt_out,omitempty"` ContactMethods []ContactMethod `json:"contact_methods"` NotificationRules []NotificationRule `json:"notification_rules"` Teams []Team `json:"teams"` }