PagerDuty API client in Go, primarily used by the PagerDuty provider in Terraform.
go get github.com/heimweh/go-pagerduty/pagerduty
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.Response.StatusCode)
}
- 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
Run all unit tests with make test
Run a specific subset of unit test by name using make test TESTARGS="-v -run TestTeams"
which will run all test functions with "TestTeams" in their name while -v
enables verbose output.