Documentation ¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func Int(v int) *int
- func String(v string) *string
- func Time(v time.Time) *time.Time
- type Alert
- type AlertListOptions
- type AlertsService
- type Client
- func (c *Client) Delete(path string) (*Response, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)
- func (c *Client) DoEventRequest(req *http.Request) (*EventResponse, error)
- func (c *Client) Get(path string, v interface{}) (*Response, error)
- func (c *Client) NewEventRequest(method, path string, body interface{}) (*http.Request, error)
- func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)
- func (c *Client) Post(path string, body, v interface{}) (*Response, error)
- func (c *Client) Put(path string, body, v interface{}) (*Response, error)
- type Date
- type EmailFilter
- type ErrorResponse
- type EscalationPoliciesService
- type EscalationPolicy
- type EscalationPolicyListOptions
- type EscalationRule
- type Event
- type EventResponse
- type EventsService
- type GetServiceOptions
- type GetUserOptions
- type ImageContext
- type Incident
- type IncidentAcknowledgeOptions
- type IncidentCountOptions
- type IncidentCounts
- type IncidentEditOptions
- type IncidentListOptions
- type IncidentParameter
- type IncidentReassignOptions
- type IncidentResolveOptions
- type IncidentSnoozeOptions
- type IncidentsService
- func (s *IncidentsService) Acknowledge(id string, opts *IncidentAcknowledgeOptions) (*Response, error)
- func (s *IncidentsService) Count(opts *IncidentCountOptions) (int, *Response, error)
- func (s *IncidentsService) Edit(opts *IncidentEditOptions) ([]Incident, *Response, error)
- func (s *IncidentsService) Get(id string) (*Incident, *Response, error)
- func (s *IncidentsService) List(opts *IncidentListOptions) ([]Incident, *Response, error)
- func (s *IncidentsService) Reassign(id string, opts *IncidentReassignOptions) (*Response, error)
- func (s *IncidentsService) Resolve(id string, opts *IncidentResolveOptions) (*Response, error)
- func (s *IncidentsService) Snooze(id string, opts *IncidentSnoozeOptions) (*Response, error)
- type LinkContext
- type ListOptions
- type ObjectAt
- type PendingAction
- type Response
- type Schedule
- type ScheduleLayer
- type ScheduleListOptions
- type ScheduleUsersOptions
- type SchedulesService
- type Service
- type ServiceListOptions
- type ServicesService
- type Target
- type Team
- type TeamListOptions
- type TeamsService
- func (s *TeamsService) Create(team *Team) (*Team, *Response, error)
- func (s *TeamsService) Delete(id string) (*Response, error)
- func (s *TeamsService) Edit(team *Team) (*Team, *Response, error)
- func (s *TeamsService) Get(id string) (*Team, *Response, error)
- func (s *TeamsService) List(opts *TeamListOptions) ([]Team, *Response, error)
- type TimeZone
- type TriggerSummary
- type User
- type UserListOptions
- type UsersService
- type WebhookIncident
- type WebhookMessage
- type WebhookObject
- type WebhookService
- type WebhookUser
- type WebhooksService
Constants ¶
const ( AlertTypeEmail = "Email" AlertTypePhone = "Phone" AlertTypePush = "Push" AlertTypeSMS = "SMS" )
const ( ErrInternalError uint = 2000 + iota ErrInvalidInputProvided ErrArgumentsCausedError ErrMissingArguments ErrInvalidSinceOrUntilParameterValues ErrInvalidQueryDateRange ErrAuthenticationFailed ErrAccountNotFound ErrAccountLocked ErrOnlyHTTPSAllowedForThisCall ErrAccessDenied ErrRequiresRequesterID ErrAccountExpired )
const ( ContextTypeLink = "link" ContextTypeImage = "image" EventTypeAcknowledge = "acknowledge" EventTypeResolve = "resolve" EventTypeTrigger = "trigger" EventStatusSuccess = "success" EventStatusError = "invalid event" )
const ( StatusTriggered = "triggered" StatusAcknowledged = "acknowledged" StatusResolved = "resolved" ObjectTypeUser = "user" ObjectTypeAPI = "api" )
const ( // http verb constants DELETE = "DELETE" GET = "GET" POST = "POST" PUT = "PUT" )
const ( StatusActive = "active" StatusWarning = "warning" StatusCritical = "critical" StatusMaintenance = "maintenance" StatusDisabled = "disabled" ServiceTypeCloudkick = "cloudkick" ServiceTypeGenericEmail = "generic_email" ServiceTypeGenericEventsAPI = "generic_events_api" ServiceTypeKeynote = "keynote" ServiceTypeNagios = "nagios" ServiceTypePingdom = "pingdom" ServiceTypeServerDensity = "server_density" ServiceTypeSQLMonitor = "sql_monitor" )
const ( IncludeContactMethod = "contact_method" IncludeNotificationRules = "notification_rules" )
const ( WebhookIncidentAcknowledge = "incident.acknowledge" WebhookIncidentAssign = "incident.assign" WebhookIncidentDelegate = "incident.delegate" WebhookIncidentEscalate = "incident.escalate" WebhookIncidentResolve = "incident.resolve" WebhookIncidentTrigger = "incident.trigger" WebhookIncidentUnacknowledge = "incident.unacknowledge" )
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper function that allocates a new bool value to store v and returns a pointer to it.
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range.
func Int ¶
Int is a helper function that allocates a new int value to store v and returns a pointer to it.
Types ¶
type Alert ¶
type Alert struct { ID *string `json:"id"` Type *string `json:"type"` StartedAt *time.Time `json:"started_at"` User *User `json:"user"` Address *string `json:"address"` }
Alert represents a PagerDuty alert.
type AlertListOptions ¶
type AlertListOptions struct { // The start of the date range you want to search. Since time.Time `url:"since,omitempty"` // The end of the date range you want to search. Until time.Time `url:"until,omitempty"` // Returns only alerts of the said types. Can be one of 'SMS', 'Email', // 'Pone' or 'Push'. FilterType string `url:"filter[type],omitempty"` // Time zone in which dates in the result will be rendered. Defaults to // account time zone. TimeZone TimeZone `url:"time_zone,omitempty"` ListOptions }
type AlertsService ¶
type AlertsService struct {
// contains filtered or unexported fields
}
AlertsService handles communication with the Alerts related methods of the PagerDuty API.
func (*AlertsService) List ¶
func (s *AlertsService) List(opts *AlertListOptions) ([]Alert, *Response, error)
List alerts filtered by provided options.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/alerts/list
type Client ¶
type Client struct { // Base URL for the PagerDuty API. BaseURL *url.URL // Base URL for the PagerDuty Events API. EventsURL *url.URL // PagerDuty API key. APIKey string // Services used for talking to different parts of the PagerDuty API. Alerts *AlertsService EscalationPolicies *EscalationPoliciesService Events *EventsService Incidents *IncidentsService Schedules *SchedulesService Services *ServicesService Teams *TeamsService Users *UsersService Webhooks *WebhooksService // contains filtered or unexported fields }
A Client manages communication with the PagerDuty API.
func NewClient ¶
NewClient returns a new PagerDuty API client. If httpClient is nil, http.DefaultClient will be used.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred.
func (*Client) DoEventRequest ¶
func (c *Client) DoEventRequest(req *http.Request) (*EventResponse, error)
DoEventRequest sends a request to the PagerDuty Events API and returns the response.
func (*Client) NewEventRequest ¶
NewEventRequest creates an API request for the PagerDuty Events API. It has the same requirements and behaviors as Client.NewRequest.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in path, in which case it is resolved relative to the BaseURL of the client. Relative URLs should always be specified without the preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body
type Date ¶
Date is a thin wrapper around the time.Time type that parses dates of the format 'YYYY-MM-DD'.
func (*Date) MarshalJSON ¶
func (*Date) UnmarshalJSON ¶
type EmailFilter ¶
type EmailFilter map[string]interface{}
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` Errors []string `json:"errors,omitempty"` }
An ErrorResponse reports an error caused by an API request.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type EscalationPoliciesService ¶
type EscalationPoliciesService struct {
// contains filtered or unexported fields
}
EscalationPoliciesService handles communication with the Escalation Policies related methods of the PagerDuty API.
func (*EscalationPoliciesService) Get ¶
func (s *EscalationPoliciesService) Get(id string) (*EscalationPolicy, *Response, error)
Get fetches an escalation policy by id.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/escalation_policies/show
func (*EscalationPoliciesService) List ¶
func (s *EscalationPoliciesService) List(opts *EscalationPolicyListOptions) ([]EscalationPolicy, *Response, error)
List escalation policies filtered by provided options.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/escalation_policies/list
type EscalationPolicy ¶
type EscalationPolicy struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` NumLoops *int `json:"num_loops,omitempty"` EscalationRules []EscalationRule `json:"escalation_rules,omitempty"` Services []Service `json:"services,omitempty"` }
EscalationPolicy represents a PagerDuty escalation policy.
type EscalationPolicyListOptions ¶
type EscalationPolicyListOptions struct { // Filters the results, showing only the escaltion policies whose names // match the query. Query string `url:"query,omitempty"` // A comma-separated lists of team IDs, speicifying teams whose maintenance // windows will be returned. Teams string `url:"teams,omitempty"` // Include extra information in the response. Possible values are 'teams'. Include []string `url:"teams,omitempty"` ListOptions }
type EscalationRule ¶
type Event ¶
type Event struct { Type *string `json:"event_type,omitempty"` ServiceKey *string `json:"service_key,omitempty"` Description *string `json:"description,omitempty"` IncidentKey *string `json:"incident_key,omitempty"` Client *string `json:"client,omitempty"` ClientURL *string `json:"client_url,omitempty"` Details interface{} `json:"details,omitempty"` // NOTE: Contexts should contain only LinkContext or ImageContext structs. Contexts []interface{} `json:"contexts,omitempty"` }
type EventResponse ¶
type EventsService ¶
type EventsService struct {
// contains filtered or unexported fields
}
EventsService handles communication with the PagerDuty Events API.
https://developer.pagerduty.com/documentation/integration/events
func (*EventsService) Acknowledge ¶
func (s *EventsService) Acknowledge(event *Event) (*EventResponse, error)
Acknowledge an event (incident).
https://developer.pagerduty.com/documentation/integration/events/acknowledge
func (*EventsService) Resolve ¶
func (s *EventsService) Resolve(event *Event) (*EventResponse, error)
Resolve an event (incident).
https://developer.pagerduty.com/documentation/integration/events/resolve
func (*EventsService) Trigger ¶
func (s *EventsService) Trigger(event *Event) (*EventResponse, error)
Trigger an event (incident).
https://developer.pagerduty.com/documentation/integration/events/trigger
type GetServiceOptions ¶
type GetServiceOptions struct { // Include extra information in the response. Possible values are // 'escalation_policy' and 'email_filters'. Include []string `url:"include,omitempty"` }
type GetUserOptions ¶
type GetUserOptions struct { // Array of additional details to include. This API accepts `contact_method` // and `notification_rules`. Include []string `url:"include,omitempty"` }
type ImageContext ¶
type ImageContext struct { // The type of context being attached to the incident. Possible values are // 'link' and 'image'. Type string `json:"type,omitempty"` // The source of the image being attached to the incident. This must be // served via HTTPS. Source string `json:"src,omitempty"` // Optional link for the image. Href string `json:"href,omitempty"` // Optional alternative text for the image. Alt string `json:"alt,omitempty"` }
type Incident ¶
type Incident struct { Number *int `json:"incident_number,omitempty"` Status *string `json:"status,omitempty"` Urgency *string `json:"urgency,omitempty"` PendingActions []PendingAction `json:"pending_actions,omitempty"` CreatedOn *time.Time `json:"created_on,omitempty"` URL *string `json:"html_url,omitempty"` Key *string `json:"incident_key,omitempty"` Service *Service `json:"service,omitempty"` EscalationPolicy *EscalationPolicy `json:"escalation_policy,omitempty"` Teams []Team `json:"teams,omitempty"` AssignedTo []ObjectAt `json:"assigned_to,omitempty"` Acknowledgers []ObjectAt `json:"acknowledgers,omitempty"` LastStatusChangeBy *User `json:"last_status_change_by,omitempty"` LastStatusChangeOn *time.Time `json:"last_status_chage_on,omitempty"` TriggerSummary *TriggerSummary `json:"trigger_summary_data,omitempty"` TriggerDetailsURL *string `json:"trigger_details_html_url,omitempty"` // NOTE: Depricated field, used for the Events API. The fielf will only // contain the first assigned user. AssignedToUser *User `json:"assigned_to_user,omitempty"` }
Incident represents a PagerDuty incident.
type IncidentAcknowledgeOptions ¶
type IncidentAcknowledgeOptions struct { // The user ID of the user making the request. RequesterID string `url:"requester_id"` }
type IncidentCountOptions ¶
type IncidentCountOptions struct { // The start of the date range you want to search. Since *time.Time `url:"since,omitempty"` // The end of the date range you want to search. Until *time.Time `url:"until,omitemtpy"` // When set to 'all', the 'since' and 'until' parameters and defaults are // ignored. Unse this to get all incidents since the account was created. DateRange string `url:"date_range,omitempty"` // Returns only the incidents in the passed status(es). Valid status // options are 'triggered', 'acknowledged' and 'resolved'. Status string `url:"status,omitemtpy"` // Returns only the incidents with the passes de-duplication key. IncidentKey string `url:"incidient_key,omitempty"` // Returns only the incidents associated with the passed service(s). // Expects one or more service IDs separated by commas. Service string `url:"service,omitempty"` // A comma-separated list of team IDs, specifying teams whose maintenance // windows will be returned. Teams string `url:"teams,omitempty"` // Returns only the incidents currently assigned to the passed user(s). // This expects one or more user IDs separated by commas. // // NOTE: When using the 'assigned_to_user' filter, you will only receive // incidents with statuses of 'triggered' or 'acknowledged', because // 'resolved' incidents are not assigned to any user. AssignedToUser string `url:"assigned_to_user,omitempty"` }
type IncidentCounts ¶
type IncidentEditOptions ¶
type IncidentEditOptions struct { // An array of incidents, including the parameters to update. Incidents []IncidentParameter `json:"incidents,omitempty"` // The user ID of the user making the request. RequesterID *string `json:"requester_id,omitempty"` }
type IncidentListOptions ¶
type IncidentListOptions struct { // The start of the date range you want to search. Since time.Time `url:"since,omitempty"` // The end of the date range you want to search. Until time.Time `url:"until,omitemtpy"` // When set to 'all', the 'since' and 'until' parameters and defaults are // ignored. Unse this to get all incidents since the account was created. DateRange string `url:"date_range,omitempty"` // Used to restrict the properties of each incident returned to a set of // pre-defined fields. If ommited, returned incidents have the majority // of fields present. Fields string `url:"fields,omitempty"` // Returns only the incidents in the passed status(es). Valid status // options are 'triggered', 'acknowledged' and 'resolved'. Status string `url:"status,omitemtpy"` // Returns only the incidents with the passes de-duplication key. IncidentKey string `url:"incidient_key,omitempty"` // Returns only the incidents associated with the passed service(s). // Expects one or more service IDs separated by commas. Service string `url:"service,omitempty"` // A comma-separated list of team IDs, specifying teams whose maintenance // windows will be returned. Teams string `url:"teams,omitempty"` // Returns only the incidents currently assigned to the passed user(s). // This expects one or more user IDs separated by commas. // // NOTE: When using the 'assigned_to_user' filter, you will only receive // incidents with statuses of 'triggered' or 'acknowledged', because // 'resolved' incidents are not assigned to any user. AssignedToUser string `url:"assigned_to_user,omitempty"` // A comma-separated list of urgencies to filter the incidents list. Defaults // to 'high,low'. Urgency string `url:"urgency,omitempty"` // Time zones in which dates in the result will be rendered. Defaults to // 'UTC'. TimeZone *TimeZone `url:"time_zone,omitempty"` // A comma-separated list of fields in which to sort the results, as well as // the direction (ascending/descending). // // Valid fields are 'incident_number', 'created_on', 'resolved_on' and // 'urgency'. SortBy string `url:"sort_by,omitempty"` ListOptions }
type IncidentParameter ¶
type IncidentParameter struct { // The ID of the incident. ID *string `json:"id,omitempty"` // The new status of the incident. Possible values are 'resolved' and // 'acknowledged'. Status *string `json:"status,omitempty"` // The ID of an escalation policy to delegate the incident to. EscalationPolicy *string `json:"escalation_policy,omitempty"` // Escalate the incident to this level in the escalation policy. EscalationLevel *int `json:"escalation_level,omitempty"` // A comma-separated list of user IDs to assign the incident to. AssignedToUser *string `json:"assigned_to_user,omitempty"` }
type IncidentReassignOptions ¶
type IncidentReassignOptions struct { // The user ID of the user making the request. RequesterID string `url:"requester_id"` // The ID of an escalation policy to delegate the incident to. EscalationPolicy *string `json:"escalation_policy,omitempty"` // Escalate the incident to this level in the escalation policy. EscalationLevel *int `json:"escalation_level,omitempty"` // A comma-separated list of user IDs to assign the incident to. AssignedToUser *string `json:"assigned_to_user,omitempty"` }
type IncidentResolveOptions ¶
type IncidentResolveOptions struct { // The user ID of the user making the request. RequesterID string `url:"requester_id"` }
type IncidentSnoozeOptions ¶
type IncidentSnoozeOptions struct { // The user ID of the user making the request. RequesterID string `url:"requester_id"` // The number of seconds to snooze the incident for. After this number of // seconds has elapsed, the incident will return to the 'triggered' state. Duration int `url:"duration"` }
type IncidentsService ¶
type IncidentsService struct {
// contains filtered or unexported fields
}
IncidentsService handles communication with the Incidents related methods of the PagerDuty API.
func (*IncidentsService) Acknowledge ¶
func (s *IncidentsService) Acknowledge(id string, opts *IncidentAcknowledgeOptions) (*Response, error)
Acknoledges an incident.
https://developer.pagerduty.com/documentation/rest/incidents/acknowledge
func (*IncidentsService) Count ¶
func (s *IncidentsService) Count(opts *IncidentCountOptions) (int, *Response, error)
Count returns a count of incidents matching the proviced options.
https://developer.pagerduty.com/documentation/rest/incidents/count
func (*IncidentsService) Edit ¶
func (s *IncidentsService) Edit(opts *IncidentEditOptions) ([]Incident, *Response, error)
Edit updates incidents using the provided options.
TODO: add support for returned errors.
https://developer.pagerduty.com/documentation/rest/incidents/update
func (*IncidentsService) Get ¶
func (s *IncidentsService) Get(id string) (*Incident, *Response, error)
Get fetches an incident by id.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/incidents/show
func (*IncidentsService) List ¶
func (s *IncidentsService) List(opts *IncidentListOptions) ([]Incident, *Response, error)
List incidents filtered by provided options.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/incidents/list
func (*IncidentsService) Reassign ¶
func (s *IncidentsService) Reassign(id string, opts *IncidentReassignOptions) (*Response, error)
Reassign an incident.
https://developer.pagerduty.com/documentation/rest/incidents/reassign
func (*IncidentsService) Resolve ¶
func (s *IncidentsService) Resolve(id string, opts *IncidentResolveOptions) (*Response, error)
Resolves an incident.
https://developer.pagerduty.com/documentation/rest/incidents/resolve
func (*IncidentsService) Snooze ¶
func (s *IncidentsService) Snooze(id string, opts *IncidentSnoozeOptions) (*Response, error)
Snooze an incident.
https://developer.pagerduty.com/documentation/rest/incidents/snooze
type LinkContext ¶
type LinkContext struct { // The type of context being attached to the incident. Possible values are // 'link' and 'image'. Type string `json:"type,omitempty"` // The link to either the incident being attached or image. Href string `json:"href,omitempty"` // Options information pertaining to the incident. Text string `json:"test,omitempty"` }
type ListOptions ¶
type ObjectAt ¶
type ObjectAt struct { At *time.Time `json:"at,omitempty"` Type *string `json:"-"` // original message object Object map[string]interface{} `json:"object,omitempty"` }
func (*ObjectAt) UnmarshalJSON ¶
type PendingAction ¶
type Response ¶
type Response struct { *http.Response Offset int `json:"offset,omitempty"` // The offset used in the execution of the query Limit int `json:"limit,omitempty"` // The limit used in the execution of the query Total int `json:"total,omitemtpy"` // The total number of records available }
Response is a PagerDuty API response. It wraps the standard http.Response returned from PagerDuty and provides convinient access to pagination response fields.
type Schedule ¶
type Schedule struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` TimeZone *TimeZone `json:"time_zone,omitempty"` Today *Date `json:"today,omitempty"` EscalationPolicies []EscalationPolicy `json:"escalation_policies,omitempty"` ScheduleLayers []ScheduleLayer `json:"schedule_layers,omitempty"` OverridesSubschedule *ScheduleLayer `json:"overrides_subschedule,omitempty"` FinalSchedule *ScheduleLayer `json:"final_schedule,omitempty"` }
Schedule represents a PagerDuty schedule.
type ScheduleLayer ¶
type ScheduleLayer struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Priority *int `json:"priority,omitempty"` Start *Date `json:"start,omitempty"` End *Date `json:"end,omitempty"` Users []User `json:"users,omitempty"` RenderedScheduleEntries []string `json:"rendered_schedule_entries,omitempty"` RestrictionType *string `json:"restriction_type,omitempty"` Restrictions []string `json:"restrictions,omitempty"` RenderedCoveragePercentage *int `json:"rendered_coverage_percentage,omitempty"` RotationTurnLengthSeconds *int `json:"rotation_turn_length_seconds,omitempty"` RotationVirtualStart *time.Time `json:"rotation_virtual_start,omitempty"` }
ScheduleLayer represents one of potentially many layers for a PagerDuty schedule.
type ScheduleListOptions ¶
type ScheduleListOptions struct { // Filters the result, showing only the schedules whose name matches the // query. Query string `url:"query,omitempty"` // The user id of the user making the request. This will be used to // generate the calendar private urls. This is only needed if you are // using token based authentication. RequesterID string `url:"requester_id,omitempty"` ListOptions }
type ScheduleUsersOptions ¶
type SchedulesService ¶
type SchedulesService struct {
// contains filtered or unexported fields
}
SchedulesService handles communication with the Schedules related methods of the PagerDuty API.
func (*SchedulesService) Get ¶
func (s *SchedulesService) Get(id string) (*Schedule, *Response, error)
Get fetches a schedule by id.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/schedules/show
func (*SchedulesService) List ¶
func (s *SchedulesService) List(opts *ScheduleListOptions) ([]Schedule, *Response, error)
List schedules filtered by provided options
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/schedules/list
func (*SchedulesService) Users ¶
func (s *SchedulesService) Users(id string, opts *ScheduleUsersOptions) ([]User, *Response, error)
Users fetches all the users on-call for a schdule by id.
https://developer.pagerduty.com/documentation/rest/schedules/users
type Service ¶
type Service struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` URL *string `json:"service_url,omitempty"` Key *string `json:"service_key,omitempty"` AutoResolveTimeout *int `json:"auto_resolve_timeout,omitempty"` AcknowledgementTimeout *int `json:"acknowledgement_timeout,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` Status *string `json:"status,omitempty"` LastIncidentTimestamp *time.Time `json:"last_incident_timestamp,omitempty"` EmailIncidentCreation *string `json:"email_incident_creation,omitempty"` IncidentCounts *IncidentCounts `json:"incident_counts,omitempty"` EmailFilterMode *string `json:"email_filter_mode,omitempty"` Type *string `json:"service_type,omitempty"` EscalationPolicy *EscalationPolicy `json:"escalation_policy,omitempty"` EmailFilters []EmailFilter `json:"email_filters,omitempty"` SeverityFilter *string `json:"severity_filter,omitempty"` }
Service represents a PagerDuty service.
type ServiceListOptions ¶
type ServiceListOptions struct { // A comma-separated list of team IDs, specifying teams whose maintenance // windows will be returned. Teams string `url:"teams,omitempty"` // A comma-separated list of extra fields to include in the response. Valid // fields include 'escalation_policy', 'email_filters', and 'teams'. Include []string `url:"include,omitempty"` // Time zone in which the dates in the result will be redered. Defaults to // account default time zone. TimeZone *TimeZone `url:"time_zone,omitempty"` // Filters the result, showing only services whose 'name' or 'service_key' // matches the query. Query string `url:"query,omitempty"` // Specifies the field to sort the response on, defaults to 'name'. Valid // fields are 'name' and 'id'. SortBy string `url:"sort_by,omitempty"` ListOptions }
type ServicesService ¶
type ServicesService struct {
// contains filtered or unexported fields
}
ServicesService handles communication with the Services related methods of the PagerDuty API.
func (*ServicesService) Get ¶
func (s *ServicesService) Get(id string, opts *GetServiceOptions) (*Service, *Response, error)
Get fetches a service by id and filtered by provided options.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/services/show
func (*ServicesService) List ¶
func (s *ServicesService) List(opts *ServiceListOptions) ([]Service, *Response, error)
List services filtered by provided options.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/services/list
type Team ¶
type Team struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` }
Team represents a PagerDuty team.
type TeamListOptions ¶
type TeamListOptions struct { // Filters the results, showing only teams whose names match the query. Query string `url:"query,omitempty"` ListOptions }
type TeamsService ¶
type TeamsService struct {
// contains filtered or unexported fields
}
TeamsService handles communication with the Teams related methods of the PagerDuty API.
func (*TeamsService) Create ¶
func (s *TeamsService) Create(team *Team) (*Team, *Response, error)
Create a team.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/teams/create
func (*TeamsService) Delete ¶
func (s *TeamsService) Delete(id string) (*Response, error)
Delete a team.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/teams/delete
func (*TeamsService) Edit ¶
func (s *TeamsService) Edit(team *Team) (*Team, *Response, error)
Edit a team.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/teams/update
func (*TeamsService) Get ¶
func (s *TeamsService) Get(id string) (*Team, *Response, error)
Get fetches a team by id.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/teams/show
func (*TeamsService) List ¶
func (s *TeamsService) List(opts *TeamListOptions) ([]Team, *Response, error)
List teams filtered by provided options.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/teams/list
type TimeZone ¶
TimeZone is a thin wrapper around time.Location to can marshal and unmarshal to the custom PagerDuty TimeZone type.
func (*TimeZone) MarshalJSON ¶
func (*TimeZone) UnmarshalJSON ¶
type TriggerSummary ¶
type TriggerSummary map[string]interface{}
type User ¶
type User struct { ID *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Email *string `json:"email,omitempty"` TimeZone *TimeZone `json:"time_zone,omitempty"` Color *string `json:"color,omitempty"` Role *string `json:"role,omitempty"` URL *string `json:"user_url,omitempty"` AvatarURL *string `json:"avatar_url,omitempty"` InvitationSent *bool `json:"invitation_sent,omitempty"` MarketingOptOut *bool `json:"marketing_opt_out,omitempt"` JobTitle *string `json:"job_title,omitempty"` }
User represents a PagerDuty user.
type UserListOptions ¶
type UserListOptions struct { // Filters the result, showing only the users whose names or email addresses // match the query Query string `url:"query,omitemtpy"` // Array of additional details to include. This API accepts `contact_method` // and `notification_rules`. Include []string `url:"include,omitempty"` ListOptions }
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
UsersService handles communication with the Users related methods of the PagerDuty API.
func (*UsersService) Get ¶
func (s *UsersService) Get(id string, opts *GetUserOptions) (*User, *Response, error)
Get fetches a user by id and filtered by provided options.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/users/show
func (*UsersService) List ¶
func (s *UsersService) List(opts *UserListOptions) ([]User, *Response, error)
List user filtered by provided options.
PagerDuty API docs: https://developer.pagerduty.com/documentation/rest/users/list
type WebhookIncident ¶
type WebhookIncident struct { ID *string `json:"id"` Number *int `json:"incident_number"` CreatedOn *time.Time `json:"created_on"` Status *string `json:"status"` URL *string `json:"html_url"` Key *string `json:"incident_key"` Service *Service `json:"service"` AssignedToUser *WebhookUser `json:"assigned_to_user"` ResolvedByUser *WebhookUser `json:"resolved_by_user"` TriggerSummaryData WebhookObject `json:"trigger_summary_data"` TriggerDetailsURL *string `json:"trigger_details_html_url"` LastStatusChangeOn *time.Time `json:"last_status_change_on"` LastStatusChangeBy *WebhookUser `json:"last_status_change_by"` }
type WebhookMessage ¶
type WebhookObject ¶
type WebhookObject map[string]interface{}
type WebhookService ¶
type WebhookUser ¶
type WebhooksService ¶
type WebhooksService struct {
// contains filtered or unexported fields
}
WebhooksService provides functionality to interact with messages received from the PagerDuty Webhooks API.
func (*WebhooksService) DecodeMessages ¶
func (s *WebhooksService) DecodeMessages(reader io.Reader) ([]WebhookMessage, error)