pager

package module
Version: v0.0.0-...-17442a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2016 License: MIT Imports: 5 Imported by: 4

README

pager

pager is a Go package for triggering PagerDuty incidents.

API Documentation

Documentation

Overview

Package pager provides PagerDuty incident triggers.

Global usage:

pager.ServiceKey = "3961B1F4AD08424C9DA704DEBCBBF8F3"
incidentKey, err := pager.Trigger("Everything is on fire.")

Individual services:

opsPager := pager.New("09D0A4B9B3F54047BCD7B65704A58333")
incidentKey, err = opsPager.Trigger("Server out of memory.")

Including extra details:

 pager.TriggerWithDetails("Oh no", map[string]interface{}{
     "cause": "it's a mystery",
     "responsible": "not me!",
})

Index

Constants

This section is empty.

Variables

View Source
var ServiceKey = ""

ServiceKey is the integration key used for the global pager client. This comes from the "integration key" that is generated when you create a generic API integration in PagerDuty.

Functions

func ResolveIncidentKey

func ResolveIncidentKey(incidentKey string) error

ResolveIncidentKey resolves a triggered PagerDuty incident using the default client.

func Trigger

func Trigger(description string) (incidentKey string, err error)

Trigger creates a new PagerDuty incident using the default client with the given description. The returned incident key can be used to resolve the incident. It can also be used by the "TriggerIncidentKey*" functions to trigger an incident only if that specific incident has been resolved.

func TriggerIncidentKey

func TriggerIncidentKey(description string, key string) (incidentKey string, err error)

TriggerIncidentKey triggers an incident using the default client with a given incident key only if that incident has been resolved or if that incident doesn't exist yet.

func TriggerIncidentKeyWithDetails

func TriggerIncidentKeyWithDetails(description string, key string, details map[string]interface{}) (incidentKey string, err error)

TriggerIncidentKeyWithDetails triggers an incident using the default client with a given incident key only if that incident has been resolved or if that incident doesn't exist yet.

func TriggerWithDetails

func TriggerWithDetails(description string, details map[string]interface{}) (incidentKey string, err error)

TriggerWithDetails triggers an incident using the default client with a description string and a key-value map that will be saved as the incident's "details".

Types

type Pager

type Pager struct {
	ServiceKey string
}

Pager is a PagerDuty client configured to trigger and resolve pager alerts for a service.

func New

func New(serviceKey string) *Pager

New returns a new PagerDuty client for the given integration.

func (*Pager) ResolveIncidentKey

func (p *Pager) ResolveIncidentKey(incidentKey string) error

ResolveIncidentKey resolves a triggered PagerDuty incident.

func (*Pager) Trigger

func (p *Pager) Trigger(description string) (incidentKey string, err error)

Trigger creates a new PagerDuty incident with the given description. The returned incident key can be used to resolve the incident. It can also be used by the "TriggerIncidentKey*" functions to trigger an incident only if that specific incident has been resolved.

func (*Pager) TriggerIncidentKey

func (p *Pager) TriggerIncidentKey(description string, key string) (incidentKey string, err error)

TriggerIncidentKey triggers an incident with a given incident key only if that incident has been resolved or if that incident doesn't exist yet.

func (*Pager) TriggerIncidentKeyWithDetails

func (p *Pager) TriggerIncidentKeyWithDetails(description string, key string, details map[string]interface{}) (incidentKey string, err error)

TriggerIncidentKeyWithDetails triggers an incident with a given incident key only if that incident has been resolved or if that incident doesn't exist yet.

func (*Pager) TriggerWithDetails

func (p *Pager) TriggerWithDetails(description string, details map[string]interface{}) (incidentKey string, err error)

TriggerWithDetails triggers an incident with a description string and a key-value map that will be saved as the incident's "details".

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL