Documentation
¶
Index ¶
- Variables
- func AcknowledgeIncident(client PagerDutyClient, incidents []pagerduty.Incident, user *pagerduty.User) ([]pagerduty.Incident, error)
- func GetAlerts(client PagerDutyClient, id string, opts pagerduty.ListIncidentAlertsOptions) ([]pagerduty.IncidentAlert, error)
- func GetEscalationPolicy(client PagerDutyClient, id string, opts pagerduty.GetEscalationPolicyOptions) (*pagerduty.EscalationPolicy, error)
- func GetIncident(client PagerDutyClient, id string) (*pagerduty.Incident, error)
- func GetIncidents(client PagerDutyClient, opts pagerduty.ListIncidentsOptions) ([]pagerduty.Incident, error)
- func GetNotes(client PagerDutyClient, id string) ([]pagerduty.IncidentNote, error)
- func GetTeamMemberIDs(client PagerDutyClient, teams []*pagerduty.Team, ...) ([]string, error)
- func GetTeams(client PagerDutyClient, teams []string) ([]*pagerduty.Team, error)
- func GetUser(client PagerDutyClient, id string, opts pagerduty.GetUserOptions) (*pagerduty.User, error)
- func GetUserOnCalls(client PagerDutyClient, id string, opts pagerduty.ListOnCallOptions) ([]pagerduty.OnCall, error)
- func NewListIncidentOptsFromDefaults() pagerduty.ListIncidentsOptions
- func PostNote(client PagerDutyClient, id string, user *pagerduty.User, content string) (*pagerduty.IncidentNote, error)
- func ReEscalateIncidents(client PagerDutyClient, incidents []pagerduty.Incident, ...) ([]pagerduty.Incident, error)
- func ReassignIncidents(client PagerDutyClient, incidents []pagerduty.Incident, user *pagerduty.User, ...) ([]pagerduty.Incident, error)
- type Config
- type MockPagerDutyClient
- func (m *MockPagerDutyClient) GetIncidentWithContext(ctx context.Context, id string) (*pagerduty.Incident, error)
- func (m *MockPagerDutyClient) GetTeamWithContext(ctx context.Context, team string) (*pagerduty.Team, error)
- func (m *MockPagerDutyClient) ListIncidentAlertsWithContext(ctx context.Context, id string, opts pagerduty.ListIncidentAlertsOptions) (*pagerduty.ListAlertsResponse, error)
- func (m *MockPagerDutyClient) ListIncidentNotesWithContext(ctx context.Context, id string) ([]pagerduty.IncidentNote, error)
- func (m *MockPagerDutyClient) ListIncidentsWithContext(ctx context.Context, opts pagerduty.ListIncidentsOptions) (*pagerduty.ListIncidentsResponse, error)
- func (m *MockPagerDutyClient) ManageIncidentsWithContext(ctx context.Context, email string, opts []pagerduty.ManageIncidentsOptions) (*pagerduty.ListIncidentsResponse, error)
- type PagerDutyClient
- type PagerDutyClientInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMockError = fmt.Errorf("pd.Mock(): mock error") // Used to mock errors in unit tests
Functions ¶
func AcknowledgeIncident ¶
func GetAlerts ¶
func GetAlerts(client PagerDutyClient, id string, opts pagerduty.ListIncidentAlertsOptions) ([]pagerduty.IncidentAlert, error)
func GetEscalationPolicy ¶ added in v0.0.9
func GetEscalationPolicy(client PagerDutyClient, id string, opts pagerduty.GetEscalationPolicyOptions) (*pagerduty.EscalationPolicy, error)
func GetIncident ¶
func GetIncident(client PagerDutyClient, id string) (*pagerduty.Incident, error)
func GetIncidents ¶
func GetIncidents(client PagerDutyClient, opts pagerduty.ListIncidentsOptions) ([]pagerduty.Incident, error)
func GetNotes ¶
func GetNotes(client PagerDutyClient, id string) ([]pagerduty.IncidentNote, error)
func GetTeamMemberIDs ¶
func GetTeamMemberIDs(client PagerDutyClient, teams []*pagerduty.Team, opts pagerduty.ListTeamMembersOptions) ([]string, error)
func GetUser ¶
func GetUser(client PagerDutyClient, id string, opts pagerduty.GetUserOptions) (*pagerduty.User, error)
func GetUserOnCalls ¶ added in v0.0.7
func GetUserOnCalls(client PagerDutyClient, id string, opts pagerduty.ListOnCallOptions) ([]pagerduty.OnCall, error)
func NewListIncidentOptsFromDefaults ¶
func NewListIncidentOptsFromDefaults() pagerduty.ListIncidentsOptions
func PostNote ¶
func PostNote(client PagerDutyClient, id string, user *pagerduty.User, content string) (*pagerduty.IncidentNote, error)
func ReEscalateIncidents ¶ added in v0.0.9
func ReEscalateIncidents(client PagerDutyClient, incidents []pagerduty.Incident, policy *pagerduty.EscalationPolicy, level uint) ([]pagerduty.Incident, error)
ReEscalateIncidents re-escalates a list of incidents to an escalation policy at a specific level
Types ¶
type Config ¶
type Config struct {
Client PagerDutyClient
CurrentUser *pagerduty.User
// List of the users in the Teams
TeamsMemberIDs []string
Teams []*pagerduty.Team
EscalationPolicies map[string]*pagerduty.EscalationPolicy
IgnoredUsers []*pagerduty.User
}
Config is a struct that holds the PagerDuty client used for all the PagerDuty calls, and the config info for teams, and ignored users
type MockPagerDutyClient ¶ added in v0.0.8
type MockPagerDutyClient struct {
PagerDutyClient
}
func (*MockPagerDutyClient) GetIncidentWithContext ¶ added in v0.0.8
func (*MockPagerDutyClient) GetTeamWithContext ¶ added in v0.0.8
func (*MockPagerDutyClient) ListIncidentAlertsWithContext ¶ added in v0.0.8
func (m *MockPagerDutyClient) ListIncidentAlertsWithContext(ctx context.Context, id string, opts pagerduty.ListIncidentAlertsOptions) (*pagerduty.ListAlertsResponse, error)
func (*MockPagerDutyClient) ListIncidentNotesWithContext ¶ added in v0.0.8
func (m *MockPagerDutyClient) ListIncidentNotesWithContext(ctx context.Context, id string) ([]pagerduty.IncidentNote, error)
func (*MockPagerDutyClient) ListIncidentsWithContext ¶ added in v0.0.8
func (m *MockPagerDutyClient) ListIncidentsWithContext(ctx context.Context, opts pagerduty.ListIncidentsOptions) (*pagerduty.ListIncidentsResponse, error)
func (*MockPagerDutyClient) ManageIncidentsWithContext ¶ added in v0.0.9
func (m *MockPagerDutyClient) ManageIncidentsWithContext(ctx context.Context, email string, opts []pagerduty.ManageIncidentsOptions) (*pagerduty.ListIncidentsResponse, error)
type PagerDutyClient ¶
type PagerDutyClient interface {
PagerDutyClientInterface
}
PagerDutyClient implements PagerDutyClientInterface and is used by the pd package to make calls to PagerDuty This allows for mocking calls that would usually use the pagerduty.Client struct
type PagerDutyClientInterface ¶
type PagerDutyClientInterface interface {
CreateIncidentNoteWithContext(ctx context.Context, id string, note pagerduty.IncidentNote) (*pagerduty.IncidentNote, error)
GetCurrentUserWithContext(ctx context.Context, opts pagerduty.GetCurrentUserOptions) (*pagerduty.User, error)
GetEscalationPolicyWithContext(ctx context.Context, id string, opts *pagerduty.GetEscalationPolicyOptions) (*pagerduty.EscalationPolicy, error)
GetIncidentWithContext(ctx context.Context, id string) (*pagerduty.Incident, error)
GetTeamWithContext(ctx context.Context, id string) (*pagerduty.Team, error)
ListMembersWithContext(ctx context.Context, id string, opts pagerduty.ListTeamMembersOptions) (*pagerduty.ListTeamMembersResponse, error)
GetUserWithContext(ctx context.Context, id string, opts pagerduty.GetUserOptions) (*pagerduty.User, error)
ListIncidentAlertsWithContext(ctx context.Context, id string, opts pagerduty.ListIncidentAlertsOptions) (*pagerduty.ListAlertsResponse, error)
ListIncidentsWithContext(ctx context.Context, opts pagerduty.ListIncidentsOptions) (*pagerduty.ListIncidentsResponse, error)
ListIncidentNotesWithContext(ctx context.Context, id string) ([]pagerduty.IncidentNote, error)
ListOnCallsWithContext(ctx context.Context, opts pagerduty.ListOnCallOptions) (*pagerduty.ListOnCallsResponse, error)
ManageIncidentsWithContext(ctx context.Context, email string, opts []pagerduty.ManageIncidentsOptions) (*pagerduty.ListIncidentsResponse, error)
}
PagerDutyClientInterface is an interface that defines the methods used by the pd package and makes it easier to mock calls to PagerDuty in tests
Click to show internal directories.
Click to hide internal directories.