Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore)get rid of logrus from all core structs except CLI entries. fix schedule override command #31

Merged
merged 1 commit into from
Sep 13, 2016
Merged
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
9 changes: 1 addition & 8 deletions addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ package pagerduty

import (
"fmt"
"io/ioutil"
"net/http"

log "github.com/Sirupsen/logrus"
"github.com/google/go-querystring/query"
"net/http"
)

// Addon is a third-party add-on to PagerDuty's UI.
Expand Down Expand Up @@ -55,10 +52,6 @@ func (c *Client) InstallAddon(a Addon) (*Addon, error) {
return nil, err
}
if resp.StatusCode != http.StatusCreated {
ct, rErr := ioutil.ReadAll(resp.Body)
if rErr == nil {
log.Debug(string(ct))
}
return nil, fmt.Errorf("Failed to create. HTTP Status code: %d", resp.StatusCode)
}
return getAddonFromResponse(c, resp)
Expand Down
4 changes: 0 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"fmt"
"io"
"net/http"

log "github.com/Sirupsen/logrus"
)

const (
Expand Down Expand Up @@ -73,7 +71,6 @@ func (c *Client) post(path string, payload interface{}) (*http.Response, error)
if err != nil {
return nil, err
}
log.Debugln(string(data))
return c.do("POST", path, bytes.NewBuffer(data))
}

Expand All @@ -83,7 +80,6 @@ func (c *Client) get(path string) (*http.Response, error) {

func (c *Client) do(method, path string, body io.Reader) (*http.Response, error) {
endpoint := apiEndpoint + path
log.Debugln("Endpoint:", endpoint)
req, _ := http.NewRequest(method, endpoint, body)
req.Header.Set("Accept", "application/vnd.pagerduty+json;version=2")
req.Header.Set("Content-Type", "application/json")
Expand Down
2 changes: 1 addition & 1 deletion command/schedule_override_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (c *ScheduleOverrideCreate) Run(args []string) int {
return -1
}
client := c.Meta.Client()
var o pagerduty.Overrides
var o pagerduty.Override
if len(flags.Args()) != 2 {
log.Error("Please specify input json file")
return -1
Expand Down
3 changes: 1 addition & 2 deletions escalation_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package pagerduty

import (
"fmt"
"net/http"

"github.com/google/go-querystring/query"
"net/http"
)

const (
Expand Down
4 changes: 0 additions & 4 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"encoding/json"
"fmt"
"net/http"

log "github.com/Sirupsen/logrus"
)

const eventEndPoint = "https://events.pagerduty.com/generic/2010-04-15/create_event.json"
Expand All @@ -32,12 +30,10 @@ type EventResponse struct {

// CreateEvent sends PagerDuty an event to report, acknowledge, or resolve a problem.
func CreateEvent(e Event) (*EventResponse, error) {
log.Debugln("Endpoint:", eventEndPoint)
data, err := json.Marshal(e)
if err != nil {
return nil, err
}
log.Debugln(string(data))
req, _ := http.NewRequest("POST", eventEndPoint, bytes.NewBuffer(data))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Expand Down
1 change: 0 additions & 1 deletion incident.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package pagerduty

import (
"fmt"

"github.com/google/go-querystring/query"
)

Expand Down
1 change: 0 additions & 1 deletion log_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package pagerduty

import (
"fmt"

"github.com/google/go-querystring/query"
)

Expand Down
3 changes: 1 addition & 2 deletions maintenance_window.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package pagerduty

import (
"fmt"
"net/http"

"github.com/google/go-querystring/query"
"net/http"
)

// MaintenanceWindow is used to temporarily disable one or more services for a set period of time.
Expand Down
3 changes: 1 addition & 2 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package pagerduty

import (
"fmt"
"net/http"

"github.com/google/go-querystring/query"
"net/http"
)

// Integration is an endpoint (like Nagios, email, or an API call) that generates events, which are normalized and de-duplicated by PagerDuty to create incidents.
Expand Down
3 changes: 1 addition & 2 deletions team.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package pagerduty

import (
"fmt"
"net/http"

"github.com/google/go-querystring/query"
"net/http"
)

// Team is a collection of users and escalation policies that represent a group of people within an organization.
Expand Down
3 changes: 1 addition & 2 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package pagerduty

import (
"fmt"
"net/http"

"github.com/google/go-querystring/query"
"net/http"
)

// ContactMethod is a way of contacting the user.
Expand Down