pd

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcknowledgeIncident

func AcknowledgeIncident(client PagerDutyClient, incidents []*pagerduty.Incident, user *pagerduty.User) ([]pagerduty.Incident, error)

func GetIncident

func GetIncident(client PagerDutyClient, id string) (*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 GetTeams

func GetTeams(client PagerDutyClient, teams []string) ([]*pagerduty.Team, error)

func GetUser

func GetUser(client PagerDutyClient, id string, opts pagerduty.GetUserOptions) (*pagerduty.User, error)

func NewListIncidentOptsFromDefaults

func NewListIncidentOptsFromDefaults() pagerduty.ListIncidentsOptions

func PostNote

func PostNote(client PagerDutyClient, id string, user *pagerduty.User, content string) (*pagerduty.IncidentNote, error)

func ReassignIncidents

func ReassignIncidents(client PagerDutyClient, incidents []*pagerduty.Incident, user *pagerduty.User, users []*pagerduty.User) ([]pagerduty.Incident, error)

Types

type Config

type Config struct {
	Client      PagerDutyClient
	CurrentUser *pagerduty.User

	// List of the users in the Teams
	TeamsMemberIDs []string
	Teams          []*pagerduty.Team

	SilentUser   *pagerduty.User
	IgnoredUsers []*pagerduty.User
}

Config is a struct that holds the PagerDuty client used for all the PagerDuty calls, and the config info for teams, silent user, and ignored users

func NewConfig

func NewConfig(token string, teams []string, silentUser string, ignoredUsers []string) (*Config, 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)
	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)
	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

Jump to

Keyboard shortcuts

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