NAME

WWW::Giraffi::API::Service - Giraffi API Service Method Service Module

VERSION

0.13_03

SYNOPSIS

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

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

DESCRIPTION

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

METHOD

all

Get All Service Setting

Example:

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

Return Array Reference:

[
  {
    service => {
        warninginterval => 60,
        options         => {},
        warningretry    => 2,
        status          => 1,
        item_id         => 5,
        id              => 7,
        normalinterval  => 120,
        servicetype     => 'web_response_time'
    }
  }
]

Get Service Setting

Example:

my $conditions = { 'name' => 'Test Monitoring' };
my $arrayref = $service->search($conditions);

Return Array Reference:

# only conditions match
[
  {
    service => {
        warninginterval => 60,
        options         => {},
        warningretry    => 2,
        status          => 1,
        item_id         => 5,
        id              => 7,
        normalinterval  => 120,
        servicetype     => 'web_response_time'
    }
  }
]

find

Get One Service Setting

Example:

my $service_id = 1;
my $ref = $service->find($service_id);

Return Reference:

{
   service => {
       warninginterval => 60,
       options         => {},
       warningretry    => 2,
       status          => 1,
       item_id         => 5,
       id              => 7,
       normalinterval  => 120,
       servicetype     => 'web_response_time'
   }

find_region

Get all regions related to an service, specified by an service id parameter.

Example:

my $service_id = 7;
my $arrayref = $service->find_region($service_id);

Return Array Reference:

  [
   {
      region => {
          id   => 1,
		  code => "JP"
      }
   }
 ]

find_trigger

Get all triggers related to an service, specified by an service id parameter.

Example:

my $service_id = 7;
my $arrayref = $service->find_trigger($service_id);

Return Array Reference:

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

update

Update Service Setting

Example:

my $service_id = 5;
my $conditions = { status => 2 };
$service->update($service_id, $conditions);

update_region

Update regions related to an service, specified by an service id parameter.

Example:

my $service_id = 5;
my $region_code = "JP";
$service->update_region($service_id, $region_code);

destroy

Delete Service Setting

Example:

my $service_id = 5;
$service->delete($service_id);

add_trigger

Adds a new trigger to an service, specified by an service id parameter

Example:

my $service_id = 5;
my $trigger_conditions = {
    triggertype   => "timeout",
    axioninterval => 180,
    options       => { time => "3" }
};
my $ref = $service->add_trigger($service_id, $trigger_conditions);

Return Reference:

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

remove_trigger

Deletes the specified trigger using the trigger id parameter from an service, specified by an service id parameter.

Example:

my $service_id = 5;
my $trigger_id = 4;
$service->remove_trigger($service_id, $trigger_id);

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.