WWW::Giraffi::API::Service - Giraffi API Service Method Service Module
0.2_02
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... }
WWW::Giraffi::API::Service is Giraffi API Service Method Access Module
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
my $conditions = { 'name' => 'Test Monitoring' }; my $arrayref = $service->search($conditions);
# only conditions match [ { service => { warninginterval => 60, options => {}, warningretry => 2, status => 1, item_id => 5, id => 7, normalinterval => 120, servicetype => 'web_response_time' } } ]
Get One Service Setting
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' }
Get all regions related to an service, specified by an service id parameter.
my $service_id = 7; my $arrayref = $service->find_region($service_id);
[ { region => { id => 1, code => "JP" } } ]
Get all triggers related to an service, specified by an service id parameter.
my $service_id = 7; my $arrayref = $service->find_trigger($service_id);
[ { trigger => { axioninterval => 180, level => 0, options => { time => '3' }, triggertype => 'timeout', service_id => 9, id => 4 } } ]
Update Service Setting
my $service_id = 5; my $conditions = { status => 2 }; $service->update($service_id, $conditions);
Update regions related to an service, specified by an service id parameter.
my $service_id = 5; my $region_code = "JP"; $service->update_region($service_id, $region_code);
Delete Service Setting
my $service_id = 5; $service->delete($service_id);
Adds a new trigger to an service, specified by an service id parameter
my $service_id = 5; my $trigger_conditions = { triggertype => "timeout", axioninterval => 180, options => { time => "3" } }; my $ref = $service->add_trigger($service_id, $trigger_conditions);
{ trigger => { axioninterval => 180, level => 0, options => { time => '3' }, triggertype => 'timeout', service_id => 9, id => 4 } }
Deletes the specified trigger using the trigger id parameter from an service, specified by an service id parameter.
my $service_id = 5; my $trigger_id = 4; $service->remove_trigger($service_id, $trigger_id);
Akira Horimoto <emperor@gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::Giraffi::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Giraffi::API
CPAN shell
perl -MCPAN -e shell install WWW::Giraffi::API
For more information on module installation, please visit the detailed CPAN module installation guide.