NAME

WWW::Giraffi::API::Trigger - Giraffi API Trigger Method Trigger Module

VERSION

0.2_02

SYNOPSIS

use strict;
use warnings;
use WWW::Giraffi::API;

my $apikey = "ilovenirvana_ilovekurtcobain";
my $g = WWW::Giraffi::API->new(apikey => $apikey);
# get all trigger data
my $arrayref = $g->trigger->all;
foreach $ref(@{$arrayref}) {
    ## anything to do...
}

DESCRIPTION

WWW::Giraffi::API::Trigger is Giraffi API Trigger Method Access Module

METHOD

all

Get All Trigger Setting

Example:

$ create trigger object
my $trigger = $g->trigger;
my $arrayref = $trigger->all;

Return Array Reference:

[
  {
    trigger => {
         axioninterval => 180,
         level => 0,
         options => { time' => 3 },
         triggertype => 'timeout',
         service_id => 9,
         id => 5
    }
  }
]

Get Trigger Setting

Example:

my $conditions = { 'triggertype' => 'timeout' };
my $arrayref = $trigger->search($conditions);

Return Array Reference:

# only conditions match
[
  {
    trigger => {
         axioninterval => 180,
         level => 0,
         options => { time' => 3 },
         triggertype => 'timeout',
         service_id => 9,
         id => 5
    }
  }
]

find

Get One Trigger Setting

Example:

my $trigger_id = 1;
my $ref = $trigger->find($trigger_id);

Return Reference:

{
  trigger => {
       axioninterval => 180,
       level => 0,
       options => { time' => 3 },
       triggertype => 'timeout',
       service_id => 9,
       id => 5
  }
}

find_axion

Get all axions related to an trigger, specified by an trigger id parameter.

Example:

my $trigger_id = 5;
my $arrayref = $service->find_axion($trigger_id);

Return Array Reference:

[
  {
    axion => {
        options => {},
        name => 'Aborted Alert',
        axiontype => 'messaging',
        user_id => 16,
        id => 4
      }
  }
] 

exec_axion

Execute axion related to an trigger, specified by an trigger id parameter.

Example:

$trigger_id = 5;
$trigger->exec_axion($trigger_id);

update

Update Trigger Setting

Example:

my $trigger_id = 5;
my $conditions = { options => { timeout => 10 } };
$trigger->update($trigger_id, $conditions);

update_axion

Update the specified axion using the axion id/axion kind parameter from an trigger, specified by an trigger id parameter.

Example:

my $trigger_id = 5;
my $axion_id = 1;
my $axion_kind = "problem"; # problem or recovery
$service->update_axion($trigger_id, $axion_id, $axion_kind);

destroy

Delete Trigger Setting

Example:

my $trigger_id = 5;
$trigger->delete($trigger_id);

remove_axion

Deletes the specified axion using the axion id/axion kind parameter from an trigger, specified by an trigger id parameter.

Example:

my $trigger_id = 5;
my $axion_id = 1;
my $axion_kind = "problem"; # problem or recovery
$service->remove_trigger($trigger_id, $axion_id, $axion_kind);

AUTHOR

Akira Horimoto <emperor@gmail.com>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.