pagerduty

package module
v0.0.0-...-2ae88fd Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2015 License: MIT Imports: 4 Imported by: 7 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

PagerDuty

Build Status

PagerDuty's integration API client written in Go.

Documentation

Documentation is available at godoc.org

Integration API Documentation is on PagerDuty's website

License

This code is free to use and distribute, under the MIT license.

Documentation

Overview

Package pagerduty is a client to the Pager Duty Integration API. The API is described here: http://developer.pagerduty.com/documentation/integration/events

// Create a new "trigger" event
event := pagerduty.NewTriggerEvent(myKey, "test API")

// Customize the incident key. If not done, pager duty will assign one to you.
event.IncidentKey = "My Incident Key"

// Submit the event to pager duty's API
response, statusCode, err := pagerduty.Submit(event)

Index

Constants

This section is empty.

Variables

View Source
var Endpoint = "https://events.pagerduty.com/generic/2010-04-15/create_event.json"

PagerDuty's API endpoint

Functions

func PrepareRequest

func PrepareRequest(event *Event) (*http.Request, error)

Prepare a http.Request object that can be used by the http.Client of your choice.

Types

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"`
	Client      string                 `json:"client,omitempty"`
}

See http://developer.pagerduty.com/documentation/integration/events/trigger

func NewAcknowledgeEvent

func NewAcknowledgeEvent(serviceKey, description string) *Event

Instantiates a new "acknowledge" Event struct see: http://developer.pagerduty.com/documentation/integration/events/acknowledge

func NewResolveEvent

func NewResolveEvent(serviceKey, description string) *Event

Instantiates a new "acknowledge" Event struct http://developer.pagerduty.com/documentation/integration/events/resolve

func NewTriggerEvent

func NewTriggerEvent(serviceKey, description string) *Event

Instantiates a new "trigger" Event struct see: http://developer.pagerduty.com/documentation/integration/events/trigger

type Response

type Response struct {
	Status      string
	Message     string
	IncidentKey string `json:"incident_key"`
	Errors      []string
}

See http://developer.pagerduty.com/documentation/integration/events

func NewResponse

func NewResponse(event *Event, resp *http.Response) (*Response, error)

Creates a Response struct from a HTTP Response of the PagerDuty's API

func Submit

func Submit(event *Event) (response *Response, statusCode int, err error)

Equivalent to a call to PrepareRequest, http.DefaultClient.Do() and NewResponse

Jump to

Keyboard shortcuts

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