Example #1
0
func main() {
	pd := pagerduty.New(subdomain, apiKey)

	us := finduser.Service{*pd.Users}
	u, err := us.FindAndValidate(user)
	if err != nil {
		log.Fatalln("Failed to validate user: "******"Found from-user: %v, id: %v\n", u.Name, u.ID)
}
func main() {
	pd := pagerduty.New(subdomain, apiKey)

	var opts pagerduty.IncidentsOptions
	if err := json.Unmarshal([]byte(filter), &opts); err != nil {
		log.Fatalln("Failed to parse filter: " + err.Error())
	}

	incidents, err := pd.Incidents.ListAll(&opts)

	fmt.Printf("found %d incidents\n", len(incidents))
	if err != nil {
		log.Fatalln("Failed to fetch incidents for given filter: " + err.Error())
	} else {
		for _, i := range incidents {
			fmt.Printf("%v, %d, %s\n", i.CreatedOn.Format(time.RFC3339), i.IncidentNumber, i.Summary.Description)
		}
	}

}