go-pagerduty
PagerDuty API client in Go, primarily used by the PagerDuty provider in Terraform.
Installation
go get github.com/heimweh/go-pagerduty/pagerduty
Example usage
package main
import (
"fmt"
"os"
"github.com/heimweh/go-pagerduty/pagerduty"
)
func main() {
client, err := pagerduty.NewClient(&pagerduty.Config{Token: os.Getenv("PAGERDUTY_TOKEN")})
if err != nil {
panic(err)
}
resp, raw, err := client.Users.List(&pagerduty.ListUsersOptions{})
if err != nil {
panic(err)
}
for _, user := range resp.Users {
fmt.Println(user.Name)
}
// All calls returns the raw *http.Response for further inspection.
fmt.Println(raw.StatusCode)
}
Contributing
- Fork it ( https://github.com/heimweh/go-pagerduty/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request