Apache-BalancerManager

 view release on metacpan or  search on metacpan

lib/Apache/BalancerManager/Member.pm  view on Meta::CPAN

package Apache::BalancerManager::Member;
{
  $Apache::BalancerManager::Member::VERSION = '0.001002';
}

# ABSTRACT: ClientSide representation of Apache BalancerManager Member

use Moo;

has $_ => ( is => 'rw' ) for qw(
   load_factor
   lb_set
   route
   route_redirect
   status
);

has $_ => ( is => 'ro' ) for qw(
   times_elected
   location
);

has $_ => (
   is => 'ro',
   coerce => sub {$_[0] =~ s/\s//g; $_[0]}
) for qw(from to);

has manager => (
   is => 'ro',
   required => 1,
   weak_ref => 1,
   handles => {
      _balancer_name => 'name',
      _nonce         => 'nonce',
      _url           => 'url',
      _get           => '_get',
   },
);

sub disable { $_[0]->status(0) }
sub enable { $_[0]->status(1) }

sub update {
   my $self = shift;

   my $uri = URI->new($self->_url);
   $uri->query_form({
      lf    => $self->load_factor,
      ls    => $self->lb_set,
      wr    => $self->route,
      rr    => $self->route_redirect,
      dw    => ( $self->status ? 'Enable' : 'Disable' ),
      w     => $self->location,
      b     => $self->_balancer_name,
      nonce => $self->_nonce,
   });
   $self->_get($uri);
}

1;


__END__
=pod

=head1 NAME

Apache::BalancerManager::Member - ClientSide representation of Apache BalancerManager Member

=head1 ATTRIBUTES

=head2 load_factor

C<writeable>.  See
L<lbfactor|https://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html#requests>.

=head2 lb_set

C<writeable>.  See
L<lbstatus|https://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html#requests>.

=head2 route

C<writeable>.  See
L<route|https://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html#stickyness_implementation>

=head2 route_redirect

C<writeable>.  I'm not really sure what this is.

=head2 status

C<writeable>.  Boolean for whether or not the member is enabled

=head2 times_elected

C<not writeable>.  Number of times the member has been elected

=head2 location

C<not writeable>.  The full path of the member, for example,
C<http://127.0.0.1:5021>.

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.480 second using v1.00-cache-2.02-grep-82fe00e-cpan-1310916c57ae )