pagerduty

package module
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

README

GoDoc Go Report Card License

go-pagerduty

go-pagerduty is a CLI and go client library for the PagerDuty v2 API.

Installation

First, download the source code

go get github.com/PagerDuty/go-pagerduty

Next build the application.

cd $GOPATH/src/github.com/PagerDuty/go-pagerduty
make install

Usage

CLI

The CLI requires an authentication token, which can be specified in .pd.yml file in the home directory of the user, or passed as a command-line argument. Example of config file:

---
authtoken: fooBar
Commands

pd command provides a single entrypoint for all the API endpoints, with individual API represented by their own sub commands. For an exhaustive list of sub-commands, try:

pd --help

An example of the service sub-command

pd service list
Client Library
package main

import (
	"fmt"
	"github.com/PagerDuty/go-pagerduty"
)

var	authtoken = "" // Set your auth token here

func main() {
	var opts pagerduty.ListEscalationPoliciesOptions
	client := pagerduty.NewClient(authtoken)
	eps, err := client.ListEscalationPolicies(opts)
	if err != nil {
		panic(err)
	}
	for _, p := range eps.EscalationPolicies {
		fmt.Println(p.Name)
	}
}

The PagerDuty API client also exposes its HTTP client as the HTTPClient field. If you need to use your own HTTP client, for doing things like defining your own transport settings, you can replace the default HTTP client with your own by simply by setting a new value in the HTTPClient field.

API Error Responses

For cases where your request results in an error from the API, you can use the errors.As() function from the standard library to extract the pagerduty.APIError error value and inspect more details about the error, including the HTTP response code and PagerDuty API Error Code.

package main

import (
	"fmt"
	"github.com/PagerDuty/go-pagerduty"
)

var	authtoken = "" // Set your auth token here

func main() {
	client := pagerduty.NewClient(authtoken)
	user, err := client.GetUser("NOTREAL", pagerduty.GetUserOptions{})
	if err != nil {
		var aerr pagerduty.APIError

		if errors.As(err, &aerr) {
			if aerr.RateLimited() {
				fmt.Println("rate limited")
				return
			}

			fmt.Println("unknown status code:", aerr.StatusCode)

			return
		}

		panic(err)
	}
	fmt.Println(user)
}

Contributing

  1. Fork it ( https://github.com/PagerDuty/go-pagerduty/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

Apache 2

Documentation

Index

Constants

View Source
const (
	Version = "1.1.2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIDetails

type APIDetails struct {
	Type    string `json:"type,omitempty"`
	Details string `json:"details,omitempty"`
}

type APIError added in v1.3.4

type APIError struct {
	// StatusCode is the HTTP response status code
	StatusCode int `json:"-"`

	// APIError represents the object returned by the API when an error occurs,
	// which includes messages that should hopefully provide useful context
	// to the end user.
	//
	// If the API response did not contain an error object, the .Valid field of
	// APIError will be false. If .Valid is true, the .ErrorObject field is
	// valid and should be consulted.
	APIError NullAPIErrorObject `json:"error"`
	// contains filtered or unexported fields
}

APIError represents the error response received when an API call fails. The HTTP response code is set inside of the StatusCode field, with the APIError field being the structured JSON error object returned from the API.

This type also provides some helper methods like .RateLimited(), .NotFound(), and .Temporary() to help callers reason about how to handle the error.

You can read more about the HTTP status codes and API error codes returned from the API here: https://developer.pagerduty.com/docs/rest-api-v2/errors/

func (APIError) Error added in v1.3.4

func (a APIError) Error() string

Error satisfies the error interface, and should contain the StatusCode, APIErrorObject.Message, and APIErrorObject.Code.

func (APIError) NotFound added in v1.3.4

func (a APIError) NotFound() bool

NotFound returns whether this was an error where it seems like the resource was not found.

func (APIError) RateLimited added in v1.3.4

func (a APIError) RateLimited() bool

RateLimited returns whether the response had a status of 429, and as such the client is rate limited. The PagerDuty rate limits should reset once per minute, and for the REST API they are an account-wide rate limit (not per API key or IP).

func (APIError) Temporary added in v1.3.4

func (a APIError) Temporary() bool

Temporary returns whether it was a temporary error, one of which is a RateLimited error.

type APIErrorObject added in v1.3.4

type APIErrorObject struct {
	Code    int      `json:"code,omitempty"`
	Message string   `json:"message,omitempty"`
	Errors  []string `json:"errors,omitempty"`
}

APIErrorObject represents the object returned by the API when an error occurs. This includes messages that should hopefully provide useful context to the end user.

type APIListObject

type APIListObject struct {
	Limit  uint `url:"limit,omitempty"`
	Offset uint `url:"offset,omitempty"`
	More   bool `url:"more,omitempty"`
	Total  uint `url:"total,omitempty"`
}

APIListObject are the fields used to control pagination when listing objects.

type APIObject

type APIObject struct {
	ID      string `json:"id,omitempty"`
	Type    string `json:"type,omitempty"`
	Summary string `json:"summary,omitempty"`
	Self    string `json:"self,omitempty"`
	HTMLURL string `json:"html_url,omitempty"`
}

APIObject represents generic api json response that is shared by most domain object (like escalation

type APIReference

type APIReference struct {
	ID   string `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
}

APIReference are the fields required to reference another API object.

type Acknowledgement

type Acknowledgement struct {
	At           string    `json:"at,omitempty"`
	Acknowledger APIObject `json:"acknowledger,omitempty"`
}

Acknowledgement is the data structure of an acknowledgement of an incident.

type ActiveBetween

type ActiveBetween struct {
	StartTime int `json:"start_time,omitempty"`
	EndTime   int `json:"end_time,omitempty"`
}

ActiveBetween represents an active_between object for setting a timeline for rules

type Addon

type Addon struct {
	APIObject
	Name     string      `json:"name,omitempty"`
	Src      string      `json:"src,omitempty"`
	Services []APIObject `json:"services,omitempty"`
}

Addon is a third-party add-on to PagerDuty's UI.

type Agent

type Agent APIObject

Agent is the actor who carried out the action.

type AlertCounts

type AlertCounts struct {
	Triggered uint `json:"triggered,omitempty"`
	Resolved  uint `json:"resolved,omitempty"`
	All       uint `json:"all,omitempty"`
}

AlertCounts is the data structure holding a summary of the number of alerts by status of an incident.

type AlertGroupParamsConfig

type AlertGroupParamsConfig struct {
	Timeout   uint     `json:"timeout,omitempty"`
	Aggregate string   `json:"aggregate,omitempty"`
	Fields    []string `json:"fields,omitempty"`
}

AlertGroupParamsConfig is the config object on alert_grouping_parameters

type AlertGroupingParameters

type AlertGroupingParameters struct {
	Type   string                 `json:"type"`
	Config AlertGroupParamsConfig `json:"config"`
}

AlertGroupingParameters defines how alerts on the servicewill be automatically grouped into incidents

type AnalyticsData

type AnalyticsData struct {
	ServiceID                      string  `json:"service_id,omitempty"`
	ServiceName                    string  `json:"service_name,omitempty"`
	TeamID                         string  `json:"team_id,omitempty"`
	TeamName                       string  `json:"team_name,omitempty"`
	MeanSecondsToResolve           int     `json:"mean_seconds_to_resolve,omitempty"`
	MeanSecondsToFirstAck          int     `json:"mean_seconds_to_first_ack,omitempty"`
	MeanSecondsToEngage            int     `json:"mean_seconds_to_engage,omitempty"`
	MeanSecondsToMobilize          int     `json:"mean_seconds_to_mobilize,omitempty"`
	MeanEngagedSeconds             int     `json:"mean_engaged_seconds,omitempty"`
	MeanEngagedUserCount           int     `json:"mean_engaged_user_count,omitempty"`
	TotalEscalationCount           int     `json:"total_escalation_count,omitempty"`
	MeanAssignmentCount            int     `json:"mean_assignment_count,omitempty"`
	TotalBusinessHourInterruptions int     `json:"total_business_hour_interruptions,omitempty"`
	TotalSleepHourInterruptions    int     `json:"total_sleep_hour_interruptions,omitempty"`
	TotalOffHourInterruptions      int     `json:"total_off_hour_interruptions,omitempty"`
	TotalSnoozedSeconds            int     `json:"total_snoozed_seconds,omitempty"`
	TotalEngagedSeconds            int     `json:"total_engaged_seconds,omitempty"`
	TotalIncidentCount             int     `json:"total_incident_count,omitempty"`
	UpTimePct                      float32 `json:"up_time_pct,omitempty"`
	UserDefinedEffortSeconds       int     `json:"user_defined_effort_seconds,omitempty"`
	RangeStart                     string  `json:"range_start,omitempty"`
}

type AnalyticsFilter

type AnalyticsFilter struct {
	CreatedAtStart string   `json:"created_at_start,omitempty"`
	CreatedAtEnd   string   `json:"created_at_end,omitempty"`
	Urgency        string   `json:"urgency,omitempty"`
	Major          bool     `json:"major,omitempty"`
	ServiceIDs     []string `json:"service_ids,omitempty"`
	TeamIDs        []string `json:"team_ids,omitempty"`
	PriorityIDs    []string `json:"priority_ids,omitempty"`
	PriorityNames  []string `json:"priority_names,omitempty"`
}

type AnalyticsRequest

type AnalyticsRequest struct {
	AnalyticsFilter *AnalyticsFilter `json:"filters,omitempty"`
	AggregateUnit   string           `json:"aggregate_unit,omitempty"`
	TimeZone        string           `json:"time_zone,omitempty"`
}

type AnalyticsResponse

type AnalyticsResponse struct {
	Data            []AnalyticsData  `json:"data,omitempty"`
	AnalyticsFilter *AnalyticsFilter `json:"filters,omitempty"`
	AggregateUnit   string           `json:"aggregate_unit,omitempty"`
	TimeZone        string           `json:"time_zone,omitempty"`
}

type Assignee

type Assignee struct {
	Assignee APIObject `json:"assignee"`
}

type Assignment

type Assignment struct {
	At       string    `json:"at,omitempty"`
	Assignee APIObject `json:"assignee,omitempty"`
}

Assignment is the data structure for an assignment of an incident

type BusinessService

type BusinessService struct {
	ID             string               `json:"id,omitempty"`
	Name           string               `json:"name,omitempty"`
	Type           string               `json:"type,omitempty"`
	Summary        string               `json:"summary,omitempty"`
	Self           string               `json:"self,omitempty"`
	PointOfContact string               `json:"point_of_contact,omitempty"`
	HTMLUrl        string               `json:"html_url,omitempty"`
	Description    string               `json:"description,omitempty"`
	Team           *BusinessServiceTeam `json:"team,omitempty"`
}

BusinessService represents a business service.

type BusinessServicePayload

type BusinessServicePayload struct {
	BusinessService *BusinessService `json:"business_service,omitempty"`
}

BusinessServicePayload represents payload with a business service object

type BusinessServiceTeam

type BusinessServiceTeam struct {
	ID   string `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
	Self string `json:"self,omitempty"`
}

BusinessServiceTeam represents a team object in a business service

type ChangeEvent

type ChangeEvent struct {
	RoutingKey string             `json:"routing_key"`
	Payload    ChangeEventPayload `json:"payload"`
	Links      []ChangeEventLink  `json:"links"`
}

ChangeEvent represents a ChangeEvent's request parameters https://developer.pagerduty.com/docs/events-api-v2/send-change-events/#parameters

type ChangeEventLink struct {
	Href string `json:"href"`
	Text string `json:"text"`
}

ChangeEventLink represents a single link in a ChangeEvent https://developer.pagerduty.com/docs/events-api-v2/send-change-events/#the-links-property

type ChangeEventPayload

type ChangeEventPayload struct {
	Source        string                 `json:"source"`
	Summary       string                 `json:"summary"`
	Timestamp     string                 `json:"timestamp"`
	CustomDetails map[string]interface{} `json:"custom_details"`
}

ChangeEventPayload ChangeEvent ChangeEventPayload https://developer.pagerduty.com/docs/events-api-v2/send-change-events/#example-request-payload

type ChangeEventResponse

type ChangeEventResponse struct {
	Status  string   `json:"status,omitempty"`
	Message string   `json:"message,omitempty"`
	Errors  []string `json:"errors,omitempty"`
}

ChangeEventResponse is the json response body for an event

type Channel

type Channel struct {
	Type string
	Raw  map[string]interface{}
}

Channel is the means by which the action was carried out.

func (*Channel) MarshalJSON added in v1.3.4

func (c *Channel) MarshalJSON() ([]byte, error)

MarshalJSON Expands the LogEntry.Channel object to correctly marshal it back

func (*Channel) UnmarshalJSON

func (c *Channel) UnmarshalJSON(b []byte) error

UnmarshalJSON Expands the LogEntry.Channel object to parse out a raw value

type Client

type Client struct {

	// HTTPClient is the HTTP client used for making requests against the
	// PagerDuty API. You can use either *http.Client here, or your own
	// implementation.
	HTTPClient HTTPClient
	// contains filtered or unexported fields
}

Client wraps http client

func NewClient

func NewClient(authToken string, options ...ClientOptions) *Client

NewClient creates an API client using an account/user API token

func NewOAuthClient

func NewOAuthClient(authToken string, options ...ClientOptions) *Client

NewOAuthClient creates an API client using an OAuth token

func (*Client) AddEscalationPolicyToTeam

func (c *Client) AddEscalationPolicyToTeam(teamID, epID string) error

AddEscalationPolicyToTeam adds an escalation policy to a team.

func (*Client) AddUserToTeam

func (c *Client) AddUserToTeam(teamID, userID string) error

AddUserToTeam adds a user to a team.

func (*Client) AssignTags

func (c *Client) AssignTags(e, eid string, a *TagAssignments) (*http.Response, error)

AssignTags adds and removes tag assignments with entities

func (*Client) AssociateServiceDependencies

func (c *Client) AssociateServiceDependencies(dependencies *ListServiceDependencies) (*ListServiceDependencies, *http.Response, error)

AssociateServiceDependencies Create new dependencies between two services.

func (*Client) CreateBusinessService

func (c *Client) CreateBusinessService(b *BusinessService) (*BusinessService, *http.Response, error)

CreateBusinessService creates a new business service.

func (*Client) CreateChangeEvent

func (c *Client) CreateChangeEvent(e ChangeEvent) (*ChangeEventResponse, error)

CreateChangeEvent Sends PagerDuty a single ChangeEvent to record The v2EventsAPIEndpoint parameter must be set on the client Documentation can be found at https://developer.pagerduty.com/docs/events-api-v2/send-change-events

func (*Client) CreateEscalationPolicy

func (c *Client) CreateEscalationPolicy(e EscalationPolicy) (*EscalationPolicy, error)

CreateEscalationPolicy creates a new escalation policy.

func (*Client) CreateEscalationRule

func (c *Client) CreateEscalationRule(escID string, e EscalationRule) (*EscalationRule, error)

CreateEscalationRule creates a new escalation rule for an escalation policy and appends it to the end of the existing escalation rules.

func (*Client) CreateExtension

func (c *Client) CreateExtension(e *Extension) (*Extension, error)

func (*Client) CreateIncident

func (c *Client) CreateIncident(from string, o *CreateIncidentOptions) (*Incident, error)

CreateIncident creates an incident synchronously without a corresponding event from a monitoring service.

func (*Client) CreateIncidentNote

func (c *Client) CreateIncidentNote(id string, note IncidentNote) error

CreateIncidentNote creates a new note for the specified incident. DEPRECATED: please use CreateIncidentNoteWithResponse going forward

func (*Client) CreateIncidentNoteWithResponse

func (c *Client) CreateIncidentNoteWithResponse(id string, note IncidentNote) (*IncidentNote, error)

CreateIncidentNoteWithResponse creates a new note for the specified incident.

func (*Client) CreateIntegration

func (c *Client) CreateIntegration(id string, i Integration) (*Integration, error)

CreateIntegration creates a new integration belonging to a service.

func (*Client) CreateMaintenanceWindow

func (c *Client) CreateMaintenanceWindow(from string, o MaintenanceWindow) (*MaintenanceWindow, error)

CreateMaintenanceWindow creates a new maintenance window for the specified services.

func (*Client) CreateMaintenanceWindows

func (c *Client) CreateMaintenanceWindows(o MaintenanceWindow) (*MaintenanceWindow, error)

CreateMaintenanceWindows creates a new maintenance window for the specified services. Deprecated: Use `CreateMaintenanceWindow` instead.

func (*Client) CreateOverride

func (c *Client) CreateOverride(id string, o Override) (*Override, error)

CreateOverride creates an override for a specific user covering the specified time range.

func (*Client) CreateRuleset

func (c *Client) CreateRuleset(r *Ruleset) (*Ruleset, *http.Response, error)

CreateRuleset creates a new ruleset.

func (*Client) CreateRulesetRule

func (c *Client) CreateRulesetRule(rulesetID string, rule *RulesetRule) (*RulesetRule, *http.Response, error)

CreateRulesetRule creates a new rule for a ruleset.

func (*Client) CreateSchedule

func (c *Client) CreateSchedule(s Schedule) (*Schedule, error)

CreateSchedule creates a new on-call schedule.

func (*Client) CreateService

func (c *Client) CreateService(s Service) (*Service, error)

CreateService creates a new service.

func (*Client) CreateTag

func (c *Client) CreateTag(t *Tag) (*Tag, *http.Response, error)

CreateTag creates a new tag.

func (*Client) CreateTeam

func (c *Client) CreateTeam(t *Team) (*Team, error)

CreateTeam creates a new team.

func (*Client) CreateUser

func (c *Client) CreateUser(u User) (*User, error)

CreateUser creates a new user.

func (*Client) CreateUserContactMethod

func (c *Client) CreateUserContactMethod(userID string, cm ContactMethod) (*ContactMethod, error)

CreateUserContactMethod creates a new contact method for user.

func (*Client) CreateUserNotificationRule

func (c *Client) CreateUserNotificationRule(userID string, rule NotificationRule) (*NotificationRule, error)

CreateUserNotificationRule creates a new notification rule for a user.

func (*Client) DeleteAddon

func (c *Client) DeleteAddon(id string) error

DeleteAddon deletes an add-on from your account.

func (*Client) DeleteBusinessService

func (c *Client) DeleteBusinessService(ID string) error

DeleteBusinessService deletes a business_service.

func (*Client) DeleteEscalationPolicy

func (c *Client) DeleteEscalationPolicy(id string) error

DeleteEscalationPolicy deletes an existing escalation policy and rules.

func (*Client) DeleteEscalationRule

func (c *Client) DeleteEscalationRule(escID string, id string) error

DeleteEscalationRule deletes an existing escalation rule.

func (*Client) DeleteExtension

func (c *Client) DeleteExtension(id string) error

func (*Client) DeleteIntegration

func (c *Client) DeleteIntegration(serviceID string, integrationID string) error

DeleteIntegration deletes an existing integration.

func (*Client) DeleteMaintenanceWindow

func (c *Client) DeleteMaintenanceWindow(id string) error

DeleteMaintenanceWindow deletes an existing maintenance window if it's in the future, or ends it if it's currently on-going.

func (*Client) DeleteOverride

func (c *Client) DeleteOverride(scheduleID, overrideID string) error

DeleteOverride removes an override.

func (*Client) DeleteRuleset

func (c *Client) DeleteRuleset(id string) error

DeleteRuleset deletes a ruleset.

func (*Client) DeleteRulesetRule

func (c *Client) DeleteRulesetRule(rulesetID, ruleID string) error

DeleteRulesetRule deletes a rule.

func (*Client) DeleteSchedule

func (c *Client) DeleteSchedule(id string) error

DeleteSchedule deletes an on-call schedule.

func (*Client) DeleteService

func (c *Client) DeleteService(id string) error

DeleteService deletes an existing service.

func (*Client) DeleteTag

func (c *Client) DeleteTag(id string) error

DeleteTag removes an existing tag.

func (*Client) DeleteTeam

func (c *Client) DeleteTeam(id string) error

DeleteTeam removes an existing team.

func (*Client) DeleteUser

func (c *Client) DeleteUser(id string) error

DeleteUser deletes a user.

func (*Client) DeleteUserContactMethod

func (c *Client) DeleteUserContactMethod(userID, contactMethodID string) error

DeleteUserContactMethod deletes a user.

func (*Client) DeleteUserNotificationRule

func (c *Client) DeleteUserNotificationRule(userID, ruleID string) error

DeleteUserNotificationRule deletes a notification rule for a user.

func (*Client) DisassociateServiceDependencies

func (c *Client) DisassociateServiceDependencies(dependencies *ListServiceDependencies) (*ListServiceDependencies, *http.Response, error)

DisassociateServiceDependencies Disassociate dependencies between two services.

func (*Client) GetAddon

func (c *Client) GetAddon(id string) (*Addon, error)

GetAddon gets details about an existing add-on.

func (*Client) GetAggregatedIncidentData

func (c *Client) GetAggregatedIncidentData(ctx context.Context, analytics AnalyticsRequest) (AnalyticsResponse, error)

func (*Client) GetAggregatedServiceIncidentData added in v1.3.4

func (c *Client) GetAggregatedServiceIncidentData(ctx context.Context, analytics AnalyticsRequest) (AnalyticsResponse, error)

func (*Client) GetAggregatedTeamIncidentData added in v1.3.4

func (c *Client) GetAggregatedTeamIncidentData(ctx context.Context, analytics AnalyticsRequest) (AnalyticsResponse, error)

func (*Client) GetBusinessService

func (c *Client) GetBusinessService(ID string) (*BusinessService, *http.Response, error)

GetBusinessService gets details about a business service.

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser(o GetCurrentUserOptions) (*User, error)

GetCurrentUser gets details about the authenticated user when using a user-level API key or OAuth token

func (*Client) GetEscalationPoliciesByTag

func (c *Client) GetEscalationPoliciesByTag(tid string) (*ListEPResponse, error)

GetEscalationPoliciesByTag get related Users for the Tag.

func (*Client) GetEscalationPolicy

func (c *Client) GetEscalationPolicy(id string, o *GetEscalationPolicyOptions) (*EscalationPolicy, error)

GetEscalationPolicy gets information about an existing escalation policy and its rules.

func (*Client) GetEscalationRule

func (c *Client) GetEscalationRule(escID string, id string, o *GetEscalationRuleOptions) (*EscalationRule, error)

GetEscalationRule gets information about an existing escalation rule.

func (*Client) GetExtension

func (c *Client) GetExtension(id string) (*Extension, error)

func (*Client) GetExtensionSchema

func (c *Client) GetExtensionSchema(id string) (*ExtensionSchema, error)

func (*Client) GetIncident

func (c *Client) GetIncident(id string) (*Incident, error)

GetIncident shows detailed information about an incident.

func (*Client) GetIncidentAlert

func (c *Client) GetIncidentAlert(incidentID, alertID string) (*IncidentAlertResponse, *http.Response, error)

GetIncidentAlert

func (*Client) GetIntegration

func (c *Client) GetIntegration(serviceID, integrationID string, o GetIntegrationOptions) (*Integration, error)

GetIntegration gets details about an integration belonging to a service.

func (*Client) GetLogEntry

func (c *Client) GetLogEntry(id string, o GetLogEntryOptions) (*LogEntry, error)

GetLogEntry list log entries for the specified incident.

func (*Client) GetMaintenanceWindow

func (c *Client) GetMaintenanceWindow(id string, o GetMaintenanceWindowOptions) (*MaintenanceWindow, error)

GetMaintenanceWindow gets an existing maintenance window.

func (*Client) GetRawMultipleIncidentData added in v1.3.4

func (c *Client) GetRawMultipleIncidentData(ctx context.Context, analytics RawAnalyticsRequest) (RawAnalyticsResponse, error)

func (*Client) GetRuleset

func (c *Client) GetRuleset(id string) (*Ruleset, *http.Response, error)

GetRuleset gets details about a ruleset.

func (*Client) GetRulesetRule

func (c *Client) GetRulesetRule(rulesetID, ruleID string) (*RulesetRule, *http.Response, error)

GetRulesetRule gets an event rule

func (*Client) GetSchedule

func (c *Client) GetSchedule(id string, o GetScheduleOptions) (*Schedule, error)

GetSchedule shows detailed information about a schedule, including entries for each layer and sub-schedule.

func (*Client) GetService

func (c *Client) GetService(id string, o *GetServiceOptions) (*Service, error)

GetService gets details about an existing service.

func (*Client) GetTag

func (c *Client) GetTag(id string) (*Tag, *http.Response, error)

GetTag gets details about an existing tag.

func (*Client) GetTagsForEntity

func (c *Client) GetTagsForEntity(e, eid string, o ListTagOptions) (*ListTagResponse, error)

GetTagsForEntity Get related tags for Users, Teams or Escalation Policies.

func (*Client) GetTeam

func (c *Client) GetTeam(id string) (*Team, error)

GetTeam gets details about an existing team.

func (*Client) GetTeamsByTag

func (c *Client) GetTeamsByTag(tid string) (*ListTeamsForTagResponse, error)

GetTeamsByTag get related Users for the Tag.

func (*Client) GetUser

func (c *Client) GetUser(id string, o GetUserOptions) (*User, error)

GetUser gets details about an existing user.

func (*Client) GetUserContactMethod

func (c *Client) GetUserContactMethod(userID, contactMethodID string) (*ContactMethod, error)

GetUserContactMethod gets details about a contact method.

func (*Client) GetUserNotificationRule

func (c *Client) GetUserNotificationRule(userID, ruleID string) (*NotificationRule, error)

GetUserNotificationRule gets details about a notification rule.

func (*Client) GetUsersByTag

func (c *Client) GetUsersByTag(tid string) (*ListUserResponse, error)

GetUsersByTag get related Users for the Tag.

func (*Client) GetVendor

func (c *Client) GetVendor(id string) (*Vendor, error)

GetVendor gets details about an existing vendor.

func (*Client) InstallAddon

func (c *Client) InstallAddon(a Addon) (*Addon, error)

InstallAddon installs an add-on for your account.

func (*Client) ListAbilities

func (c *Client) ListAbilities() (*ListAbilityResponse, error)

ListAbilities lists all abilities on your account.

func (*Client) ListAddons

func (c *Client) ListAddons(o ListAddonOptions) (*ListAddonResponse, error)

ListAddons lists all of the add-ons installed on your account.

func (*Client) ListAllMembers

func (c *Client) ListAllMembers(teamID string) ([]Member, error)

ListAllMembers gets all members associated with the specified team.

func (*Client) ListBusinessServiceDependencies

func (c *Client) ListBusinessServiceDependencies(businessServiceID string) (*ListServiceDependencies, *http.Response, error)

ListBusinessServiceDependencies lists dependencies of a business service.

func (*Client) ListBusinessServices

ListBusinessServices lists existing business services.

func (*Client) ListEscalationPolicies

ListEscalationPolicies lists all of the existing escalation policies.

func (*Client) ListEscalationRules

func (c *Client) ListEscalationRules(escID string) (*ListEscalationRulesResponse, error)

ListEscalationRules lists all of the escalation rules for an existing escalation policy.

func (*Client) ListExtensionSchemas

func (c *Client) ListExtensionSchemas(o ListExtensionSchemaOptions) (*ListExtensionSchemaResponse, error)

func (*Client) ListExtensions

func (c *Client) ListExtensions(o ListExtensionOptions) (*ListExtensionResponse, error)

func (*Client) ListIncidentAlerts

func (c *Client) ListIncidentAlerts(id string) (*ListAlertsResponse, error)

ListIncidentAlerts lists existing alerts for the specified incident.

func (*Client) ListIncidentAlertsWithOpts

func (c *Client) ListIncidentAlertsWithOpts(id string, o ListIncidentAlertsOptions) (*ListAlertsResponse, error)

ListIncidentAlertsWithOpts lists existing alerts for the specified incident.

func (*Client) ListIncidentLogEntries

ListIncidentLogEntries lists existing log entries for the specified incident.

func (*Client) ListIncidentNotes

func (c *Client) ListIncidentNotes(id string) ([]IncidentNote, error)

ListIncidentNotes lists existing notes for the specified incident.

func (*Client) ListIncidents

func (c *Client) ListIncidents(o ListIncidentsOptions) (*ListIncidentsResponse, error)

ListIncidents lists existing incidents.

func (*Client) ListLogEntries

func (c *Client) ListLogEntries(o ListLogEntriesOptions) (*ListLogEntryResponse, error)

ListLogEntries lists all of the incident log entries across the entire account.

func (*Client) ListMaintenanceWindows

ListMaintenanceWindows lists existing maintenance windows, optionally filtered by service and/or team, or whether they are from the past, present or future.

func (*Client) ListMembers

func (c *Client) ListMembers(teamID string, o ListMembersOptions) (*ListMembersResponse, error)

ListMembers gets the first page of users associated with the specified team.

func (*Client) ListNotifications

func (c *Client) ListNotifications(o ListNotificationOptions) (*ListNotificationsResponse, error)

ListNotifications lists notifications for a given time range, optionally filtered by type (sms_notification, email_notification, phone_notification, or push_notification).

func (*Client) ListOnCallUsers

func (c *Client) ListOnCallUsers(id string, o ListOnCallUsersOptions) ([]User, error)

ListOnCallUsers lists all of the users on call in a given schedule for a given time range.

func (*Client) ListOnCalls

func (c *Client) ListOnCalls(o ListOnCallOptions) (*ListOnCallsResponse, error)

ListOnCalls list the on-call entries during a given time range.

func (*Client) ListOverrides

func (c *Client) ListOverrides(id string, o ListOverridesOptions) (*ListOverridesResponse, error)

ListOverrides lists overrides for a given time range.

func (*Client) ListPriorities

func (c *Client) ListPriorities() (*Priorities, error)

ListPriorities lists existing priorities

func (*Client) ListRulesetRules

func (c *Client) ListRulesetRules(rulesetID string) (*ListRulesetRulesResponse, error)

ListRulesetRules gets all rules for a ruleset.

func (*Client) ListRulesets

func (c *Client) ListRulesets() (*ListRulesetsResponse, error)

ListRulesets gets all rulesets.

func (*Client) ListSchedules

func (c *Client) ListSchedules(o ListSchedulesOptions) (*ListSchedulesResponse, error)

ListSchedules lists the on-call schedules.

func (*Client) ListServices

func (c *Client) ListServices(o ListServiceOptions) (*ListServiceResponse, error)

ListServices lists existing services.

func (*Client) ListServicesPaginated added in v1.3.4

func (c *Client) ListServicesPaginated(ctx context.Context, o ListServiceOptions) ([]Service, error)

ListServices lists existing services processing paginated responses

func (*Client) ListTags

func (c *Client) ListTags(o ListTagOptions) (*ListTagResponse, error)

ListTags lists tags of your PagerDuty account, optionally filtered by a search query.

func (*Client) ListTeams

func (c *Client) ListTeams(o ListTeamOptions) (*ListTeamResponse, error)

ListTeams lists teams of your PagerDuty account, optionally filtered by a search query.

func (*Client) ListTechnicalServiceDependencies

func (c *Client) ListTechnicalServiceDependencies(serviceID string) (*ListServiceDependencies, *http.Response, error)

ListTechnicalServiceDependencies lists dependencies of a technical service.

func (*Client) ListUserContactMethods

func (c *Client) ListUserContactMethods(userID string) (*ListContactMethodsResponse, error)

ListUserContactMethods fetches contact methods of the existing user.

func (*Client) ListUserNotificationRules

func (c *Client) ListUserNotificationRules(userID string) (*ListUserNotificationRulesResponse, error)

ListUserNotificationRules fetches notification rules of the existing user.

func (*Client) ListUsers

func (c *Client) ListUsers(o ListUsersOptions) (*ListUsersResponse, error)

ListUsers lists users of your PagerDuty account, optionally filtered by a search query.

func (*Client) ListVendors

func (c *Client) ListVendors(o ListVendorOptions) (*ListVendorResponse, error)

ListVendors lists existing vendors.

func (*Client) ManageEvent

func (c *Client) ManageEvent(e *V2Event) (*V2EventResponse, error)

ManageEvent handles the trigger, acknowledge, and resolve methods for an event

func (*Client) ManageIncidentAlerts

func (c *Client) ManageIncidentAlerts(incidentID string, alerts *IncidentAlertList) (*ListAlertsResponse, *http.Response, error)

ManageIncidentAlerts

func (*Client) ManageIncidents

func (c *Client) ManageIncidents(from string, incidents []ManageIncidentsOptions) (*ListIncidentsResponse, error)

ManageIncidents acknowledges, resolves, escalates, or reassigns one or more incidents.

func (*Client) MergeIncidents

func (c *Client) MergeIncidents(from string, id string, sourceIncidents []MergeIncidentsOptions) (*Incident, error)

MergeIncidents a list of source incidents into a specified incident.

func (*Client) PreviewSchedule

func (c *Client) PreviewSchedule(s Schedule, o PreviewScheduleOptions) error

PreviewSchedule previews what an on-call schedule would look like without saving it.

func (*Client) RemoveEscalationPolicyFromTeam

func (c *Client) RemoveEscalationPolicyFromTeam(teamID, epID string) error

RemoveEscalationPolicyFromTeam removes an escalation policy from a team.

func (*Client) RemoveUserFromTeam

func (c *Client) RemoveUserFromTeam(teamID, userID string) error

RemoveUserFromTeam removes a user from a team.

func (*Client) ResponderRequest

func (c *Client) ResponderRequest(id string, o ResponderRequestOptions) (*ResponderRequestResponse, error)

ResponderRequest will submit a request to have a responder join an incident.

func (*Client) SnoozeIncident

func (c *Client) SnoozeIncident(id string, duration uint) error

SnoozeIncident sets an incident to not alert for a specified period of time. DEPRECATED: please use SnoozeIncidentWithResponse going forward

func (*Client) SnoozeIncidentWithResponse

func (c *Client) SnoozeIncidentWithResponse(id string, duration uint) (*Incident, error)

SnoozeIncidentSnoozeIncidentWithResponse sets an incident to not alert for a specified period of time.

func (*Client) TestAbility

func (c *Client) TestAbility(ability string) error

TestAbility Check if your account has the given ability.

func (*Client) UpdateAddon

func (c *Client) UpdateAddon(id string, a Addon) (*Addon, error)

UpdateAddon updates an existing add-on.

func (*Client) UpdateBusinessService

func (c *Client) UpdateBusinessService(b *BusinessService) (*BusinessService, *http.Response, error)

UpdateBusinessService updates a business_service.

func (*Client) UpdateEscalationPolicy

func (c *Client) UpdateEscalationPolicy(id string, e *EscalationPolicy) (*EscalationPolicy, error)

UpdateEscalationPolicy updates an existing escalation policy and its rules.

func (*Client) UpdateEscalationRule

func (c *Client) UpdateEscalationRule(escID string, id string, e *EscalationRule) (*EscalationRule, error)

UpdateEscalationRule updates an existing escalation rule.

func (*Client) UpdateExtension

func (c *Client) UpdateExtension(id string, e *Extension) (*Extension, error)

func (*Client) UpdateIntegration

func (c *Client) UpdateIntegration(serviceID string, i Integration) (*Integration, error)

UpdateIntegration updates an integration belonging to a service.

func (*Client) UpdateMaintenanceWindow

func (c *Client) UpdateMaintenanceWindow(m MaintenanceWindow) (*MaintenanceWindow, error)

UpdateMaintenanceWindow updates an existing maintenance window.

func (*Client) UpdateRuleset

func (c *Client) UpdateRuleset(r *Ruleset) (*Ruleset, *http.Response, error)

UpdateRuleset updates a ruleset.

func (*Client) UpdateRulesetRule

func (c *Client) UpdateRulesetRule(rulesetID, ruleID string, r *RulesetRule) (*RulesetRule, *http.Response, error)

UpdateRulesetRule updates a rule.

func (*Client) UpdateSchedule

func (c *Client) UpdateSchedule(id string, s Schedule) (*Schedule, error)

UpdateSchedule updates an existing on-call schedule.

func (*Client) UpdateService

func (c *Client) UpdateService(s Service) (*Service, error)

UpdateService updates an existing service.

func (*Client) UpdateTeam

func (c *Client) UpdateTeam(id string, t *Team) (*Team, error)

UpdateTeam updates an existing team.

func (*Client) UpdateUser

func (c *Client) UpdateUser(u User) (*User, error)

UpdateUser updates an existing user.

func (*Client) UpdateUserContactMethod

func (c *Client) UpdateUserContactMethod(userID string, cm ContactMethod) (*ContactMethod, error)

UpdateUserContactMethod updates an existing user.

func (*Client) UpdateUserNotificationRule

func (c *Client) UpdateUserNotificationRule(userID string, rule NotificationRule) (*NotificationRule, error)

UpdateUserNotificationRule updates a notification rule for a user.

type ClientOptions

type ClientOptions func(*Client)

ClientOptions allows for options to be passed into the Client for customization

func WithAPIEndpoint

func WithAPIEndpoint(endpoint string) ClientOptions

WithAPIEndpoint allows for a custom API endpoint to be passed into the the client

func WithOAuth

func WithOAuth() ClientOptions

WithOAuth allows for an OAuth token to be passed into the the client

func WithV2EventsAPIEndpoint

func WithV2EventsAPIEndpoint(endpoint string) ClientOptions

WithV2EventsAPIEndpoint allows for a custom V2 Events API endpoint to be passed into the client

type CommonLogEntryField

type CommonLogEntryField struct {
	APIObject
	CreatedAt              string            `json:"created_at,omitempty"`
	Agent                  Agent             `json:"agent,omitempty"`
	Channel                Channel           `json:"channel,omitempty"`
	Teams                  []Team            `json:"teams,omitempty"`
	Contexts               []Context         `json:"contexts,omitempty"`
	AcknowledgementTimeout int               `json:"acknowledgement_timeout"`
	EventDetails           map[string]string `json:"event_details,omitempty"`
}

CommonLogEntryField is the list of shared log entry between Incident and LogEntry

type ConditionParameter

type ConditionParameter struct {
	Path  string `json:"path,omitempty"`
	Value string `json:"value,omitempty"`
}

ConditionParameter represents parameters in a rule condition

type ConferenceBridge

type ConferenceBridge struct {
	ConferenceNumber string `json:"conference_number,omitempty"`
	ConferenceURL    string `json:"conference_url,omitempty"`
}

ConferenceBridge is a struct for the conference_bridge object on an incident

type ContactMethod

type ContactMethod struct {
	ID             string `json:"id"`
	Type           string `json:"type"`
	Summary        string `json:"summary"`
	Self           string `json:"self"`
	Label          string `json:"label"`
	Address        string `json:"address"`
	SendShortEmail bool   `json:"send_short_email,omitempty"`
	SendHTMLEmail  bool   `json:"send_html_email,omitempty"`
	Blacklisted    bool   `json:"blacklisted,omitempty"`
	CountryCode    int    `json:"country_code,omitempty"`
	Enabled        bool   `json:"enabled,omitempty"`
	HTMLUrl        string `json:"html_url"`
}

ContactMethod is a way of contacting the user.

type Context

type Context struct {
	Alt  string
	Href string
	Src  string
	Text string
	Type string
}

Context are to be included with the trigger such as links to graphs or images.

type CreateIncidentNoteResponse

type CreateIncidentNoteResponse struct {
	IncidentNote IncidentNote `json:"note"`
}

CreateIncidentNoteResponse is returned from the API as a response to creating an incident note.

type CreateIncidentOptions

type CreateIncidentOptions struct {
	Type             string        `json:"type"`
	Title            string        `json:"title"`
	Service          *APIReference `json:"service"`
	Priority         *APIReference `json:"priority"`
	Urgency          string        `json:"urgency,omitempty"`
	IncidentKey      string        `json:"incident_key,omitempty"`
	Body             *APIDetails   `json:"body,omitempty"`
	EscalationPolicy *APIReference `json:"escalation_policy,omitempty"`
	Assignments      []Assignee    `json:"assignments,omitempty"`
}

CreateIncidentOptions is the structure used when POSTing to the CreateIncident API endpoint.

type EscalationPolicy

type EscalationPolicy struct {
	APIObject
	Name            string           `json:"name,omitempty"`
	EscalationRules []EscalationRule `json:"escalation_rules,omitempty"`
	Services        []APIObject      `json:"services,omitempty"`
	NumLoops        uint             `json:"num_loops,omitempty"`
	Teams           []APIReference   `json:"teams"`
	Description     string           `json:"description,omitempty"`
	RepeatEnabled   bool             `json:"repeat_enabled,omitempty"`
}

EscalationPolicy is a collection of escalation rules.

type EscalationRule

type EscalationRule struct {
	ID      string      `json:"id,omitempty"`
	Delay   uint        `json:"escalation_delay_in_minutes,omitempty"`
	Targets []APIObject `json:"targets"`
}

EscalationRule is a rule for an escalation policy to trigger.

type Event

type Event struct {
	ServiceKey  string        `json:"service_key"`
	Type        string        `json:"event_type"`
	IncidentKey string        `json:"incident_key,omitempty"`
	Description string        `json:"description"`
	Client      string        `json:"client,omitempty"`
	ClientURL   string        `json:"client_url,omitempty"`
	Details     interface{}   `json:"details,omitempty"`
	Contexts    []interface{} `json:"contexts,omitempty"`
}

Event stores data for problem reporting, acknowledgement, and resolution.

type EventResponse

type EventResponse struct {
	Status      string `json:"status"`
	Message     string `json:"message"`
	IncidentKey string `json:"incident_key"`
	HttpStatus  int
}

EventResponse is the data returned from the CreateEvent API endpoint.

func CreateEvent

func CreateEvent(e Event) (*EventResponse, error)

CreateEvent sends PagerDuty an event to trigger, acknowledge, or resolve a problem. If you need to provide a custom HTTP client, please use CreateEventWithHTTPClient.

func CreateEventWithHTTPClient

func CreateEventWithHTTPClient(e Event, client HTTPClient) (*EventResponse, error)

CreateEventWithHTTPClient sends PagerDuty an event to trigger, acknowledge, or resolve a problem. This function accepts a custom HTTP Client, if the default one used by this package doesn't fit your needs. If you don't need a custom HTTP client, please use CreateEvent instead.

type Extension

type Extension struct {
	APIObject
	Name             string      `json:"name"`
	EndpointURL      string      `json:"endpoint_url,omitempty"`
	ExtensionObjects []APIObject `json:"extension_objects"`
	ExtensionSchema  APIObject   `json:"extension_schema"`
	Config           interface{} `json:"config"`
}

type ExtensionSchema

type ExtensionSchema struct {
	APIObject
	IconURL     string   `json:"icon_url"`
	LogoURL     string   `json:"logo_url"`
	Label       string   `json:"label"`
	Key         string   `json:"key"`
	Description string   `json:"description"`
	GuideURL    string   `json:"guide_url"`
	SendTypes   []string `json:"send_types"`
	URL         string   `json:"url"`
}

type FirstTriggerLogEntry

type FirstTriggerLogEntry struct {
	CommonLogEntryField
	Incident APIObject `json:"incident,omitempty"`
}

FirstTriggerLogEntry is the first LogEntry

type GetCurrentUserOptions

type GetCurrentUserOptions struct {
	Includes []string `url:"include,omitempty,brackets"`
}

GetCurrentUserOptions is the data structure used when calling the GetCurrentUser API endpoint.

type GetEscalationPolicyOptions

type GetEscalationPolicyOptions struct {
	Includes []string `url:"include,omitempty,brackets"`
}

GetEscalationPolicyOptions is the data structure used when calling the GetEscalationPolicy API endpoint.

type GetEscalationRuleOptions

type GetEscalationRuleOptions struct {
	Includes []string `url:"include,omitempty,brackets"`
}

GetEscalationRuleOptions is the data structure used when calling the GetEscalationRule API endpoint.

type GetIntegrationOptions

type GetIntegrationOptions struct {
	Includes []string `url:"include,omitempty,brackets"`
}

GetIntegrationOptions is the data structure used when calling the GetIntegration API endpoint.

type GetLogEntryOptions

type GetLogEntryOptions struct {
	TimeZone string   `url:"time_zone,omitempty"`
	Includes []string `url:"include,omitempty,brackets"`
}

GetLogEntryOptions is the data structure used when calling the GetLogEntry API endpoint.

type GetMaintenanceWindowOptions

type GetMaintenanceWindowOptions struct {
	Includes []string `url:"include,omitempty,brackets"`
}

GetMaintenanceWindowOptions is the data structure used when calling the GetMaintenanceWindow API endpoint.

type GetScheduleOptions

type GetScheduleOptions struct {
	APIListObject
	TimeZone string `url:"time_zone,omitempty"`
	Since    string `url:"since,omitempty"`
	Until    string `url:"until,omitempty"`
}

GetScheduleOptions is the data structure used when calling the GetSchedule API endpoint.

type GetServiceOptions

type GetServiceOptions struct {
	Includes []string `url:"include,brackets,omitempty"`
}

GetServiceOptions is the data structure used when calling the GetService API endpoint.

type GetUserOptions

type GetUserOptions struct {
	Includes []string `url:"include,omitempty,brackets"`
}

GetUserOptions is the data structure used when calling the GetUser API endpoint.

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient is an interface which declares the functionality we need from an HTTP client. This is to allow consumers to provide their own HTTP client as needed, without restricting them to only using *http.Client.

type Incident

type Incident struct {
	APIObject
	IncidentNumber       uint                 `json:"incident_number,omitempty"`
	Title                string               `json:"title,omitempty"`
	Description          string               `json:"description,omitempty"`
	CreatedAt            string               `json:"created_at,omitempty"`
	PendingActions       []PendingAction      `json:"pending_actions,omitempty"`
	IncidentKey          string               `json:"incident_key,omitempty"`
	Service              APIObject            `json:"service,omitempty"`
	Assignments          []Assignment         `json:"assignments,omitempty"`
	Acknowledgements     []Acknowledgement    `json:"acknowledgements,omitempty"`
	LastStatusChangeAt   string               `json:"last_status_change_at,omitempty"`
	LastStatusChangeBy   APIObject            `json:"last_status_change_by,omitempty"`
	FirstTriggerLogEntry FirstTriggerLogEntry `json:"first_trigger_log_entry,omitempty"`
	EscalationPolicy     APIObject            `json:"escalation_policy,omitempty"`
	Teams                []APIObject          `json:"teams,omitempty"`
	Priority             *Priority            `json:"priority,omitempty"`
	Urgency              string               `json:"urgency,omitempty"`
	Status               string               `json:"status,omitempty"`
	Id                   string               `json:"id,omitempty"`
	ResolveReason        ResolveReason        `json:"resolve_reason,omitempty"`
	AlertCounts          AlertCounts          `json:"alert_counts,omitempty"`
	Body                 IncidentBody         `json:"body,omitempty"`
	IsMergeable          bool                 `json:"is_mergeable,omitempty"`
	ConferenceBridge     *ConferenceBridge    `json:"conference_bridge,omitempty"`
}

Incident is a normalized, de-duplicated event generated by a PagerDuty integration.

type IncidentAlert

type IncidentAlert struct {
	APIObject
	CreatedAt   string                 `json:"created_at,omitempty"`
	Status      string                 `json:"status,omitempty"`
	AlertKey    string                 `json:"alert_key,omitempty"`
	Service     APIObject              `json:"service,omitempty"`
	Body        map[string]interface{} `json:"body,omitempty"`
	Incident    APIReference           `json:"incident,omitempty"`
	Suppressed  bool                   `json:"suppressed,omitempty"`
	Severity    string                 `json:"severity,omitempty"`
	Integration APIObject              `json:"integration,omitempty"`
}

IncidentAlert is a alert for the specified incident.

type IncidentAlertList

type IncidentAlertList struct {
	Alerts []IncidentAlert `json:"alerts,omitempty"`
}

IncidentAlertList is the generic structure of a list of alerts

type IncidentAlertResponse

type IncidentAlertResponse struct {
	IncidentAlert *IncidentAlert `json:"alert,omitempty"`
}

IncidentAlertResponse is the response of a sincle incident alert

type IncidentBody

type IncidentBody struct {
	Type    string `json:"type,omitempty"`
	Details string `json:"details,omitempty"`
}

IncidentBody is the datastructure containing data describing the incident.

type IncidentDetails

type IncidentDetails struct {
	APIObject
	IncidentNumber       int               `json:"incident_number"`
	Title                string            `json:"title"`
	CreatedAt            time.Time         `json:"created_at"`
	Status               string            `json:"status"`
	IncidentKey          *string           `json:"incident_key"`
	PendingActions       []PendingAction   `json:"pending_actions"`
	Service              Service           `json:"service"`
	Assignments          []Assignment      `json:"assignments"`
	Acknowledgements     []Acknowledgement `json:"acknowledgements"`
	LastStatusChangeAt   time.Time         `json:"last_status_change_at"`
	LastStatusChangeBy   APIObject         `json:"last_status_change_by"`
	FirstTriggerLogEntry APIObject         `json:"first_trigger_log_entry"`
	EscalationPolicy     APIObject         `json:"escalation_policy"`
	Teams                []APIObject       `json:"teams"`
	Priority             Priority          `json:"priority"`
	Urgency              string            `json:"urgency"`
	ResolveReason        *string           `json:"resolve_reason"`
	AlertCounts          AlertCounts       `json:"alert_counts"`
	Metadata             interface{}       `json:"metadata"`
	Description          string            `json:"description"`
	Alerts               []IncidentAlert   `json:"alerts,omitempty"`
}

IncidentDetails contains a representation of the incident associated with the action that caused this webhook message

type IncidentNote

type IncidentNote struct {
	ID        string    `json:"id,omitempty"`
	User      APIObject `json:"user,omitempty"`
	Content   string    `json:"content,omitempty"`
	CreatedAt string    `json:"created_at,omitempty"`
}

IncidentNote is a note for the specified incident.

type IncidentResponders

type IncidentResponders struct {
	State       string    `json:"state"`
	User        APIObject `json:"user"`
	Incident    APIObject `json:"incident"`
	UpdatedAt   string    `json:"updated_at"`
	Message     string    `json:"message"`
	Requester   APIObject `json:"requester"`
	RequestedAt string    `json:"requested_at"`
}

IncidentResponders contains details about responders to an incident.

type IncidentUrgencyRule

type IncidentUrgencyRule struct {
	Type                string               `json:"type,omitempty"`
	Urgency             string               `json:"urgency,omitempty"`
	DuringSupportHours  *IncidentUrgencyType `json:"during_support_hours,omitempty"`
	OutsideSupportHours *IncidentUrgencyType `json:"outside_support_hours,omitempty"`
}

IncidentUrgencyRule is the default urgency for new incidents.

type IncidentUrgencyType

type IncidentUrgencyType struct {
	Type    string `json:"type,omitempty"`
	Urgency string `json:"urgency,omitempty"`
}

IncidentUrgencyType are the incidents urgency during or outside support hours.

type InlineModel

type InlineModel struct {
	Type string `json:"type,omitempty"`
	Name string `json:"name,omitempty"`
}

InlineModel represents when a scheduled action will occur.

type Integration

type Integration struct {
	APIObject
	Name             string     `json:"name,omitempty"`
	Service          *APIObject `json:"service,omitempty"`
	CreatedAt        string     `json:"created_at,omitempty"`
	Vendor           *APIObject `json:"vendor,omitempty"`
	Type             string     `json:"type,omitempty"`
	IntegrationKey   string     `json:"integration_key,omitempty"`
	IntegrationEmail string     `json:"integration_email,omitempty"`
}

Integration is an endpoint (like Nagios, email, or an API call) that generates events, which are normalized and de-duplicated by PagerDuty to create incidents.

type ListAbilityResponse

type ListAbilityResponse struct {
	Abilities []string `json:"abilities"`
}

ListAbilityResponse is the response when calling the ListAbility API endpoint.

type ListAddonOptions

type ListAddonOptions struct {
	APIListObject
	Includes   []string `url:"include,omitempty,brackets"`
	ServiceIDs []string `url:"service_ids,omitempty,brackets"`
	Filter     string   `url:"filter,omitempty"`
}

ListAddonOptions are the options available when calling the ListAddons API endpoint.

type ListAddonResponse

type ListAddonResponse struct {
	APIListObject
	Addons []Addon `json:"addons"`
}

ListAddonResponse is the response when calling the ListAddons API endpoint.

type ListAlertsResponse

type ListAlertsResponse struct {
	APIListObject
	Alerts []IncidentAlert `json:"alerts,omitempty"`
}

ListAlertsResponse is the response structure when calling the ListAlert API endpoint.

type ListBusinessServiceOptions

type ListBusinessServiceOptions struct {
	APIListObject
}

ListBusinessServiceOptions is the data structure used when calling the ListBusinessServices API endpoint.

type ListBusinessServicesResponse

type ListBusinessServicesResponse struct {
	Total            uint               `json:"total,omitempty"`
	BusinessServices []*BusinessService `json:"business_services,omitempty"`
	Offset           uint               `json:"offset,omitempty"`
	More             bool               `json:"more,omitempty"`
	Limit            uint               `json:"limit,omitempty"`
}

ListBusinessServicesResponse represents a list response of business services.

type ListContactMethodsResponse

type ListContactMethodsResponse struct {
	APIListObject
	ContactMethods []ContactMethod `json:"contact_methods"`
}

ListContactMethodsResponse is the data structure returned from calling the GetUserContactMethod API endpoint.

type ListEPResponse

type ListEPResponse struct {
	APIListObject
	EscalationPolicies []*APIObject `json:"escalation_policies,omitempty"`
}

ListEPResponse is the structure used to list escalation policies assigned a given tag

type ListEscalationPoliciesOptions

type ListEscalationPoliciesOptions struct {
	APIListObject
	Query    string   `url:"query,omitempty"`
	UserIDs  []string `url:"user_ids,omitempty,brackets"`
	TeamIDs  []string `url:"team_ids,omitempty,brackets"`
	Includes []string `url:"include,omitempty,brackets"`
	SortBy   string   `url:"sort_by,omitempty"`
}

ListEscalationPoliciesOptions is the data structure used when calling the ListEscalationPolicies API endpoint.

type ListEscalationPoliciesResponse

type ListEscalationPoliciesResponse struct {
	APIListObject
	EscalationPolicies []EscalationPolicy `json:"escalation_policies"`
}

ListEscalationPoliciesResponse is the data structure returned from calling the ListEscalationPolicies API endpoint.

type ListEscalationRulesResponse

type ListEscalationRulesResponse struct {
	APIListObject
	EscalationRules []EscalationRule `json:"escalation_rules"`
}

type ListExtensionOptions

type ListExtensionOptions struct {
	APIListObject
	ExtensionObjectID string `url:"extension_object_id,omitempty"`
	ExtensionSchemaID string `url:"extension_schema_id,omitempty"`
	Query             string `url:"query,omitempty"`
}

type ListExtensionResponse

type ListExtensionResponse struct {
	APIListObject
	Extensions []Extension `json:"extensions"`
}

type ListExtensionSchemaOptions

type ListExtensionSchemaOptions struct {
	APIListObject
	Query string `url:"query,omitempty"`
}

type ListExtensionSchemaResponse

type ListExtensionSchemaResponse struct {
	APIListObject
	ExtensionSchemas []ExtensionSchema `json:"extension_schemas"`
}

type ListIncidentAlertsOptions

type ListIncidentAlertsOptions struct {
	APIListObject
	Statuses []string `url:"statuses,omitempty,brackets"`
	SortBy   string   `url:"sort_by,omitempty"`
	Includes []string `url:"include,omitempty,brackets"`
}

ListIncidentAlertsOptions is the structure used when passing parameters to the ListIncidentAlerts API endpoint.

type ListIncidentLogEntriesOptions

type ListIncidentLogEntriesOptions struct {
	APIListObject
	Includes   []string `url:"include,omitempty,brackets"`
	IsOverview bool     `url:"is_overview,omitempty"`
	TimeZone   string   `url:"time_zone,omitempty"`
	Since      string   `url:"since,omitempty"`
	Until      string   `url:"until,omitempty"`
}

ListIncidentLogEntriesOptions is the structure used when passing parameters to the ListIncidentLogEntries API endpoint.

type ListIncidentLogEntriesResponse

type ListIncidentLogEntriesResponse struct {
	APIListObject
	LogEntries []LogEntry `json:"log_entries,omitempty"`
}

ListIncidentLogEntriesResponse is the response structure when calling the ListIncidentLogEntries API endpoint.

type ListIncidentsOptions

type ListIncidentsOptions struct {
	APIListObject
	Since       string   `url:"since,omitempty"`
	Until       string   `url:"until,omitempty"`
	DateRange   string   `url:"date_range,omitempty"`
	Statuses    []string `url:"statuses,omitempty,brackets"`
	IncidentKey string   `url:"incident_key,omitempty"`
	ServiceIDs  []string `url:"service_ids,omitempty,brackets"`
	TeamIDs     []string `url:"team_ids,omitempty,brackets"`
	UserIDs     []string `url:"user_ids,omitempty,brackets"`
	Urgencies   []string `url:"urgencies,omitempty,brackets"`
	TimeZone    string   `url:"time_zone,omitempty"`
	SortBy      string   `url:"sort_by,omitempty"`
	Includes    []string `url:"include,omitempty,brackets"`
}

ListIncidentsOptions is the structure used when passing parameters to the ListIncident API endpoint.

type ListIncidentsResponse

type ListIncidentsResponse struct {
	APIListObject
	Incidents []Incident `json:"incidents,omitempty"`
}

ListIncidentsResponse is the response structure when calling the ListIncident API endpoint.

type ListLogEntriesOptions

type ListLogEntriesOptions struct {
	APIListObject
	TimeZone   string   `url:"time_zone,omitempty"`
	Since      string   `url:"since,omitempty"`
	Until      string   `url:"until,omitempty"`
	IsOverview bool     `url:"is_overview,omitempty"`
	Includes   []string `url:"include,omitempty,brackets"`
}

ListLogEntriesOptions is the data structure used when calling the ListLogEntry API endpoint.

type ListLogEntryResponse

type ListLogEntryResponse struct {
	APIListObject
	LogEntries []LogEntry `json:"log_entries"`
}

ListLogEntryResponse is the response data when calling the ListLogEntry API endpoint.

type ListMaintenanceWindowsOptions

type ListMaintenanceWindowsOptions struct {
	APIListObject
	Query      string   `url:"query,omitempty"`
	Includes   []string `url:"include,omitempty,brackets"`
	TeamIDs    []string `url:"team_ids,omitempty,brackets"`
	ServiceIDs []string `url:"service_ids,omitempty,brackets"`
	Filter     string   `url:"filter,omitempty,brackets"`
}

ListMaintenanceWindowsOptions is the data structure used when calling the ListMaintenanceWindows API endpoint.

type ListMaintenanceWindowsResponse

type ListMaintenanceWindowsResponse struct {
	APIListObject
	MaintenanceWindows []MaintenanceWindow `json:"maintenance_windows"`
}

ListMaintenanceWindowsResponse is the data structur returned from calling the ListMaintenanceWindows API endpoint.

type ListMembersOptions

type ListMembersOptions struct {
	APIListObject
}

ListMembersOptions are the optional parameters for a members request.

type ListMembersResponse

type ListMembersResponse struct {
	APIListObject
	Members []Member `json:"members"`
}

ListMembersResponse is the response from the members endpoint.

type ListNotificationOptions

type ListNotificationOptions struct {
	APIListObject
	TimeZone string   `url:"time_zone,omitempty"`
	Since    string   `url:"since,omitempty"`
	Until    string   `url:"until,omitempty"`
	Filter   string   `url:"filter,omitempty"`
	Includes []string `url:"include,omitempty"`
}

ListNotificationOptions is the data structure used when calling the ListNotifications API endpoint.

type ListNotificationsResponse

type ListNotificationsResponse struct {
	APIListObject
	Notifications []Notification
}

ListNotificationsResponse is the data structure returned from the ListNotifications API endpoint.

type ListOnCallOptions

type ListOnCallOptions struct {
	APIListObject
	TimeZone            string   `url:"time_zone,omitempty"`
	Includes            []string `url:"include,omitempty,brackets"`
	UserIDs             []string `url:"user_ids,omitempty,brackets"`
	EscalationPolicyIDs []string `url:"escalation_policy_ids,omitempty,brackets"`
	ScheduleIDs         []string `url:"schedule_ids,omitempty,brackets"`
	Since               string   `url:"since,omitempty"`
	Until               string   `url:"until,omitempty"`
	Earliest            bool     `url:"earliest,omitempty"`
}

ListOnCallOptions is the data structure used when calling the ListOnCalls API endpoint.

type ListOnCallUsersOptions

type ListOnCallUsersOptions struct {
	APIListObject
	Since string `url:"since,omitempty"`
	Until string `url:"until,omitempty"`
}

ListOnCallUsersOptions is the data structure used when calling the ListOnCallUsers API endpoint.

type ListOnCallsResponse

type ListOnCallsResponse struct {
	APIListObject
	OnCalls []OnCall `json:"oncalls"`
}

ListOnCallsResponse is the data structure returned from calling the ListOnCalls API endpoint.

type ListOverridesOptions

type ListOverridesOptions struct {
	APIListObject
	Since    string `url:"since,omitempty"`
	Until    string `url:"until,omitempty"`
	Editable bool   `url:"editable,omitempty"`
	Overflow bool   `url:"overflow,omitempty"`
}

ListOverridesOptions is the data structure used when calling the ListOverrides API endpoint.

type ListOverridesResponse

type ListOverridesResponse struct {
	APIListObject
	Overrides []Override `json:"overrides,omitempty"`
}

ListOverridesResponse is the data structure returned from calling the ListOverrides API endpoint.

type ListRulesetRulesResponse

type ListRulesetRulesResponse struct {
	Total  uint           `json:"total,omitempty"`
	Rules  []*RulesetRule `json:"rules,omitempty"`
	Offset uint           `json:"offset,omitempty"`
	More   bool           `json:"more,omitempty"`
	Limit  uint           `json:"limit,omitempty"`
}

ListRulesetRulesResponse represents a list of rules in a ruleset

type ListRulesetsResponse

type ListRulesetsResponse struct {
	Total    uint       `json:"total,omitempty"`
	Rulesets []*Ruleset `json:"rulesets,omitempty"`
	Offset   uint       `json:"offset,omitempty"`
	More     bool       `json:"more,omitempty"`
	Limit    uint       `json:"limit,omitempty"`
}

ListRulesetsResponse represents a list response of rulesets.

type ListSchedulesOptions

type ListSchedulesOptions struct {
	APIListObject
	Query string `url:"query,omitempty"`
}

ListSchedulesOptions is the data structure used when calling the ListSchedules API endpoint.

type ListSchedulesResponse

type ListSchedulesResponse struct {
	APIListObject
	Schedules []Schedule `json:"schedules"`
}

ListSchedulesResponse is the data structure returned from calling the ListSchedules API endpoint.

type ListServiceDependencies

type ListServiceDependencies struct {
	Relationships []*ServiceDependency `json:"relationships,omitempty"`
}

ListServiceDependencies represents a list of dependencies for a service

type ListServiceOptions

type ListServiceOptions struct {
	APIListObject
	TeamIDs  []string `url:"team_ids,omitempty,brackets"`
	TimeZone string   `url:"time_zone,omitempty"`
	SortBy   string   `url:"sort_by,omitempty"`
	Query    string   `url:"query,omitempty"`
	Includes []string `url:"include,omitempty,brackets"`
}

ListServiceOptions is the data structure used when calling the ListServices API endpoint.

type ListServiceResponse

type ListServiceResponse struct {
	APIListObject
	Services []Service
}

ListServiceResponse is the data structure returned from calling the ListServices API endpoint.

type ListTagOptions

type ListTagOptions struct {
	APIListObject
	Query string `url:"query,omitempty"`
}

ListTagOptions are the input parameters used when calling the ListTags API endpoint.

type ListTagResponse

type ListTagResponse struct {
	APIListObject
	Tags []*Tag `json:"tags"`
}

ListTagResponse is the structure used when calling the ListTags API endpoint.

type ListTeamOptions

type ListTeamOptions struct {
	APIListObject
	Query string `url:"query,omitempty"`
}

ListTeamOptions are the input parameters used when calling the ListTeams API endpoint.

type ListTeamResponse

type ListTeamResponse struct {
	APIListObject
	Teams []Team
}

ListTeamResponse is the structure used when calling the ListTeams API endpoint.

type ListTeamsForTagResponse

type ListTeamsForTagResponse struct {
	APIListObject
	Teams []*APIObject `json:"teams,omitempty"`
}

ListTeamsForTagResponse is the structure used to list teams assigned a given tag

type ListUserNotificationRulesResponse

type ListUserNotificationRulesResponse struct {
	APIListObject
	NotificationRules []NotificationRule `json:"notification_rules"`
}

ListUserNotificationRulesResponse the data structure returned from calling the ListNotificationRules API endpoint.

type ListUserResponse

type ListUserResponse struct {
	APIListObject
	Users []*APIObject `json:"users,omitempty"`
}

ListUserResponse is the structure used to list users assigned a given tag

type ListUsersOptions

type ListUsersOptions struct {
	APIListObject
	Query    string   `url:"query,omitempty"`
	TeamIDs  []string `url:"team_ids,omitempty,brackets"`
	Includes []string `url:"include,omitempty,brackets"`
}

ListUsersOptions is the data structure used when calling the ListUsers API endpoint.

type ListUsersResponse

type ListUsersResponse struct {
	APIListObject
	Users []User
}

ListUsersResponse is the data structure returned from calling the ListUsers API endpoint.

type ListVendorOptions

type ListVendorOptions struct {
	APIListObject
	Query string `url:"query,omitempty"`
}

ListVendorOptions is the data structure used when calling the ListVendors API endpoint.

type ListVendorResponse

type ListVendorResponse struct {
	APIListObject
	Vendors []Vendor
}

ListVendorResponse is the data structure returned from calling the ListVendors API endpoint.

type LogEntry

type LogEntry struct {
	CommonLogEntryField
	Incident Incident `json:"incident"`
}

LogEntry is a list of all of the events that happened to an incident.

type MaintenanceWindow

type MaintenanceWindow struct {
	APIObject
	SequenceNumber uint            `json:"sequence_number,omitempty"`
	StartTime      string          `json:"start_time"`
	EndTime        string          `json:"end_time"`
	Description    string          `json:"description"`
	Services       []APIObject     `json:"services"`
	Teams          []APIListObject `json:"teams"`
	CreatedBy      APIListObject   `json:"created_by"`
}

MaintenanceWindow is used to temporarily disable one or more services for a set period of time.

type ManageIncidentsOptions

type ManageIncidentsOptions struct {
	ID          string        `json:"id"`
	Type        string        `json:"type"`
	Status      string        `json:"status,omitempty"`
	Priority    *APIReference `json:"priority,omitempty"`
	Assignments []Assignee    `json:"assignments,omitempty"`
}

ManageIncidentsOptions is the structure used when PUTing updates to incidents to the ManageIncidents func

type Member

type Member struct {
	APIObject struct {
		APIObject
	} `json:"user"`
	Role string `json:"role"`
}

Member is a team member.

type MergeIncidentsOptions

type MergeIncidentsOptions struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

MergeIncidentsOptions is the structure used when merging incidents with MergeIncidents func

type Notification

type Notification struct {
	ID        string `json:"id"`
	Type      string
	StartedAt string `json:"started_at"`
	Address   string
	User      APIObject
}

Notification is a message containing the details of the incident.

type NotificationRule

type NotificationRule struct {
	ID                  string        `json:"id"`
	StartDelayInMinutes uint          `json:"start_delay_in_minutes"`
	CreatedAt           string        `json:"created_at"`
	ContactMethod       ContactMethod `json:"contact_method"`
	Urgency             string        `json:"urgency"`
	Type                string        `json:"type"`
}

NotificationRule is a rule for notifying the user.

type NullAPIErrorObject added in v1.3.4

type NullAPIErrorObject struct {
	Valid       bool
	ErrorObject APIErrorObject
}

NullAPIErrorObject is a wrapper around the APIErrorObject type. If the Valid field is true, the API response included a structured error JSON object. This structured object is then set on the ErrorObject field.

While the PagerDuty REST API is documented to always return the error object, we assume it's possible in exceptional failure modes for this to be omitted. As such, this wrapper type provides us a way to check if the object was provided while avoiding cosnumers accidentally missing a nil pointer check, thus crashing their whole program.

func (*NullAPIErrorObject) UnmarshalJSON added in v1.3.4

func (n *NullAPIErrorObject) UnmarshalJSON(data []byte) error

UnmarshalJSON satisfies encoding/json.Unmarshaler

type OnCall

type OnCall struct {
	User             User             `json:"user,omitempty"`
	Schedule         Schedule         `json:"schedule,omitempty"`
	EscalationPolicy EscalationPolicy `json:"escalation_policy,omitempty"`
	EscalationLevel  uint             `json:"escalation_level,omitempty"`
	Start            string           `json:"start,omitempty"`
	End              string           `json:"end,omitempty"`
}

OnCall represents a contiguous unit of time for which a user will be on call for a given escalation policy and escalation rule.

type Override

type Override struct {
	ID    string    `json:"id,omitempty"`
	Start string    `json:"start,omitempty"`
	End   string    `json:"end,omitempty"`
	User  APIObject `json:"user,omitempty"`
}

Overrides are any schedule layers from the override layer.

type PendingAction

type PendingAction struct {
	Type string `json:"type,omitempty"`
	At   string `json:"at,omitempty"`
}

PendingAction is the data structure for any pending actions on an incident.

type PreviewScheduleOptions

type PreviewScheduleOptions struct {
	APIListObject
	Since    string `url:"since,omitempty"`
	Until    string `url:"until,omitempty"`
	Overflow bool   `url:"overflow,omitempty"`
}

PreviewScheduleOptions is the data structure used when calling the PreviewSchedule API endpoint.

type Priorities

type Priorities struct {
	APIListObject
	Priorities []PriorityProperty `json:"priorities"`
}

type Priority

type Priority struct {
	APIObject
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

Priority is the data structure describing the priority of an incident.

type PriorityProperty

type PriorityProperty struct {
	APIObject
	Name        string `json:"name"`
	Description string `json:"description"`
}

PriorityProperty is a single priorty object returned from the Priorities endpoint

type RawAnalyticsData added in v1.3.4

type RawAnalyticsData struct {
	AssignmentCount           int    `json:"assignment_count,omitempty"`
	BusinessHourInterruptions int    `json:"business_hour_interruptions,omitempty"`
	CreatedAt                 string `json:"created_at,omitempty"`
	Description               string `json:"description,omitempty"`
	EngagedSeconds            int    `json:"engaged_seconds,omitempty"`
	EngagedUserCount          int    `json:"engaged_user_count,omitempty"`
	EscalationCount           int    `json:"escalation_count,omitempty"`
	ID                        string `json:"id,omitempty"`
	IncidentNumber            int    `json:"incident_number,omitempty"`
	Major                     bool   `json:"major,omitempty"`
	OffHourInterruptions      int    `json:"off_hour_interruptions,omitempty"`
	PriorityID                string `json:"priority_id,omitempty"`
	PriorityName              string `json:"priority_name,omitempty"`
	ResolvedAt                string `json:"resolved_at,omitempty"`
	SecondsToEngage           int    `json:"seconds_to_engage,omitempty"`
	SecondsToFirstAck         int    `json:"seconds_to_first_ack,omitempty"`
	SecondsToMobilize         int    `json:"seconds_to_mobilize,omitempty"`
	SecondsToResolve          int    `json:"seconds_to_resolve,omitempty"`
	ServiceID                 string `json:"service_id,omitempty"`
	ServiceName               string `json:"service_name,omitempty"`
	SleepHourInterruptions    int    `json:"sleep_hour_interruptions,omitempty"`
	SnoozedSeconds            int    `json:"snoozed_seconds,omitempty"`
	TeamID                    string `json:"team_id,omitempty"`
	TeamName                  string `json:"team_name,omitempty"`
	Urgency                   string `json:"urgency,omitempty"`
	UserDefinedEffortSeconds  int    `json:"user_defined_effort_seconds,omitempty"`
}

type RawAnalyticsRequest added in v1.3.4

type RawAnalyticsRequest struct {
	AnalyticsFilter *AnalyticsFilter `json:"filters,omitempty"`
	StartingAfter   string           `json:"starting_after,omitempty`
	EndingBefore    string           `json:"order,omitempty`
	Order           string           `json:"order_by,omitempty`
	OrderBy         string           `json:"order_by,omitempty`
	Limit           int              `json:"limit,omitempty`
	TimeZone        string           `json:"time_zone,omitempty"`
}

type RawAnalyticsResponse added in v1.3.4

type RawAnalyticsResponse struct {
	Data            []RawAnalyticsData `json:"data,omitempty"`
	AnalyticsFilter *AnalyticsFilter   `json:"filters,omitempty"`
	StartingAfter   string             `json:"starting_after,omitempty`
	EndingBefore    string             `json:"order,omitempty`
	Order           string             `json:"order_by,omitempty`
	OrderBy         string             `json:"order_by,omitempty`
	Limit           int                `json:"limit,omitempty`
	TimeZone        string             `json:"time_zone,omitempty"`
	First           string             `json:"first,omitempty"`
	Last            string             `json:"last,omitempty"`
	More            bool               `json:"more,omitempty"`
}

type RenderedScheduleEntry

type RenderedScheduleEntry struct {
	Start string    `json:"start,omitempty"`
	End   string    `json:"end,omitempty"`
	User  APIObject `json:"user,omitempty"`
}

RenderedScheduleEntry represents the computed set of schedule layer entries that put users on call for a schedule, and cannot be modified directly.

type ResolveReason

type ResolveReason struct {
	Type     string    `json:"type,omitempty"`
	Incident APIObject `json:"incident"`
}

Resolve reason is the data structure describing the reason an incident was resolved

type ResponderRequest

type ResponderRequest struct {
	Incident    Incident                `json:"incident"`
	Requester   User                    `json:"requester,omitempty"`
	RequestedAt string                  `json:"request_at,omitempty"`
	Message     string                  `json:"message,omitempty"`
	Targets     ResponderRequestTargets `json:"responder_request_targets"`
}

ResponderRequest contains the API structure for an incident responder request.

type ResponderRequestOptions

type ResponderRequestOptions struct {
	From        string                   `json:"-"`
	Message     string                   `json:"message"`
	RequesterID string                   `json:"requester_id"`
	Targets     []ResponderRequestTarget `json:"responder_request_targets"`
}

ResponderRequestOptions defines the input options for the Create Responder function.

type ResponderRequestResponse

type ResponderRequestResponse struct {
	ResponderRequest ResponderRequest `json:"responder_request"`
}

ResponderRequestResponse

type ResponderRequestTarget

type ResponderRequestTarget struct {
	APIObject
	Responders IncidentResponders `json:"incident_responders"`
}

ResponderRequestTarget specifies an individual target for the responder request.

type ResponderRequestTargets

type ResponderRequestTargets struct {
	Target ResponderRequestTarget `json:"responder_request_target"`
}

ResponderRequestTargets is a wrapper for a ResponderRequestTarget.

type Restriction

type Restriction struct {
	Type            string `json:"type,omitempty"`
	StartTimeOfDay  string `json:"start_time_of_day,omitempty"`
	StartDayOfWeek  uint   `json:"start_day_of_week,omitempty"`
	DurationSeconds uint   `json:"duration_seconds,omitempty"`
}

Restriction limits on-call responsibility for a layer to certain times of the day or week.

type RuleActionExtraction

type RuleActionExtraction struct {
	Target string `json:"target,omitempty"`
	Source string `json:"source,omitempty"`
	Regex  string `json:"regex,omitempty"`
}

RuleActionExtraction represents a rule extraction action object

type RuleActionParameter

type RuleActionParameter struct {
	Value string `json:"value,omitempty"`
}

RuleActionParameter represents a generic parameter object on a rule action

type RuleActionSuppress

type RuleActionSuppress struct {
	Value               bool   `json:"value,omitempty"`
	ThresholdValue      int    `json:"threshold_value,omitempty"`
	ThresholdTimeUnit   string `json:"threshold_time_unit,omitempty"`
	ThresholdTimeAmount int    `json:"threshold_time_amount,omitempty"`
}

RuleActionSuppress represents a rule suppress action object

type RuleActions

type RuleActions struct {
	Suppress    *RuleActionSuppress     `json:"suppress,omitempty"`
	Annotate    *RuleActionParameter    `json:"annotate,omitempty"`
	Severity    *RuleActionParameter    `json:"severity,omitempty"`
	Priority    *RuleActionParameter    `json:"priority,omitempty"`
	Route       *RuleActionParameter    `json:"route"`
	EventAction *RuleActionParameter    `json:"event_action,omitempty"`
	Extractions []*RuleActionExtraction `json:"extractions,omitempty"`
}

RuleActions represents a rule action

type RuleConditions

type RuleConditions struct {
	Operator          string              `json:"operator,omitempty"`
	RuleSubconditions []*RuleSubcondition `json:"subconditions,omitempty"`
}

RuleConditions represents the conditions field for a Ruleset

type RuleSubcondition

type RuleSubcondition struct {
	Operator   string              `json:"operator,omitempty"`
	Parameters *ConditionParameter `json:"parameters,omitempty"`
}

RuleSubcondition represents a subcondition of a ruleset condition

type RuleTimeFrame

type RuleTimeFrame struct {
	ScheduledWeekly *ScheduledWeekly `json:"scheduled_weekly,omitempty"`
	ActiveBetween   *ActiveBetween   `json:"active_between,omitempty"`
}

RuleTimeFrame represents a time_frame object on the rule object

type Ruleset

type Ruleset struct {
	ID          string         `json:"id,omitempty"`
	Name        string         `json:"name,omitempty"`
	Type        string         `json:"type,omitempty"`
	RoutingKeys []string       `json:"routing_keys,omitempty"`
	Team        *RulesetObject `json:"team,omitempty"`
	Updater     *RulesetObject `json:"updater,omitempty"`
	Creator     *RulesetObject `json:"creator,omitempty"`
}

Ruleset represents a ruleset.

type RulesetObject

type RulesetObject struct {
	Type string `json:"type,omitempty"`
	ID   string `json:"id,omitempty"`
}

RulesetObject represents a generic object that is common within a ruleset object

type RulesetPayload

type RulesetPayload struct {
	Ruleset *Ruleset `json:"ruleset,omitempty"`
}

RulesetPayload represents payload with a ruleset object

type RulesetRule

type RulesetRule struct {
	ID         string          `json:"id,omitempty"`
	Position   *int            `json:"position,omitempty"`
	Disabled   bool            `json:"disabled,omitempty"`
	Conditions *RuleConditions `json:"conditions,omitempty"`
	Actions    *RuleActions    `json:"actions,omitempty"`
	Ruleset    *APIObject      `json:"ruleset,omitempty"`
	Self       string          `json:"self,omitempty"`
	CatchAll   bool            `json:"catch_all,omitempty"`
	TimeFrame  *RuleTimeFrame  `json:"time_frame,omitempty"`
}

RulesetRule represents a Ruleset rule

type RulesetRulePayload

type RulesetRulePayload struct {
	Rule *RulesetRule `json:"rule,omitempty"`
}

RulesetRulePayload represents a payload for ruleset rules

type Schedule

type Schedule struct {
	APIObject
	Name                string          `json:"name,omitempty"`
	TimeZone            string          `json:"time_zone,omitempty"`
	Description         string          `json:"description,omitempty"`
	EscalationPolicies  []APIObject     `json:"escalation_policies,omitempty"`
	Users               []APIObject     `json:"users,omitempty"`
	Teams               []APIReference  `json:"teams,omitempty"`
	ScheduleLayers      []ScheduleLayer `json:"schedule_layers,omitempty"`
	OverrideSubschedule ScheduleLayer   `json:"override_subschedule,omitempty"`
	FinalSchedule       ScheduleLayer   `json:"final_schedule,omitempty"`
}

Schedule determines the time periods that users are on call.

type ScheduleLayer

type ScheduleLayer struct {
	APIObject
	Name                       string                  `json:"name,omitempty"`
	Start                      string                  `json:"start,omitempty"`
	End                        string                  `json:"end,omitempty"`
	RotationVirtualStart       string                  `json:"rotation_virtual_start,omitempty"`
	RotationTurnLengthSeconds  uint                    `json:"rotation_turn_length_seconds,omitempty"`
	Users                      []UserReference         `json:"users,omitempty"`
	Restrictions               []Restriction           `json:"restrictions,omitempty"`
	RenderedScheduleEntries    []RenderedScheduleEntry `json:"rendered_schedule_entries,omitempty"`
	RenderedCoveragePercentage float64                 `json:"rendered_coverage_percentage,omitempty"`
}

ScheduleLayer is an entry that puts users on call for a schedule.

type ScheduledAction

type ScheduledAction struct {
	Type      string      `json:"type,omitempty"`
	At        InlineModel `json:"at,omitempty"`
	ToUrgency string      `json:"to_urgency"`
}

ScheduledAction contains scheduled actions for the service.

type ScheduledWeekly

type ScheduledWeekly struct {
	Weekdays  []int  `json:"weekdays,omitempty"`
	Timezone  string `json:"timezone,omitempty"`
	StartTime int    `json:"start_time,omitempty"`
	Duration  int    `json:"duration,omitempty"`
}

ScheduledWeekly represents a time_frame object for scheduling rules weekly

type Service

type Service struct {
	APIObject
	Name                    string                   `json:"name,omitempty"`
	Description             string                   `json:"description,omitempty"`
	AutoResolveTimeout      *uint                    `json:"auto_resolve_timeout"`
	AcknowledgementTimeout  *uint                    `json:"acknowledgement_timeout"`
	CreateAt                string                   `json:"created_at,omitempty"`
	Status                  string                   `json:"status,omitempty"`
	LastIncidentTimestamp   string                   `json:"last_incident_timestamp,omitempty"`
	Integrations            []Integration            `json:"integrations,omitempty"`
	EscalationPolicy        EscalationPolicy         `json:"escalation_policy,omitempty"`
	Teams                   []Team                   `json:"teams,omitempty"`
	IncidentUrgencyRule     *IncidentUrgencyRule     `json:"incident_urgency_rule,omitempty"`
	SupportHours            *SupportHours            `json:"support_hours"`
	ScheduledActions        []ScheduledAction        `json:"scheduled_actions"`
	AlertCreation           string                   `json:"alert_creation,omitempty"`
	AlertGrouping           string                   `json:"alert_grouping,omitempty"`
	AlertGroupingTimeout    *uint                    `json:"alert_grouping_timeout,omitempty"`
	AlertGroupingParameters *AlertGroupingParameters `json:"alert_grouping_parameters,omitempty"`
}

Service represents something you monitor (like a web service, email service, or database service).

type ServiceDependency

type ServiceDependency struct {
	ID                string      `json:"id,omitempty"`
	Type              string      `json:"type,omitempty"`
	SupportingService *ServiceObj `json:"supporting_service,omitempty"`
	DependentService  *ServiceObj `json:"dependent_service,omitempty"`
}

ServiceDependency represents a relationship between a business and technical service

type ServiceObj

type ServiceObj struct {
	ID   string `json:"id,omitempty"`
	Type string `json:"type,omitempty"`
}

ServiceObj represents a service object in service relationship

type SupportHours

type SupportHours struct {
	Type       string `json:"type,omitempty"`
	Timezone   string `json:"time_zone,omitempty"`
	StartTime  string `json:"start_time,omitempty"`
	EndTime    string `json:"end_time,omitempty"`
	DaysOfWeek []uint `json:"days_of_week,omitempty"`
}

SupportHours are the support hours for the service.

type Tag

type Tag struct {
	APIObject
	Label string `json:"label,omitempty"`
}

Tag is a way to label user, team and escalation policies in PagerDuty

type TagAssignment

type TagAssignment struct {
	Type  string `json:"type"`
	TagID string `json:"id,omitempty"`
	Label string `json:"label,omitempty"`
}

TagAssignment is the structure for assigning tags to an entity

type TagAssignments

type TagAssignments struct {
	Add    []*TagAssignment `json:"add,omitempty"`
	Remove []*TagAssignment `json:"remove,omitempty"`
}

TagAssignments can be applied teams, users and escalation policies

type Team

type Team struct {
	APIObject
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

Team is a collection of users and escalation policies that represent a group of people within an organization.

type UpdateScheduleOptions

type UpdateScheduleOptions struct {
	Overflow bool `url:"overflow,omitempty"`
}

UpdateScheduleOptions is the data structure used when calling the UpdateSchedule API endpoint.

type User

type User struct {
	APIObject
	Type              string             `json:"type"`
	Name              string             `json:"name"`
	Summary           string             `json:"summary"`
	Email             string             `json:"email"`
	Timezone          string             `json:"time_zone,omitempty"`
	Color             string             `json:"color,omitempty"`
	Role              string             `json:"role,omitempty"`
	AvatarURL         string             `json:"avatar_url,omitempty"`
	Description       string             `json:"description,omitempty"`
	InvitationSent    bool               `json:"invitation_sent,omitempty"`
	ContactMethods    []ContactMethod    `json:"contact_methods"`
	NotificationRules []NotificationRule `json:"notification_rules"`
	JobTitle          string             `json:"job_title,omitempty"`
	Teams             []Team
}

User is a member of a PagerDuty account that has the ability to interact with incidents and other data on the account.

type UserReference

type UserReference struct {
	User APIObject `json:"user"`
}

UserReference is a reference to an authorized PagerDuty user.

type V2Event

type V2Event struct {
	RoutingKey string        `json:"routing_key"`
	Action     string        `json:"event_action"`
	DedupKey   string        `json:"dedup_key,omitempty"`
	Images     []interface{} `json:"images,omitempty"`
	Links      []interface{} `json:"links,omitempty"`
	Client     string        `json:"client,omitempty"`
	ClientURL  string        `json:"client_url,omitempty"`
	Payload    *V2Payload    `json:"payload,omitempty"`
}

V2Event includes the incident/alert details

type V2EventResponse

type V2EventResponse struct {
	Status   string   `json:"status,omitempty"`
	DedupKey string   `json:"dedup_key,omitempty"`
	Message  string   `json:"message,omitempty"`
	Errors   []string `json:"errors,omitempty"`
}

V2EventResponse is the json response body for an event

func ManageEvent

func ManageEvent(e V2Event) (*V2EventResponse, error)

ManageEvent handles the trigger, acknowledge, and resolve methods for an event

type V2Payload

type V2Payload struct {
	Summary   string      `json:"summary"`
	Source    string      `json:"source"`
	Severity  string      `json:"severity"`
	Timestamp string      `json:"timestamp,omitempty"`
	Component string      `json:"component,omitempty"`
	Group     string      `json:"group,omitempty"`
	Class     string      `json:"class,omitempty"`
	Details   interface{} `json:"custom_details,omitempty"`
}

V2Payload represents the individual event details for an event

type Vendor

type Vendor struct {
	APIObject
	Name                  string `json:"name,omitempty"`
	LogoURL               string `json:"logo_url,omitempty"`
	LongName              string `json:"long_name,omitempty"`
	WebsiteURL            string `json:"website_url,omitempty"`
	Description           string `json:"description,omitempty"`
	Connectable           bool   `json:"connectable,omitempty"`
	ThumbnailURL          string `json:"thumbnail_url,omitempty"`
	GenericServiceType    string `json:"generic_service_type,omitempty"`
	IntegrationGuideURL   string `json:"integration_guide_url,omitempty"`
	AlertCreationDefault  string `json:"alert_creation_default,omitempty"`
	AlertCreationEditable bool   `json:"alert_creation_editable,omitempty"`
	IsPDCEF               bool   `json:"is_pd_cef,omitempty"`
}

Vendor represents a specific type of integration. AWS Cloudwatch, Splunk, Datadog, etc are all examples of vendors that can be integrated in PagerDuty by making an integration.

type WebhookPayload

type WebhookPayload struct {
	ID         string          `json:"id"`
	Event      string          `json:"event"`
	CreatedOn  time.Time       `json:"created_on`
	Incident   IncidentDetails `json:"incident"`
	LogEntries []LogEntry      `json:"log_entries"`
}

WebhookPayload represents the V2 webhook payload

type WebhookPayloadMessages

type WebhookPayloadMessages struct {
	Messages []WebhookPayload `json:"messages"`
}

WebhookPayloadMessages is the wrapper around the Webhook payloads. The Array may contain multiple message elements if webhook firing actions occurred in quick succession

func DecodeWebhook

func DecodeWebhook(r io.Reader) (*WebhookPayloadMessages, error)

DecodeWebhook decodes a webhook from a response object.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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