victorops

package module
v0.0.0-...-aafa34b Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2017 License: MIT Imports: 7 Imported by: 2

README

go-victorops

Unofficial VictorOps API for Golang

Usage

var cli = victorops.New("login", "api-id", "api-key")
incidents, _ := cli.Incidents()
fmt.Println(incidents)

Current state

On-call
  • GET /api-public/v1/user/{user}/oncall/schedule
  • GET /api-public/v1/team/{team}/oncall/schedule
  • PATCH /api-public/v1/team/{team}/oncall/user
Incidents
  • GET /api-public/v1/incidents
  • POST /api-public/v1/incidents
  • PATCH /api-public/v1/incidents/ack
  • PATCH /api-public/v1/incidents/resolve
  • PATCH /api-public/v1/incidents/byUser/ack
  • PATCH /api-public/v1/incidents/byUser/resolve
Alerts
  • GET /api-public/v1/alerts/{uuid}
Reporting
  • GET /api-reporting/v1/team/{team}/oncall/log
  • GET /api-reporting/v1/incidents
  • GET /api-reporting/v2/incidents
Users
  • GET /api-public/v1/user
  • POST /api-public/v1/user
  • DELETE /api-public/v1/user/{user}
  • GET /api-public/v1/user/{user}
  • PUT /api-public/v1/user/{user}
User Contact Methods
  • GET /api-public/v1/user/{user}/contact-methods
  • GET /api-public/v1/user/{user}/contact-methods/devices
  • DELETE /api-public/v1/user/{user}/contact-methods/devices/{contactId}
  • GET /api-public/v1/user/{user}/contact-methods/devices/{contactId}
  • PUT /api-public/v1/user/{user}/contact-methods/devices/{contactId}
  • GET /api-public/v1/user/{user}/contact-methods/emails
  • POST /api-public/v1/user/{user}/contact-methods/emails
  • DELETE /api-public/v1/user/{user}/contact-methods/emails/{contactId}
  • GET /api-public/v1/user/{user}/contact-methods/emails/{contactId}
  • PUT /api-public/v1/user/{user}/contact-methods/emails/{contactId}
  • GET /api-public/v1/user/{user}/contact-methods/phones
  • POST /api-public/v1/user/{user}/contact-methods/phones
  • DELETE /api-public/v1/user/{user}/contact-methods/phones/{contactId}
  • GET /api-public/v1/user/{user}/contact-methods/phones/{contactId}
  • PUT /api-public/v1/user/{user}/contact-methods/phones/{contactId}
User Paging Policies
  • GET /api-public/v1/user/{user}/policies
Routing keys
  • GET /api-public/v1/org/routing-keys
Teams
  • GET /api-public/v1/team
  • POST /api-public/v1/team
  • DELETE /api-public/v1/team/{team}
  • GET /api-public/v1/team/{team}
  • PUT /api-public/v1/team/{team}
  • GET /api-public/v1/team/{team}/members
  • POST /api-public/v1/team/{team}/members
  • DELETE /api-public/v1/team/{team}/members/{user}

F.A.Q.

  • Will all the endpoints be implemented? Dunno! I implemented first the endpoints I needed for victorops-notifier

Documentation

Overview

Package victorops provides a Go client for the VictorOps API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*http.Client
	User, ID, Key string
}

Client for the VictorOps API

func New

func New(user, apiID, apiKey string) *Client

New VictorOps client for the given API id and key

func (*Client) Ack

func (c *Client) Ack(message string, incidentIDs ...string) ([]IncidentStateResult, error)

Ack one or more incidents

func (*Client) CreateIncident

func (c *Client) CreateIncident(summary, details string, targets []Target) (incident CreatedIncident, err error)

CreateIncident Create a new incident.

func (*Client) Incidents

func (c *Client) Incidents() (incidents []Incident, err error)

Incidents get a list of the currently open, acknowledged and recently resolved incidents

func (*Client) Resolve

func (c *Client) Resolve(message string, incidentIDs ...string) ([]IncidentStateResult, error)

Resolve one or more incidents

type CreatedIncident

type CreatedIncident struct {
	Number string `json:"incidentNumber,ommitempty"`
	Error  string `json:"error,ommitempty"`
}

CreatedIncident is an incident that was just created

type Incident

type Incident struct {
	AlertCount        int          `json:",omitempty"`
	CurrentPhase      string       `json:",omitempty"`
	EntityDisplayName string       `json:",omitempty"`
	EntityID          string       `json:",omitempty"`
	EntityState       string       `json:",omitempty"`
	EntityType        string       `json:",omitempty"`
	Host              string       `json:",omitempty"`
	IncidentNumber    string       `json:",omitempty"`
	LastAlertID       string       `json:",omitempty"`
	LastAlertTime     time.Time    `json:",omitempty"`
	Service           string       `json:",omitempty"`
	StartTime         time.Time    `json:",omitempty"`
	PagedTeams        []string     `json:",omitempty"`
	PagedUsers        []string     `json:",omitempty"`
	Transitions       []Transition `json:",omitempty"`
}

Incident represents an incident on victorops

type IncidentStateResult

type IncidentStateResult struct {
	Number   string `json:"incidentNumber,ommitempty"`
	ID       string `json:"entityId,ommitempty"`
	Accepted bool   `json:"cmdAccepted"`
	Message  string `json:"message,ommitempty"`
}

IncidentStateResult represents a ACK or Resolve event on an incident

type Target

type Target struct {
	Type string `json:"type"`
	Slug string `json:"slug"`
}

Target User or EscalationPolicy

type Transition

type Transition struct {
	Name     string    `json:",omitempty"`
	At       time.Time `json:",omitempty"`
	Message  string    `json:",omitempty"`
	By       string    `json:",omitempty"`
	Manually bool
	AlertID  string `json:"alertId,omitempty"`
	AlertURL string `json:"alertUrl,omitempty"`
}

Transition represents a state changes of an incident

Jump to

Keyboard shortcuts

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