SYNOPSIS
use MYDan::Oncall::Policy;
MYDan::Oncall::Policy->new( $conf )->dump( $cache );
my $policy = MYDan::Oncall::Policy->load( $cache );
my $now = time;
my $level = 2;
$policy->set( $now - 86400, $now + 86400 );
my $who = $policy->get( $now, $level );
my %list = $policy->list( $level );
CONFIGURATION
A YAML file that contains a stream of site definitions, each a HASH with the following keys:
required:
pivot: a date expression, for rotation
queue: a list of items to rotate through
optional:
site: default '', name of site
period: default 1
timezone: default 'local'
duration: default '00:00 ~ 23:59'
day: days of coverage, default all
level: levels of coverage, default all
reverse: default 0, reverse escalation order if 1
Coverage is processed in sequential order until met or defaulted to the last site ( or in reverse order, and default to the first site if 'reverse' is set )
Hence duration, level, and day do not apply to the default site.
example:
---
site: cn
pivot: 2017.06.10
queue:
- user1
- user2
- user3
---
site: us
pivot: 2017.06.11 20:00
timezone: America/Los_Angeles
duration: '19:10 ~ 7:20'
period: 7
level: [ 1, 2 ]
day: [ 1, 2, 3, 4, 5 ]
queue:
- usr1
- usr2
- usr3
METHODS
load( $path )
Loads object from $path
dump( $path )
Dumps object to $path
set( $begin, $end )
Sets the scope
get( $time, $level )
Returns the event at $time for $level
list( $level )
Returns a HASH of events indexed by time for $level