pagerduty

package
v0.1.30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID         string
	IncidentID string
	CreatedAt  time.Time
}

Alert struct represents the data contained in an alert.

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.

Directories

Path Synopsis
Package pdmock is a generated GoMock package.
Package pdmock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL