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.002000';
# 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',
      _post          => '_post',
   },
);

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

sub update {
   my $self = shift;

   my $uri = URI->new($self->_url);
   my $form = {
      w_status_D => ( $self->status ? 0 : 1 ),
      w_status_I => 0,
      w_status_N => 0,
      w_status_H => 0,
      w_status_R => 0,
      w_status_S => 0,
      w_lf    => $self->load_factor,
      w_ls    => $self->lb_set,
      w_wr    => $self->route,
      w_rr    => $self->route_redirect,
      w     => $self->location,
      b     => $self->_balancer_name,
      nonce => $self->_nonce,
   };
   $self->_post($uri, $form);
}

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



( run in 0.421 second using v1.01-cache-2.11-cpan-496ff517765 )