Documentation ¶
Overview ¶
A simple Go client for PagerDuty's API. This includes the trigger, acknowledge, and resolve event types. This also includes a retry feature when sending to PagerDuty fails.
Index ¶
- type PagerDuty
- func (p *PagerDuty) Acknowledge(incidentKey, description string, details interface{}) *PagerDutyResponse
- func (p *PagerDuty) Resolve(incidentKey, description string, details interface{}) *PagerDutyResponse
- func (p *PagerDuty) Trigger(incidentKey, description, client, clientUrl string, details interface{}) *PagerDutyResponse
- type PagerDutyResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PagerDuty ¶
type PagerDuty struct { ServiceKey string // The Service key needed to access PagerDuty. MaxRetry int // Maximum API call retries. Defaults to 0. RetryBaseInterval int // Starting delay for a retry in seconds. Defaults to 10. // contains filtered or unexported fields }
PagerDuty requires a Service Key to work. API call can be retried if MaxRetry is set to > 1. This retries the request with an exponential delay for each retry.
func (*PagerDuty) Acknowledge ¶
func (p *PagerDuty) Acknowledge(incidentKey, description string, details interface{}) *PagerDutyResponse
Send an ACKNOWLEDGE event.
func (*PagerDuty) Resolve ¶
func (p *PagerDuty) Resolve(incidentKey, description string, details interface{}) *PagerDutyResponse
Send a RESOLVE event.
func (*PagerDuty) Trigger ¶
func (p *PagerDuty) Trigger(incidentKey, description, client, clientUrl string, details interface{}) *PagerDutyResponse
Send a TRIGGER event. The incidentKey may be left empty and PagerDuty will generate one.
type PagerDutyResponse ¶
type PagerDutyResponse struct { Status string `json:"status"` Message string `json:"message"` IncidentKey string `json:"incident_key,omitempty"` Errors []string `json:"errors,omitempty"` }
The response from calling the PagerDuty API. This can contain errors if the API call failed. Also, any errors encountered when calling the API is added to the Errors list.
func (*PagerDutyResponse) Error ¶
func (p *PagerDutyResponse) Error() string
Error interface implementation.
func (*PagerDutyResponse) HasErrors ¶
func (p *PagerDutyResponse) HasErrors() bool
Returns true if there are any errors during API call.
func (*PagerDutyResponse) String ¶
func (p *PagerDutyResponse) String() string
Return the JSON string.