clients

package
v1.0.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
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

func NewCommand(cmd string, defaultArgs ...string) (*Command, error)

NewCommand returns a new Command or an error.

func (*Command) Run

func (c *Command) Run(args ...string) (string, error)

Run starts the command, waits until execution finished and returns stdOut or the 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

func (f *Filter) AlertnameFilterFromText(theString string) error

AlertnameFilterFromText takes a string potentially containing an alertname and creates the filter accordingly.

func (*Filter) ClusterFilterFromText

func (f *Filter) ClusterFilterFromText(theString string) error

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.

func (*Filter) GetLimit

func (f *Filter) GetLimit() uint

GetLimit returns the current limit of items per response.

func (*Filter) SetLimit

func (f *Filter) SetLimit(limit uint)

SetLimit sets the limit of items per response.

func (*Filter) ToString

func (f *Filter) ToString() string

ToString returns the string representation of the filter.

type K8sClient

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

K8sClient ...

func NewK8sClient

func NewK8sClient(cfg *config.K8sConfig, logger log.Logger) (*K8sClient, error)

NewK8sClient returns a new K8sClient or an error.

func NewK8sClientFromEnv

func NewK8sClientFromEnv() (*K8sClient, error)

NewK8sClientFromEnv get's the configuration from the environment and returns a new K8sClient or an error.

func (*K8sClient) ListNodes

func (k *K8sClient) ListNodes() (string, error)

ListNodes is self-explanatory.

func (*K8sClient) SetContext

func (k *K8sClient) SetContext(context string) error

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.

Jump to

Keyboard shortcuts

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