pagerduty

package
v0.1.37 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PagerDuty Incident Statuses
	StatusTriggered    = "triggered"
	StatusAcknowledged = "acknowledged"
	StatusHigh         = "high"
	StatusLow          = "low"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID          string
	Name        string
	IncidentID  string
	Severity    string
	Status      string
	CreatedAt   time.Time
	WebURL      string
	ClusterID   string
	ClusterName string
}

Alert struct represents the data contained in an alert.

type DefaultPagerDutyClientImpl

type DefaultPagerDutyClientImpl struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *DefaultPagerDutyClientImpl

NewClient creates an instance of PDClient that is then used to connect to the actual pagerduty client.

func (*DefaultPagerDutyClientImpl) Connect

func (c *DefaultPagerDutyClientImpl) Connect(authToken string, options ...pdApi.ClientOptions) error

Connect uses the information stored in new client to create a new PagerDuty connection. It returns the PDClient object with pagerduty API connection initialized.

func (*DefaultPagerDutyClientImpl) GetServiceWithContext

func (c *DefaultPagerDutyClientImpl) GetServiceWithContext(ctx context.Context, serviceID string, opts *pdApi.GetServiceOptions) (*pdApi.Service, error)

func (*DefaultPagerDutyClientImpl) ListIncidentAlerts

func (c *DefaultPagerDutyClientImpl) ListIncidentAlerts(incidentID string) (*pdApi.ListAlertsResponse, error)

func (*DefaultPagerDutyClientImpl) ListIncidents

type PagerDuty

type PagerDuty struct {
	// contains filtered or unexported fields
}

func NewPagerDuty

func NewPagerDuty(client PagerDutyClient) *PagerDuty

func NewWithToken

func NewWithToken(authToken string, options ...pdApi.ClientOptions) (*PagerDuty, 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 (*PagerDuty) GetClusterInfoFromIncident

func (pd *PagerDuty) GetClusterInfoFromIncident(incidentID string) (info Alert, err error)

GetClusterInfoFromIncident retrieves the cluster ID associated with the given incident ID.

func (*PagerDuty) GetClusterName

func (pd *PagerDuty) GetClusterName(serviceID string) (string, error)

GetClusterName interacts with the PD service endpoint and returns the cluster name string.

func (*PagerDuty) GetIncidentAlerts

func (pd *PagerDuty) GetIncidentAlerts(incidentID string) ([]Alert, error)

GetIncidentAlerts returns all the alerts belonging to a particular incident.

type PagerDutyClient

type PagerDutyClient interface {
	Connect(authToken string, options ...pdApi.ClientOptions) error
	ListIncidents(pdApi.ListIncidentsOptions) (*pdApi.ListIncidentsResponse, error)
	ListIncidentAlerts(incidentID string) (*pdApi.ListAlertsResponse, error)
	GetServiceWithContext(ctx context.Context, serviceID string, opts *pdApi.GetServiceOptions) (*pdApi.Service, error)
}

PagerDutyClient is an interface for the actual PD API

Directories

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

Jump to

Keyboard shortcuts

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