go client library for PagerDuty v2 API
Go Makefile
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
command Fixing Maintenance typo Mar 2, 2017
examples dont declare main twice in examples (#45) Oct 13, 2016
.gitignore add *.swp to gitignore (#25) Sep 5, 2016
.goreleaser.yml Specify go files in build May 28, 2018
.travis.yml Add gorleaser to release May 28, 2018
CHANGELOG.md Add gorleaser to release May 28, 2018
Dockerfile add dockerfile May 11, 2016
LICENSE.txt README.md Feb 26, 2016
Makefile Add gorleaser to release May 28, 2018
README.md Allow package consumers to provide their own HTTP client Jun 1, 2018
ability.go add ability API and CLI (#36) Sep 23, 2016
addon.go add nil to all post methods, remove wrongly placed resp var Jun 6, 2018
client.go add create structs, client support, headers in POST Jun 6, 2018
escalation_policy.go add nil to all post methods, remove wrongly placed resp var Jun 6, 2018
event.go Allow package consumers to provide their own HTTP client Jun 1, 2018
incident.go rename CreateIncidentValue to CreateIncidentOptions Jun 21, 2018
log_entry.go fix since and until by adding them to url scheme Jan 16, 2017
maintenance_window.go add nil to all post methods, remove wrongly placed resp var Jun 6, 2018
notification.go Refactor to work correctly with V2 API (#23) Sep 4, 2016
on_call.go Fix pagination for ListOnCalls Sep 9, 2017
priorites.go fix typo in priorities endpoint Jun 6, 2018
schedule.go add nil to all post methods, remove wrongly placed resp var Jun 6, 2018
service.go add nil to all post methods, remove wrongly placed resp var Jun 6, 2018
team.go add nil to all post methods, remove wrongly placed resp var Jun 6, 2018
user.go add nil to all post methods, remove wrongly placed resp var Jun 6, 2018
vendor.go Add query to vendor Feb 2, 2017
webhook.go fix webhook struct member name (#58) Dec 20, 2016

README.md

go-pagerduty

go-pagerduty is a CLI and go client library for PagerDuty v2 API. godoc

Installation

go get github.com/PagerDuty/go-pagerduty

Usage

CLI

The CLI requires authentication token, which can be sepcified in .pd.yml file in home directory of the user, or passed as command line argument. Example of config file:

---
authtoken: fooBar

pd command provides a single entrypoint for all the API endpoints, with individual API represented by their own sub commands. For an exhaustive list of sub-commands, try:

pd --help

An example of the service sub-command

pd service list

From golang libraries

package main

import (
	"fmt"
	"github.com/PagerDuty/go-pagerduty"
)

var	authtoken = "" // Set your auth token here

func main() {
	var opts pagerduty.ListEscalationPoliciesOptions
	client := pagerduty.NewClient(authtoken)
	if eps, err := client.ListEscalationPolicies(opts); err != nil {
		panic(err)
	} else {
		for _, p := range eps.EscalationPolicies {
			fmt.Println(p.Name)
		}
	}
}

The PagerDuty API client also exposes its HTTP client as the HTTPClient field. If you need to use your own HTTP client, for doing things like defining your own transport settings, you can replace the default HTTP client with your own by simply by setting a new value in the HTTPClient field.

License

Apache 2

Contributing

  1. Fork it ( https://github.com/PagerDuty/go-pagerduty/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request