Skip to content
Open
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: 13 additions & 5 deletions pagerduty/pagerduty.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ type service struct {

// Config represents the configuration for a PagerDuty client
type Config struct {
BaseURL string
HTTPClient *http.Client
Token string
UserAgent string
Debug bool
BaseURL string
HTTPClient *http.Client
Token string
UserAgent string
XTerraformFunctionHeader string
Debug bool
}

// Client manages the communication with the PagerDuty API
Expand Down Expand Up @@ -163,6 +164,9 @@ func (c *Client) newRequest(method, url string, body interface{}, options ...Req
if c.Config.UserAgent != "" {
req.Header.Add("User-Agent", c.Config.UserAgent)
}
if c.Config.XTerraformFunctionHeader != "" {
req.Header.Add("x-terraform-function", c.Config.XTerraformFunctionHeader)
}
return req, nil
}

Expand Down Expand Up @@ -301,3 +305,7 @@ func (c *Client) decodeErrorResponse(res *Response) error {

return v.Error
}

func (c *Client) SetXTerraformFunctionHeader(n string) {
c.Config.XTerraformFunctionHeader = n
}