Healthchecks

 view release on metacpan or  search on metacpan

lib/Healthchecks.pm  view on Meta::CPAN


#################### subroutine header begin ####################

=head3 get_check

 Usage     : $hc->get_check('uuid_or_unique_key');
 Purpose   : Get details of a check
 Returns   : A hash, representation of a single check. 
 Argument  : Accepts either check's UUID or the unique_key (a field derived from UUID and returned by API responses when using the read-only API key) as argument.
             MANDATORY
 See       : https://healthchecks.io/docs/api/#get-check

=cut

#################### subroutine header end ####################

sub get_check($c, $uuid) {
    return $c->_execute({
        api => 'v1/checks/'.$uuid
    });
}

#################### subroutine header begin ####################

=head3 create_check

 Usage     : $hc->({name => 'foobarbaz'});
 Purpose   : Create a check
 Returns   : A hash, representation of a single check. 
 Argument  : A hash of the check’s options (see API documentation)
             OPTIONAL
 See       : https://healthchecks.io/docs/api/#create-check

=cut

#################### subroutine header end ####################

sub create_check($c, $data){
    return $c->_execute({
        api    => 'v1/checks/',
        method => 'post',
        data   => $data
    });
}

#################### subroutine header begin ####################

=head3 update_check

 Usage     : $hc->update_check('uuid', { name => 'quux' });
 Purpose   : Update the configuration of a check
 Returns   : A hash, representation of a single check.
 Argument  : The check's UUID (MANDATORY) and a hash of the check’s options (see API documentation)
             OPTIONAL
 See       : https://healthchecks.io/docs/api/#update-check

=cut

#################### subroutine header end ####################

sub update_check($c, $uuid, $data){
    return $c->_execute({
        api    => 'v1/checks/'.$uuid,
        method => 'post',
        data   => $data
    });
}

#################### subroutine header begin ####################

=head3 pause_check

 Usage     : $hc->pause_check('uuid');
 Purpose   : Disables monitoring for a check without removing it. The check goes into a "paused" state. You can resume monitoring of the check by pinging it.
 Returns   : A boolean : true if the check is paused, false otherwise.
 Argument  : The check's UUID
             MANDATORY
 See       : https://healthchecks.io/docs/api/#pause-check

=cut

#################### subroutine header end ####################

sub pause_check($c, $uuid){
    return $c->_execute({
        api    => 'v1/checks/'.$uuid.'/pause',
        method => 'post',
        key    => 'status'
    }) eq 'paused';
}

#################### subroutine header begin ####################

=head3 delete_check

 Usage     : $hc->delete_check('uuid');
 Purpose   : Permanently deletes the check from the user's account.
 Returns   : A boolean : true if the check has been successfully deleted, false otherwise.
 Argument  : The check's UUID
             MANDATORY
 See       : https://healthchecks.io/docs/api/#delete-check

=cut

#################### subroutine header end ####################

sub delete_check($c, $uuid){
    return $c->_execute({
        api     => 'v1/checks/'.$uuid,
        method  => 'delete',
        success => 1
    });
}

#################### subroutine header begin ####################

=head3 get_check_pings

 Usage     : $hc->get_check_pings('uuid');
 Purpose   : Get the pings of a check.
 Returns   : An array of pings this check has received.



( run in 0.905 second using v1.01-cache-2.11-cpan-bbe5e583499 )