File Coverage

blib/lib/Net/Fastly/Director.pm
Criterion Covered Total %
statement 6 14 42.8
branch n/a
condition n/a
subroutine 2 4 50.0
pod 2 2 100.0
total 10 20 50.0


line stmt bran cond sub pod time code
1             package Net::Fastly::Director;
2              
3 4     4   16 use strict;
  4         3  
  4         125  
4 4     4   14 use base qw(Net::Fastly::BelongsToServiceAndVersion);
  4         4  
  4         600  
5              
6             Net::Fastly::Director->mk_accessors(qw(service_id name comment type capacity retries quorum comment));
7              
8             =head1 NAME
9              
10             Net::Fastly::Director - Representation of an a logical collection of backends - for example all the asset servers in one data center
11              
12             =head1 ACCESSORS
13              
14             =head2 service
15              
16             The id of the service this belongs to.
17              
18             =head2 version
19              
20             The number of the version this belongs to.
21              
22             =head2 name
23              
24             The domain name of this domain
25              
26             =head2 type
27              
28             what kind of Load Balancer group (currently always 1 meaning random)
29              
30             =head2 retries
31              
32             how many backends to search if it fails (default 5)
33              
34             =head2 quorum
35              
36             the percentage of capacity that needs to be up for a director to be considered up (default 75)
37              
38             =head2 comment
39              
40             a free form comment field
41              
42             =cut
43              
44             =head2 add_backend
45              
46             Add a Backend to a Director.
47              
48             Returns true on success and false on failure.
49              
50             =cut
51             sub add_backend {
52 0     0 1   my $self = shift;
53 0           my $backend = shift;
54 0           my $hash = $self->_fetcher->client->_post($self->_put_path($self)."/backend/".$backend->name);
55 0           return !!(keys %$hash);
56             }
57              
58             =head2 delete_backend
59              
60             Delete a Backend from a Director
61              
62             Returns true on success and false on failure.
63              
64             =cut
65             sub delete_backend {
66 0     0 1   my $self = shift;
67 0           my $backend = shift;
68 0           my $hash = $self->_fetcher->client->_delete($self->_put_path($self)."/backend/".$backend->name);
69 0           return !!(keys %$hash);
70             }
71              
72             1;