Categorygithub.com/unitytech/go-pagerduty
modulepackage
0.0.0-20190520104534-ac546379720a
Repository: https://github.com/unitytech/go-pagerduty.git
Documentation: pkg.go.dev

# README

GoDoc Go Report Card License

go-pagerduty

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

Installation

go get github.com/PagerDuty/go-pagerduty

Usage

CLI

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

---
authtoken: fooBar

Install

cd $GOPATH/github.com/PagerDuty/go-pagerduty
go build -o $GOPATH/bin/pd command/*

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)
	if eps, err := client.ListEscalationPolicies(opts); err != nil {
		panic(err)
	} else {
		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.

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

# Packages

No description provided by the author
No description provided by the author

# Functions

CreateEvent sends PagerDuty an event to trigger, acknowledge, or resolve a problem.
CreateEventWithHTTPClient sends PagerDuty an event to trigger, acknowledge, or resolve a problem.
DecodeWebhook decodes a webhook from a response object.
ManageEvent handles the trigger, acknowledge, and resolve methods for an event.
NewClient creates an API client.

# Structs

Acknowledgement is the data structure of an acknoledgement of an incident.
Addon is a third-party add-on to PagerDuty's UI.
No description provided by the author
APIListObject are the fields used to control pagination when listing objects.
APIObject represents generic api json response that is shared by most domain object (like escalation.
APIReference are the fields required to reference another API object.
No description provided by the author
Assignment is the data structure for an assignment of an incident.
Channel is the means by which the action was carried out.
Client wraps http client.
ContactMethod is a way of contacting the user.
Context are to be included with the trigger such as links to graphs or images.
CreateIncident is the structure POST'd to the incidents endpoint.
CreateIncidentOptions is the structure used when POSTing to the CreateIncident API endpoint.
EscalationPolicy is a collection of escalation rules.
EscalationRule is a rule for an escalation policy to trigger.
Event stores data for problem reporting, acknowledgement, and resolution.
EventResponse is the data returned from the CreateEvent API endpoint.
GetEscalationPolicyOptions is the data structure used when calling the GetEscalationPolicy API endpoint.
GetEscalationRuleOptions is the data structure used when calling the GetEscalationRule API endpoint.
GetIntegrationOptions is the data structure used when calling the GetIntegration API endpoint.
GetLogEntryOptions is the data structure used when calling the GetLogEntry API endpoint.
GetMaintenanceWindowOptions is the data structure used when calling the GetMaintenanceWindow API endpoint.
GetScheduleOptions is the data structure used when calling the GetSchedule API endpoint.
GetServiceOptions is the data structure used when calling the GetService API endpoint.
GetUserOptions is the data structure used when calling the GetUser API endpoint.
Incident is a normalized, de-duplicated event generated by a PagerDuty integration.
IncidentAlert is a alert for the specified incident.
IncidentDetail contains a representation of the incident associated with the action that caused this webhook message.
IncidentNote is a note for the specified incident.
IncidentUrgencyRule is the default urgency for new incidents.
IncidentUrgencyType are the incidents urgency during or outside support hours.
InlineModel represents when a scheduled action will occur.
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.
ListAbilityResponse is the response when calling the ListAbility API endpoint.
ListAddonOptions are the options available when calling the ListAddons API endpoint.
ListAddonResponse is the response when calling the ListAddons API endpoint.
ListEscalationPoliciesOptions is the data structure used when calling the ListEscalationPolicies API endpoint.
ListEscalationPoliciesResponse is the data structure returned from calling the ListEscalationPolicies API endpoint.
No description provided by the author
ListIncidentLogEntriesOptions is the structure used when passing parameters to the ListIncidentLogEntries API endpoint.
ListIncidentLogEntriesResponse is the response structure when calling the ListIncidentLogEntries API endpoint.
ListIncidentsOptions is the structure used when passing parameters to the ListIncident API endpoint.
ListIncidentsResponse is the response structure when calling the ListIncident API endpoint.
ListLogEntriesOptions is the data structure used when calling the ListLogEntry API endpoint.
ListLogEntryResponse is the response data when calling the ListLogEntry API endpoint.
ListMaintenanceWindowsOptions is the data structure used when calling the ListMaintenanceWindows API endpoint.
ListMaintenanceWindowsResponse is the data structur returned from calling the ListMaintenanceWindows API endpoint.
ListNotificationOptions is the data structure used when calling the ListNotifications API endpoint.
ListNotificationsResponse is the data structure returned from the ListNotifications API endpoint.
ListOnCallOptions is the data structure used when calling the ListOnCalls API endpoint.
ListOnCallsResponse is the data structure returned from calling the ListOnCalls API endpoint.
ListOnCallUsersOptions is the data structure used when calling the ListOnCallUsers API endpoint.
ListOverridesOptions is the data structure used when calling the ListOverrides API endpoint.
ListSchedulesOptions is the data structure used when calling the ListSchedules API endpoint.
ListSchedulesResponse is the data structure returned from calling the ListSchedules API endpoint.
ListServiceOptions is the data structure used when calling the ListServices API endpoint.
ListServiceResponse is the data structure returned from calling the ListServices API endpoint.
ListTeamOptions are the input parameters used when calling the ListTeams API endpoint.
ListTeamResponse is the structure used when calling the ListTeams API endpoint.
ListUsersOptions is the data structure used when calling the ListUsers API endpoint.
ListUsersResponse is the data structure returned from calling the ListUsers API endpoint.
ListVendorOptions is the data structure used when calling the ListVendors API endpoint.
ListVendorResponse is the data structure returned from calling the ListVendors API endpoint.
LogEntry is a list of all of the events that happened to an incident.
MaintenanceWindow is used to temporarily disable one or more services for a set period of time.
Notification is a message containing the details of the incident.
NotificationRule is a rule for notifying the user.
OnCall represents a contiguous unit of time for which a user will be on call for a given escalation policy and escalation rule.
Overrides are any schedule layers from the override layer.
PendingAction is the data structure for any pending actions on an incident.
PreviewScheduleOptions is the data structure used when calling the PreviewSchedule API endpoint.
No description provided by the author
PriorityProperty is a single priorty object returned from the Priorities endpoint.
RenderedScheduleEntry represents the computed set of schedule layer entries that put users on call for a schedule, and cannot be modified directly.
Restriction limits on-call responsibility for a layer to certain times of the day or week.
Schedule determines the time periods that users are on call.
ScheduledAction contains scheduled actions for the service.
ScheduleLayer is an entry that puts users on call for a schedule.
Service represents something you monitor (like a web service, email service, or database service).
SupportHours are the support hours for the service.
Team is a collection of users and escalation policies that represent a group of people within an organization.
UpdateScheduleOptions is the data structure used when calling the UpdateSchedule API endpoint.
User is a member of a PagerDuty account that has the ability to interact with incidents and other data on the account.
UserReference is a reference to an authorized PagerDuty user.
Event includes the incident/alert details.
Response is the json response body for an event.
Payload represents the individual event details for an event.
Vendor represents a specific type of integration.
WebhookPayload is a single message array for a webhook.

# Interfaces

HTTPClient is an interface which declares the functionality we need from an HTTP client.

# Type aliases

Agent is the actor who carried out the action.