pagerduty

package module
Version: v0.0.0-...-5d7dd13 Latest Latest
Warning

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

Go to latest
Published: May 23, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

README

go-pagerduty

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

Installation

go get github.com/PagerDuty/go-pagerduty

Usage

CLI

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

---
authtoken: fooBar

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
From golang libraries
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)
	if eps, err := client.ListEscalationPolicies(opts); err != nil {
		panic(err)
	} else {
		for _, p := range eps.EscalationPolicies {
			fmt.Println(p.Name)
		}
	}
}

License

Apache 2

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
	Acknowledger APIObject
}

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

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 Assignment

type Assignment struct {
	At       string
	Assignee APIObject
}

Assignment is the data structure for an assignment of an incident

type Channel

type Channel struct {
	Type    string
	Details Details
}

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

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps http client

func NewClient

func NewClient(authToken string) *Client

NewClient creates an API client

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) 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) CreateIncidentNote

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

CreateIncidentNote 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) CreateMaintenanceWindows

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

CreateMaintenanceWindows creates a new maintenance window for the specified services.

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) 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) 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) DeleteAddon

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

DeleteAddon deletes an add-on from your account.

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) 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) 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) 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) GetAddon

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

GetAddon gets details about an existing add-on.

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) GetIncident

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

GetIncident shows detailed information about an incident.

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) 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) GetTeam

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

GetTeam gets details about an existing team.

func (*Client) GetUser

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

GetUser gets details about an existing user.

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) 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) 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) 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) ([]Override, error)

ListOverrides lists overrides for a given time range.

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) ListTeams

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

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

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) ManageIncidents

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

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

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) SnoozeIncident

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

SnoozeIncident 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) 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) 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) 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.

type ContactMethod

type ContactMethod struct {
	ID             string
	Label          string
	Address        string
	Type           string
	SendShortEmail bool `json:"send_short_email"`
}

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 Details

type Details struct {
	Name  string
	Query string
	Time  string
}

Details is the info received for Channel.

type EscalationPolicy

type EscalationPolicy struct {
	APIObject
	Name            string           `json:"name,omitempty"`
	EscalationRules []EscalationRule `json:"escalation_rules,omitempty"`
	Services        []APIReference   `json:"services,omitempty"`
	NumLoops        uint             `json:"num_loops,omitempty"`
	Teams           []APIReference   `json:"teams,omitempty"`
	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"`
}

EventResponse is the data returned from the CreateEvent API endpoint.

func CreateEvent

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

CreateEvent sends PagerDuty an event to report, acknowledge, or resolve a problem.

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:"timezone,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 Incident

type Incident struct {
	APIObject
	IncidentNumber       uint              `json:"incident_number,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 APIObject         `json:"first_trigger_log_entry,omitempty"`
	EscalationPolicy     APIObject         `json:"escalation_policy,omitempty"`
	Teams                []APIObject       `json:"teams,omitempty"`
	Urgency              string            `json:"urgency,omitempty"`
	Status               string            `json:"status,omitempty"`
}

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

type IncidentDetail

type IncidentDetail struct {
	ID                    string           `json:"id"`
	IncidentNumber        uint             `json:"incident_number"`
	CreatedOn             string           `json:"created_on"`
	Status                string           `json:"status"`
	HTMLUrl               string           `json:"html_url"`
	Service               string           `json:"service"`
	AssignedToUser        *json.RawMessage `json:"assigned_to_user"`
	AssignedTo            []string         `json:"assigned_to"`
	TriggerSummaryData    *json.RawMessage `json:"trigger_summary_data"`
	TriggerDetailsHTMLUrl string           `json:"trigger_details_html_url"`
}

IncidentDetail 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 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 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 ListIncidentLogEntriesOptions

type ListIncidentLogEntriesOptions struct {
	APIListObject
	Includes   []string `url:"include,omitempty,brackets"`
	IsOverview bool     `url:"is_overview,omitempty"`
	TimeZone   string   `url:"time_zone,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"`
	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 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 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 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 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 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 {
	APIObject
	CreatedAt              string `json:"created_at"`
	Agent                  Agent
	Channel                Channel
	Incident               Incident
	Teams                  []Team
	Contexts               []Context
	AcknowledgementTimeout int `json:"acknowledgement_timeout"`
	EventDetails           map[string]string
}

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 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
	StartDelayInMinutes uint          `json:"start_delay_in_minutes"`
	CreatedAt           string        `json:"created_at"`
	ContactMethod       ContactMethod `json:"contact_method"`
	Urgency             string
	Type                string
}

NotificationRule is a rule for notifying the user.

type OnCall

type OnCall struct {
	User             APIObject `json:"user,omitempty"`
	Schedule         APIObject `json:"schedule,omitempty"`
	EscalationPolicy APIObject `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
	At   string
}

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 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 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 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"`
	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 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,omitempty"`
	ScheduledActions       []ScheduledAction    `json:"scheduled_actions,omitempty"`
	AlertCreation          string               `json:"alert_creation,omitempty"`
}

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

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 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
	Name              string `json:"name"`
	Email             string `json:"email"`
	Timezone          string `json:"timezone,omitempty"`
	Color             string `json:"color,omitempty"`
	Role              string `json:"role,omitempty"`
	AvatarURL         string `json:"avatar_url,omitempty"`
	Description       string `json:"description,omitempty"`
	InvitationSent    bool
	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 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"`
}

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"`
	Type      string           `json:"type"`
	CreatedOn string           `json:"created_on"`
	Data      *json.RawMessage `json:"data"`
}

WebhookPayload is a single message array for a webhook.

func DecodeWebhook

func DecodeWebhook(r io.Reader) (*WebhookPayload, 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
t or T : Toggle theme light dark auto
y or Y : Canonical URL