Skip to content

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

License

Notifications You must be signed in to change notification settings

stefanoboriero/go-pagerduty

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.Response.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

Testing

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.8%
  • Makefile 0.2%