Documentation ¶
Index ¶
- Constants
- type Command
- type Filter
- func (f *Filter) AlertnameFilterFromText(theString string) error
- func (f *Filter) ClusterFilterFromText(theString string) error
- func (f *Filter) FilterIncidents(incidents []pagerduty.Incident) []pagerduty.Incident
- func (f *Filter) GetLimit() uint
- func (f *Filter) SetLimit(limit uint)
- func (f *Filter) ToString() string
- type K8sClient
- type PagerdutyClient
- func (c *PagerdutyClient) AcknowledgeIncident(incidentID string, user *pagerduty.User) (*pagerduty.ListIncidentsResponse, error)
- func (c *PagerdutyClient) AddActualAcknowledgerAsNoteToIncident(incidentID, actualAcknowledger string) (*pagerduty.IncidentNote, error)
- func (c *PagerdutyClient) GetDefaultUser() *pagerduty.User
- func (c *PagerdutyClient) GetIncident(f *Filter) (*pagerduty.Incident, error)
- func (c *PagerdutyClient) GetSchedule(scheduleName string) (*pagerduty.Schedule, error)
- func (c *PagerdutyClient) GetUserByEmail(email string) (*pagerduty.User, error)
- func (c *PagerdutyClient) ListIncidents(f *Filter) ([]pagerduty.Incident, error)
- func (c *PagerdutyClient) ListTodaysOnCallUsers(scheduleID *string) ([]*pagerduty.User, error)
- type SlackClient
- func (s *SlackClient) AddReactionToMessage(channel, timestamp, reaction string) error
- func (s *SlackClient) GetUserByEmail(email string) (*slack.User, error)
- func (s *SlackClient) GetUserByID(userID string) (*slack.User, error)
- func (s *SlackClient) NewRTM(options ...slack.RTMOption) *slack.RTM
- func (s *SlackClient) PostMessage(channelID string, options ...slack.MsgOption) (string, string, error)
Constants ¶
const ( IncidentStatusAcknowledged = "acknowledged" IncidentStatusTriggered = "triggered" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command ...
func NewCommand ¶
NewCommand returns a new Command or an error.
type Filter ¶
type Filter struct { // Alertname is the alertname to filter for. Alertname, Severity, Fingerprint string // Clusters to filter for Clusters []string // contains filtered or unexported fields }
Filter can be used to filter PagerDuty incidents. Filters provided by the PagerDuty API should be explored first before extending the below logic.
func (*Filter) AlertnameFilterFromText ¶
AlertnameFilterFromText takes a string potentially containing an alertname and creates the filter accordingly.
func (*Filter) ClusterFilterFromText ¶
ClusterFilterFromText takes a string potentially containing cluster names and creates the filter accordingly.
func (*Filter) FilterIncidents ¶
func (f *Filter) FilterIncidents(incidents []pagerduty.Incident) []pagerduty.Incident
FilterIncidents does what it says.
type K8sClient ¶
type K8sClient struct {
// contains filtered or unexported fields
}
K8sClient ...
func NewK8sClient ¶
NewK8sClient returns a new K8sClient or an error.
func NewK8sClientFromEnv ¶
NewK8sClientFromEnv get's the configuration from the environment and returns a new K8sClient or an error.
func (*K8sClient) SetContext ¶
type PagerdutyClient ¶
type PagerdutyClient struct {
// contains filtered or unexported fields
}
PagerdutyClient wraps the pagerduty client.
func NewPagerdutyClient ¶
func NewPagerdutyClient(cfg *config.PagerdutyConfig, logger log.Logger) (*PagerdutyClient, error)
NewPagerdutyClient returns a new PagerdutyClient or an error.
func NewPagerdutyClientFromEnv ¶
func NewPagerdutyClientFromEnv() (*PagerdutyClient, error)
func (*PagerdutyClient) AcknowledgeIncident ¶
func (c *PagerdutyClient) AcknowledgeIncident(incidentID string, user *pagerduty.User) (*pagerduty.ListIncidentsResponse, error)
AcknowledgeIncident sets a incident to status acknowledged and assigns the given user to it.
func (*PagerdutyClient) AddActualAcknowledgerAsNoteToIncident ¶
func (c *PagerdutyClient) AddActualAcknowledgerAsNoteToIncident(incidentID, actualAcknowledger string) (*pagerduty.IncidentNote, error)
AddActualAcknowledgerAsNoteToIncident adds a note containing the actual acknowledger to the given incident.
func (*PagerdutyClient) GetDefaultUser ¶
func (c *PagerdutyClient) GetDefaultUser() *pagerduty.User
GetDefaultUser returns the pagerduty default user.
func (*PagerdutyClient) GetIncident ¶
func (c *PagerdutyClient) GetIncident(f *Filter) (*pagerduty.Incident, error)
GetIncident returns the latest incident matching the filter or an error.
func (*PagerdutyClient) GetSchedule ¶
func (c *PagerdutyClient) GetSchedule(scheduleName string) (*pagerduty.Schedule, error)
GetSchedule returns a pagerduty schedule for the given name or an error.
func (*PagerdutyClient) GetUserByEmail ¶
func (c *PagerdutyClient) GetUserByEmail(email string) (*pagerduty.User, error)
GetUserByEmail returns the pagerduty user for the given email or an error.
func (*PagerdutyClient) ListIncidents ¶
func (c *PagerdutyClient) ListIncidents(f *Filter) ([]pagerduty.Incident, error)
ListIncidents returns a list of incidents matching the given filter or an error.
func (*PagerdutyClient) ListTodaysOnCallUsers ¶
func (c *PagerdutyClient) ListTodaysOnCallUsers(scheduleID *string) ([]*pagerduty.User, error)
ListTodaysOnCalls returns the OnCall users for today.
type SlackClient ¶
type SlackClient struct {
// contains filtered or unexported fields
}
SlackClient ...
func NewSlackClient ¶
func NewSlackClient(cfg *config.SlackConfig, logger log.Logger) (*SlackClient, error)
NewSlackClient returns a new SlackClient or an error.
func NewSlackClientFromEnv ¶
func NewSlackClientFromEnv() (*SlackClient, error)
NewSlackClientFromEnv get's the configuration from the environment and returns a new SlackClient or an error.
func (*SlackClient) AddReactionToMessage ¶
func (s *SlackClient) AddReactionToMessage(channel, timestamp, reaction string) error
AddReactionToMessage adds a reaction emoji to an existing message.
func (*SlackClient) GetUserByEmail ¶
func (s *SlackClient) GetUserByEmail(email string) (*slack.User, error)
GetUserByEmail returns the user or an error.
func (*SlackClient) GetUserByID ¶
func (s *SlackClient) GetUserByID(userID string) (*slack.User, error)
func (*SlackClient) NewRTM ¶
func (s *SlackClient) NewRTM(options ...slack.RTMOption) *slack.RTM
NewRTM returns a new RTM client.
func (*SlackClient) PostMessage ¶
func (s *SlackClient) PostMessage(channelID string, options ...slack.MsgOption) (string, string, error)
PostMessage posts a message to the specified channel.