Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
go-pagerduty-cf1437c7c8d6/ | H | 03-May-2022 | - | |||
.gitignore | H A D | 30-Aug-2019 | 12 | |||
.goreleaser.yml | H A D | 30-Aug-2019 | 578 | |||
CHANGELOG.md | H A D | 30-Aug-2019 | 9.9 KiB | |||
Dockerfile | H A D | 30-Aug-2019 | 160 | |||
Makefile | H A D | 30-Aug-2019 | 387 | |||
README.md | H A D | 30-Aug-2019 | 2.3 KiB | |||
ability.go | H A D | 30-Aug-2019 | 617 | |||
addon.go | H A D | 30-Aug-2019 | 2.5 KiB | |||
client.go | H A D | 30-Aug-2019 | 5.2 KiB | |||
escalation_policy.go | H A D | 30-Aug-2019 | 6.5 KiB | |||
event.go | H A D | 30-Aug-2019 | 2.1 KiB | |||
event_v2.go | H A D | 30-Aug-2019 | 2.1 KiB | |||
incident.go | H A D | 30-Aug-2019 | 8.1 KiB | |||
log_entry.go | H A D | 30-Aug-2019 | 2.5 KiB | |||
maintenance_window.go | H A D | 30-Aug-2019 | 3.7 KiB | |||
notification.go | H A D | 30-Aug-2019 | 1.3 KiB | |||
on_call.go | H A D | 30-Aug-2019 | 1.7 KiB | |||
priorites.go | H A D | 30-Aug-2019 | 630 | |||
schedule.go | H A D | 30-Aug-2019 | 8.6 KiB | |||
service.go | H A D | 30-Aug-2019 | 7.4 KiB | |||
team.go | H A D | 30-Aug-2019 | 2.9 KiB | |||
user.go | H A D | 30-Aug-2019 | 3.6 KiB | |||
vendor.go | H A D | 30-Aug-2019 | 2.1 KiB | |||
webhook.go | H A D | 30-Aug-2019 | 1.3 KiB |
README.md
1[![GoDoc](https://godoc.org/github.com/PagerDuty/go-pagerduty?status.svg)](http://godoc.org/github.com/PagerDuty/go-pagerduty) [![Go Report Card](https://goreportcard.com/badge/github.com/PagerDuty/go-pagerduty)](https://goreportcard.com/report/github.com/PagerDuty/go-pagerduty) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/gojp/goreportcard/blob/master/LICENSE) 2# go-pagerduty 3 4go-pagerduty is a CLI and [go](https://golang.org/) client library for the [PagerDuty v2 API](https://v2.developer.pagerduty.com/v2/page/api-reference). 5 6## Installation 7 8``` 9go get github.com/PagerDuty/go-pagerduty 10``` 11 12## Usage 13 14### CLI 15 16The CLI requires an [authentication token](https://v2.developer.pagerduty.com/docs/authentication), which can be sepcified in `.pd.yml` 17file in the home directory of the user, or passed as a command-line argument. 18Example of config file: 19 20```yaml 21--- 22authtoken: fooBar 23``` 24 25#### Install 26```cli 27cd $GOPATH/github.com/PagerDuty/go-pagerduty 28go build -o $GOPATH/bin/pd command/* 29``` 30 31#### Commands 32`pd` command provides a single entrypoint for all the API endpoints, with individual 33API represented by their own sub commands. For an exhaustive list of sub-commands, try: 34``` 35pd --help 36``` 37 38An example of the `service` sub-command 39 40``` 41pd service list 42``` 43 44 45### Client Library 46 47```go 48package main 49 50import ( 51 "fmt" 52 "github.com/PagerDuty/go-pagerduty" 53) 54 55var authtoken = "" // Set your auth token here 56 57func main() { 58 var opts pagerduty.ListEscalationPoliciesOptions 59 client := pagerduty.NewClient(authtoken) 60 if eps, err := client.ListEscalationPolicies(opts); err != nil { 61 panic(err) 62 } else { 63 for _, p := range eps.EscalationPolicies { 64 fmt.Println(p.Name) 65 } 66 } 67} 68``` 69 70The PagerDuty API client also exposes its HTTP client as the `HTTPClient` field. 71If you need to use your own HTTP client, for doing things like defining your own 72transport settings, you can replace the default HTTP client with your own by 73simply by setting a new value in the `HTTPClient` field. 74 75## Contributing 76 771. Fork it ( https://github.com/PagerDuty/go-pagerduty/fork ) 782. Create your feature branch (`git checkout -b my-new-feature`) 793. Commit your changes (`git commit -am 'Add some feature'`) 804. Push to the branch (`git push origin my-new-feature`) 815. Create a new Pull Request 82 83## License 84[Apache 2](http://www.apache.org/licenses/LICENSE-2.0) 85