/go-pagerduty

PagerDuty API client (used by the PagerDuty provider in Terraform)

Primary LanguageGoMozilla Public License 2.0MPL-2.0

go-pagerduty

PagerDuty API client in Go, primarily used by the PagerDuty provider in Terraform.

GoDoc Build Status

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

  1. Fork it ( https://github.com/heimweh/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