Skip to content
This repository was archived by the owner on Mar 16, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import:
- package: gopkg.in/yaml.v2
- package: github.com/stretchr/testify
- package: github.com/nlopes/slack
repo: github.com/yosmudge/slack
repo: git@github.com:yosmudge/slack.git
vcs: git
- package: golang.org/x/net
subpackages:
- websocket
- package: gopkg.in/jmcvetta/napping.v3
- package: github.com/PagerDuty/go-pagerduty
version: ^1.0.4
43 changes: 18 additions & 25 deletions pagerduty/pagerduty.go
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
package pagerduty

import(
"fmt"
"net/http"
"gopkg.in/jmcvetta/napping.v3"
import (
"github.com/PagerDuty/go-pagerduty"
)

type Api struct{
key string
org string
http *napping.Session
timezone string
type Api struct {
key string
org string
client *pagerduty.Client
timezone string
}

// Pagerduty API doesn't provide a sane way of checking for auth
// so we just get the schedules at setup time
func New(key string, org string) (*Api, error){
a := Api{}
a.key = key
a.org = org
a.timezone = "UTC"
func New(key string, org string) (*Api, error) {
a := Api{}
a.key = key
a.org = org
a.timezone = "UTC"

a.http = &napping.Session{
Header: &http.Header{
"Authorization": []string{fmt.Sprintf("Token token=%s", a.key)},
"User-Agent": []string{"PagerBot +https://github.com/yosmudge/pagerbot"},
},
}
a.client = pagerduty.NewClient(key)

_, err := a.request("schedules")
if err != nil {
return &a, err
}
_, err := a.client.ListSchedules(pagerduty.ListSchedulesOptions{})
if err != nil {
return &a, err
}

return &a, nil
return &a, nil
}
117 changes: 0 additions & 117 deletions pagerduty/request.go

This file was deleted.

Loading