AnyEvent-KVStore-Etcd
view release on metacpan or search on metacpan
lib/AnyEvent/KVStore/Etcd.pm view on Meta::CPAN
has ssl => (is => 'ro', isa => Bool, default => 0);
=head2 user Str
Username for authentication. Does not authenticate if not set.
=cut
has user => (is => 'ro', isa => Str);
=head2 password Str
Password for authentication.
=cut
has password => (is => 'ro', isa => Str);
=head2 cnx Net::Etcd
This is the active connection to the etcd database.
=cut
# $self->_slice returns a hashref with the properties requested.
# This relies on the fact that Moo(se) objects are blessed hashrefs.
sub _slice {
my $self = shift;
my @vars = @_;
return { %{$self}{@vars} };
}
sub _etcd_connect {
my $self = shift;
my $cnx = Net::Etcd->new($self->_slice('host', 'port', 'ssl'));
die 'Could not create new etcd connection' unless $cnx;
$cnx->auth($self->_slice('user', 'password'))->authenticate if $self->user;
return $cnx;
}
has cnx => (is => 'ro', builder => '_etcd_connect', lazy => 1);
=head1 METHODS
=head2 read
( run in 0.447 second using v1.01-cache-2.11-cpan-49f99fa48dc )