App-RoboBot

 view release on metacpan or  search on metacpan

lib/App/RoboBot/Plugin/API/PagerDuty.pm  view on Meta::CPAN

package App::RoboBot::Plugin::API::PagerDuty;
$App::RoboBot::Plugin::API::PagerDuty::VERSION = '4.004';
use v5.20;

use namespace::autoclean;

use Moose;
use MooseX::SetOnce;

use AnyEvent;
use Data::Dumper;
use DateTime;
use HTTP::Request;
use JSON;
use LWP::UserAgent;
use LWP::Protocol::https;
use URI;

use App::RoboBot::Channel;
use App::RoboBot::Response;

extends 'App::RoboBot::Plugin';

=head1 api.pagerduty

Exports functions for interacting with PagerDuty API, and subscribing to alarm
notices.

API Keys for Pagerduty are currently part of the on-disk configuration file for
the bot, and as such there are no functions for adding/removing/changing oncall
groups or adding new Pagerduty accounts without restarting the bot. This will
likely change in a future release to make things easier for users to manage.

=cut

has '+name' => (
    default => 'API::PagerDuty',
);

has '+description' => (
    default => 'Exports functions for interacting with PagerDuty API, and subscribing to alarm notices.',
);

=head2 pagerduty-groups

=head3 Description

Displays the list of PagerDuty contact groups which currently have API keys
configured.

=head2 pagerduty-oncall

=head3 Description

Displays on-call information for the named group, based on the current schedule
in PagerDuty. All remaining arguments after the group name, if provided, will
be echoed back.

Calls to the on-call scheduling API at Pagerduty are cached briefly (for a few
minutes per oncall group) to prevent flooding their servers should anyone in
the channel call this function repeatedly.

=head3 Usage

<group> [<message>]



( run in 1.114 second using v1.01-cache-2.11-cpan-39bf76dae61 )