GithubHelp home page GithubHelp logo

node-pagerduty's Introduction

pagerduty

A node.js client for PagerDuty.

Install

npm install pagerduty

Methods

constructor(options)

  • Required:
    • serviceKey - The GUID of one of your “Generic API” services. This is the “service key” listed on a Generic API’s service detail page.

create(options)

  • Required:
    • description - A short description of the problem that led to this trigger.
  • Optional:
    • details - An arbitrary JSON object containing any data you’d like included in the incident log.
    • incidentKey - Identifies the incident to which this trigger event should be applied.
    • callback - A Callback with two arguments (err, response)

acknowledge(options)

  • Required:
    • incidentKey - Identifies the incident to which this trigger event should be applied.
  • Optional:
    • details - An arbitrary JSON object containing any data you’d like included in the incident log.
    • description - Text that will appear in the incident’s log associated with this event.
    • callback - A Callback with two arguments (err, response)

resolve(options)

  • Required:
    • incidentKey - Identifies the incident to which this trigger event should be applied.
  • Optional:
    • details - An arbitrary JSON object containing any data you’d like included in the incident log.
    • description - Text that will appear in the incident’s log associated with this event.
    • callback - A Callback with two arguments (err, response)

Example response

{ 
  status: 'success',
  incident_key: '87fb80301f99012f961a1231381bc5dc',
  message: 'Event processed'
}

Usage

var pager, PagerDuty;

PagerDuty = require('pagerduty');

pager = new PagerDuty({
  serviceKey: '12345678901234567890123456789012' // required
});

pager.create({
  description: 'testError', // required
  details: {
    foo: 'bar'
  },
  callback: function(err, response) {
    if (err) throw err;

    pager.acknowledge({
      incidentKey: response.incident_key, // required
      description: 'Got the test error!',
      details: {
        foo: 'bar'
      },
      callback: function(err, response) {
        if (err) throw err;

        pager.resolve({
          incidentKey: response.incident_key, // required
          description: 'Resolved the test error!',
          details: {
            foo: 'bar'
          },
          callback: function(err, response) {
            if (err) throw err;
          }
        });
      }
    });
  }
});

License

Licensed under the MIT license.

node-pagerduty's People

Contributors

chrishenry avatar jtblin avatar skomski avatar wryun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.