Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PagerDutyClient ¶
type PagerDutyClient interface { GetClusterIDFromAlertList(alertList *pagerduty.ListAlertsResponse) (string, error) GetClusterIDFromAlert(alert *pagerduty.IncidentAlert) (string, error) GetClusterID(pdClient *pagerduty.Client, incidentID string) (string, error) CreateIncident(description string) (string, error) }
PagerDutyClient defines the methods needed from the PagerDuty client.
type RealPagerDutyClient ¶
type RealPagerDutyClient struct {
PdClient *pagerduty.Client
}
RealPagerDutyClient implements the PagerDutyClient interface using the real PagerDuty client.
func NewWithToken ¶
func NewWithToken(authToken string, options ...pagerduty.ClientOptions) (*RealPagerDutyClient, error)
NewWithToken initializes a new PDClient. The token can be created using the docs https://support.pagerduty.com/docs/api-access-keys#section-generate-a-user-token-rest-api-key.
func (*RealPagerDutyClient) GetClusterID ¶
func (c *RealPagerDutyClient) GetClusterID(incidentID string) (string, error)
GetClusterID retrieves the cluster ID associated with the given incident ID.
func (*RealPagerDutyClient) GetClusterIDFromAlert ¶
func (c *RealPagerDutyClient) GetClusterIDFromAlert(alert *pagerduty.IncidentAlert) (string, error)
GetClusterIDFromAlert extracts the cluster ID from a PagerDuty incident alert. It expects the alert's body to have a Common Event Format.
func (*RealPagerDutyClient) GetClusterIDFromAlertList ¶
func (c *RealPagerDutyClient) GetClusterIDFromAlertList(alertList *pagerduty.ListAlertsResponse) (string, error)
GetClusterIDFromAlertList retrieves the cluster ID from a list of PagerDuty alerts, ensuring they have the same cluster ID or return an error if inconsistent or no alerts found.