Skip to content

Commit

Permalink
nuke sub domain, v2 api does not need one (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjib authored Aug 3, 2016
1 parent 94c50c1 commit 4b751b6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
4 changes: 1 addition & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ type APIListObject struct {

// Client wraps http client
type Client struct {
Subdomain string
authToken string
}

// NewClient creates an API client
func NewClient(subdomain, authToken string) *Client {
func NewClient(authToken string) *Client {
return &Client{
Subdomain: subdomain,
authToken: authToken,
}
}
Expand Down
8 changes: 0 additions & 8 deletions command/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ import (
"os"
)

/*
Entrypoint for pd cli client based on the go bindings of API.
good cli examples:
https://github.com/Netflix-Skunkworks/go-jira
https://github.com/docker/docker
https://github.com/hashicorp/serf
*/

const (
version = "0.1"
)
Expand Down
13 changes: 2 additions & 11 deletions command/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func (a *ArrayFlags) Set(v string) error {

type Meta struct {
Authtoken string
Subdomain string
Loglevel string
}

Expand All @@ -38,21 +37,19 @@ type FlagSetFlags uint
func (m *Meta) FlagSet(n string) *flag.FlagSet {
f := flag.NewFlagSet(n, flag.ContinueOnError)
f.StringVar(&m.Authtoken, "authtoken", "", "PagerDuty API authentication token")
f.StringVar(&m.Subdomain, "subdomain", "", "PagerDuty account name (subdomain)")
f.StringVar(&m.Loglevel, "loglevel", "", "Logging level")
return f
}

func (m *Meta) Client() *pagerduty.Client {
return pagerduty.NewClient(m.Subdomain, m.Authtoken)
return pagerduty.NewClient(m.Authtoken)
}

func (m *Meta) Help() string {
helpText := `
Generral options:
Common options:
-authtoken PagerDuty API authentication token
-subdomain PagerDuty account ID
-loglevel Logging level
`
return strings.TrimSpace(helpText)
Expand All @@ -62,9 +59,6 @@ func (m *Meta) validate() error {
if m.Authtoken == "" {
return fmt.Errorf("Authtoken can not be blank")
}
if m.Subdomain == "" {
return fmt.Errorf("Subdomain can not be blank")
}
return nil
}

Expand Down Expand Up @@ -113,8 +107,5 @@ func (m *Meta) loadConfig() error {
if m.Loglevel == "" {
m.Loglevel = other.Loglevel
}
if m.Subdomain == "" {
m.Subdomain = other.Subdomain
}
return nil
}

0 comments on commit 4b751b6

Please sign in to comment.