Documentation ¶
Index ¶
- Constants
- type Alert
- type DefaultPagerDutyClientImpl
- func (c *DefaultPagerDutyClientImpl) Connect(authToken string, options ...pdApi.ClientOptions) error
- func (c *DefaultPagerDutyClientImpl) GetServiceWithContext(ctx context.Context, serviceID string, opts *pdApi.GetServiceOptions) (*pdApi.Service, error)
- func (c *DefaultPagerDutyClientImpl) ListIncidentAlerts(incidentID string) (*pdApi.ListAlertsResponse, error)
- func (c *DefaultPagerDutyClientImpl) ListIncidents(opts pdApi.ListIncidentsOptions) (*pdApi.ListIncidentsResponse, error)
- type PagerDuty
- type PagerDutyClient
Constants ¶
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 ¶
func (c *DefaultPagerDutyClientImpl) ListIncidents(opts pdApi.ListIncidentsOptions) (*pdApi.ListIncidentsResponse, error)
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 ¶
GetClusterInfoFromIncident retrieves the cluster ID associated with the given incident ID.
func (*PagerDuty) GetClusterName ¶
GetClusterName interacts with the PD service endpoint and returns the cluster name string.
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