Documentation ¶
Index ¶
- Constants
- type Acknowledgement
- type Action
- type Assignment
- type Body
- type Client
- type ConferenceBridge
- type Config
- type CreateIncidentInput
- type HTTPClient
- func (hc HTTPClient) CreateIncident(ctx context.Context, incident CreateIncidentInput) (output Incident, err error)
- func (hc HTTPClient) ListIncidents(ctx context.Context, opts ...ListIncidentOption) (output ListIncidentsOutput, err error)
- func (hc HTTPClient) Request(ctx context.Context, opts ...r2.Option) *r2.Request
- func (hc HTTPClient) UpdateIncident(ctx context.Context, id string, incident UpdateIncidentInput) (output Incident, err error)
- type Incident
- type IncidentStatus
- type Include
- type ListIncidentOption
- func OptListIncidentsDateRange(dateRange string) ListIncidentOption
- func OptListIncidentsIncidentKey(incidentKey string) ListIncidentOption
- func OptListIncidentsInclude(include ...Include) ListIncidentOption
- func OptListIncidentsLimit(limit int) ListIncidentOption
- func OptListIncidentsOffset(offset int) ListIncidentOption
- func OptListIncidentsServiceIDs(serviceIDs ...string) ListIncidentOption
- func OptListIncidentsSince(since string) ListIncidentOption
- func OptListIncidentsSortBy(sortBy string) ListIncidentOption
- func OptListIncidentsStatuses(statuses ...IncidentStatus) ListIncidentOption
- func OptListIncidentsTeamIDs(teamIDs ...string) ListIncidentOption
- func OptListIncidentsTimeZone(timeZone string) ListIncidentOption
- func OptListIncidentsTotal(total bool) ListIncidentOption
- func OptListIncidentsUntil(until string) ListIncidentOption
- func OptListIncidentsUrgencies(urgencies ...string) ListIncidentOption
- func OptListIncidentsUserIDs(userIDs ...string) ListIncidentOption
- type ListIncidentsOptions
- type ListIncidentsOutput
- type MockAPI
- type Reference
- type ReferenceType
- type ResolveReason
- type UpdateIncidentInput
- type Urgency
Constants ¶
const (
// DefaultAddr is the default api address.
DefaultAddr = "https://api.pagerduty.com"
)
const (
ErrNon200Status ex.Class = "non-200 status code from remote"
)
Errors
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acknowledgement ¶
type Acknowledgement struct { At time.Time `json:"at,omitempty"` Acknowledger Reference `json:"acknowledger,omitempty"` }
Acknowledgement is an api type.
type Assignment ¶
Assignment is an assignment.
type Client ¶
type Client interface { CreateIncident(context.Context, CreateIncidentInput) (Incident, error) UpdateIncident(context.Context, string, UpdateIncidentInput) (Incident, error) ListIncidents(context.Context, ...ListIncidentOption) (ListIncidentsOutput, error) }
Client is the interface pagerduty clients implement.
type ConferenceBridge ¶
type ConferenceBridge struct { ConferenceNumber string `json:"conference_number,omitempty"` ConferenceURL string `json:"conference_url,omitempty"` }
ConferenceBridge is an api type.
type CreateIncidentInput ¶
type CreateIncidentInput struct { Type string `json:"type"` // required Title string `json:"title"` // required Service Reference `json:"service"` /// required Priority *Reference `json:"priority,omitempty"` Body *Body `json:"body,omitempty"` IncidentKey string `json:"incident_key,omitempty"` Assignments []Assignment `json:"assignments,omitempty"` EscalationPolicy *Reference `json:"escalation_policy,omitempty"` Urgency Urgency `json:"urgency,omitempty"` ConferenceBridge *ConferenceBridge `json:"conference_bridge,omitempty"` }
CreateIncidentInput is the input to create|update incident.
type HTTPClient ¶
HTTPClient is an implementation of the http client.
func (HTTPClient) CreateIncident ¶
func (hc HTTPClient) CreateIncident(ctx context.Context, incident CreateIncidentInput) (output Incident, err error)
CreateIncident creates an incident using the incident events api.
func (HTTPClient) ListIncidents ¶
func (hc HTTPClient) ListIncidents(ctx context.Context, opts ...ListIncidentOption) (output ListIncidentsOutput, err error)
ListIncidents lists incidents.
Use the variadic options to set constraining query parameters to filter or sort the incidents.
func (HTTPClient) UpdateIncident ¶
func (hc HTTPClient) UpdateIncident(ctx context.Context, id string, incident UpdateIncidentInput) (output Incident, err error)
UpdateIncident implements the update incident method for the client.
type Incident ¶
type Incident struct { ID string `json:"id"` Summary string `json:"summary,omitempty"` Type string `json:"type,omitempty"` Self string `json:"self,omitempty"` HTMLUrl string `json:"html_url,omitempty"` IncidentNumber int `json:"incident_number,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` Status IncidentStatus `json:"status"` Title string `json:"title,omitempty"` PendingActions []Action `json:"pending_actions,omitempty"` IncidentKey string `json:"incident_key,omitempty"` Service Reference `json:"service,omitempty"` Assignments []Assignment `json:"assignments,omitempty"` AssignedVia string `json:"assigned_via,omitempty"` Acknowledgements []Acknowledgement `json:"acknowledgements,omitempty"` LastStatusChangeAt time.Time `json:"last_status_change_at,omitempty"` LastStatusChangeBy Reference `json:"last_status_change_by,omitempty"` EscalationPolicy Reference `json:"escalation_policy,omitempty"` Teams []Reference `json:"teams,omitempty"` Priority Reference `json:"priority,omitempty"` Urgency string `json:"urgency"` ResolveReason ResolveReason `json:"resolve_reason,omitempty"` AlertCounts struct { Triggered int `json:"triggered,omitempty"` Resolved int `json:"resolved,omitempty"` All int `json:"all,omitempty"` } `json:"alert_counts,omitempty"` Body Body `json:"body,omitempty"` }
Incident is the full api type for incidents.
type IncidentStatus ¶
type IncidentStatus string
IncidentStatus is a status for an incident
const ( IncidentStatusTriggered IncidentStatus = "triggered" IncidentStatusAcknowledged IncidentStatus = "acknowledged" IncidentStatusResolved IncidentStatus = "resolved" )
IncidentStatuses
type Include ¶
type Include string
Include is an object type constant.
const ( IncludeUsers Include = "users" IncludeServices Include = "services" IncludeFirstTriggerLogEntries Include = "first_trigger_log_entries" IncludeEscalationPolicies Include = "escalation_policies" IncludeTeams Include = "teams" IncludeAssignees Include = "assignees" IncludeAcknowledgers Include = "acknowledgers" IncludePriorities Include = "priorities" IncludeConferenceBridge Include = "conference_bridge" )
Includes
type ListIncidentOption ¶
type ListIncidentOption func(*ListIncidentsOptions)
ListIncidentOption mutates the list incidents options.
func OptListIncidentsDateRange ¶
func OptListIncidentsDateRange(dateRange string) ListIncidentOption
OptListIncidentsDateRange sets a field on the options.
func OptListIncidentsIncidentKey ¶
func OptListIncidentsIncidentKey(incidentKey string) ListIncidentOption
OptListIncidentsIncidentKey sets a field on the options.
func OptListIncidentsInclude ¶
func OptListIncidentsInclude(include ...Include) ListIncidentOption
OptListIncidentsInclude sets the "include" query string value.
Include sets if we should add additional data to the response for corresponding fields on the output object.
func OptListIncidentsLimit ¶
func OptListIncidentsLimit(limit int) ListIncidentOption
OptListIncidentsLimit sets a field on the options.
func OptListIncidentsOffset ¶
func OptListIncidentsOffset(offset int) ListIncidentOption
OptListIncidentsOffset sets a field on the options.
func OptListIncidentsServiceIDs ¶
func OptListIncidentsServiceIDs(serviceIDs ...string) ListIncidentOption
OptListIncidentsServiceIDs sets a field on the options.
func OptListIncidentsSince ¶
func OptListIncidentsSince(since string) ListIncidentOption
OptListIncidentsSince sets a field on the options.
func OptListIncidentsSortBy ¶
func OptListIncidentsSortBy(sortBy string) ListIncidentOption
OptListIncidentsSortBy sets a field on the options.
func OptListIncidentsStatuses ¶
func OptListIncidentsStatuses(statuses ...IncidentStatus) ListIncidentOption
OptListIncidentsStatuses sets a field on the options.
func OptListIncidentsTeamIDs ¶
func OptListIncidentsTeamIDs(teamIDs ...string) ListIncidentOption
OptListIncidentsTeamIDs sets a field on the options.
func OptListIncidentsTimeZone ¶
func OptListIncidentsTimeZone(timeZone string) ListIncidentOption
OptListIncidentsTimeZone sets a field on the options.
func OptListIncidentsTotal ¶
func OptListIncidentsTotal(total bool) ListIncidentOption
OptListIncidentsTotal sets a field on the options.
func OptListIncidentsUntil ¶
func OptListIncidentsUntil(until string) ListIncidentOption
OptListIncidentsUntil sets a field on the options.
func OptListIncidentsUrgencies ¶
func OptListIncidentsUrgencies(urgencies ...string) ListIncidentOption
OptListIncidentsUrgencies sets a field on the options.
func OptListIncidentsUserIDs ¶
func OptListIncidentsUserIDs(userIDs ...string) ListIncidentOption
OptListIncidentsUserIDs sets a field on the options.
type ListIncidentsOptions ¶
type ListIncidentsOptions struct { DateRange string IncidentKey string Include []Include Limit int Offset int ServiceIDs []string Since string SortBy string Statuses []IncidentStatus TeamIDs []string TimeZone string Total *bool Until string Urgencies []string UserIDs []string }
ListIncidentsOptions are all the options for a list incidents call.
func (ListIncidentsOptions) Options ¶
func (lio ListIncidentsOptions) Options() (output []r2.Option)
Options yields the r2 options for the options.
_Allow myself to introduce ... myself_
type ListIncidentsOutput ¶
type ListIncidentsOutput struct { Offset int `json:"offset"` Limit int `json:"limit"` More bool `json:"more"` Total *int `json:"total"` Incidents []Incident `json:"incidents"` }
ListIncidentsOutput is the output of a list incidents call.
type MockAPI ¶
type MockAPI struct { ListIncidents func() ListIncidentsOutput UpdateIncident func(string, UpdateIncidentInput) Incident CreateIncident func(CreateIncidentInput) Incident }
MockAPI implements methods that can be called with the client.
type Reference ¶
type Reference struct { ID string `json:"id"` Type ReferenceType `json:"type"` Summary string `json:"summary,omitempty"` Self string `json:"self,omitempty"` HTMLUrl string `json:"html_url,omitempty"` }
Reference is a generic api object reference type.
type ReferenceType ¶
type ReferenceType string
ReferenceType is a type of reference.
const ( ReferenceTypeEscalationPolicy ReferenceType = "escalation_policy_reference" ReferenceTypeService ReferenceType = "service_reference" ReferenceTypeUser ReferenceType = "user_reference" )
ReferenceTypes
type ResolveReason ¶
type ResolveReason struct { Type string `json:"type,omitempty"` Incident Reference `json:"incident,omitempty"` }
ResolveReason is an api type.
type UpdateIncidentInput ¶
type UpdateIncidentInput struct { Type string `json:"type"` // required Status IncidentStatus `json:"status,omitempty"` // required Priority *Reference `json:"priority,omitempty"` Resolution string `json:"resolution,omitempty"` Title string `json:"title,omitempty"` EscalationLevel int `json:"escalation_level,omitempty"` Assignments []Assignment `json:"assignments,omitempty"` EscalationPolicy *Reference `json:"escalation_policy,omitempty"` Urgency string `json:"urgency,omitempty"` ConferenceBridge *ConferenceBridge `json:"conference_bridge,omitempty"` }
UpdateIncidentInput is the input to update incident.