Etcd3
view release on metacpan or search on metacpan
lib/Etcd3.pm view on Meta::CPAN
use utf8;
package Etcd3;
# ABSTRACT: [depricated] Please see Net::Etcd.
use strict;
use warnings;
use Moo;
use JSON;
use MIME::Base64;
use Etcd3::Auth;
use Etcd3::Config;
use Etcd3::Watch;
use Etcd3::Lease;
use Etcd3::User;
use Types::Standard qw(Str Int Bool HashRef);
with('Etcd3::KV');
use namespace::clean;
=encoding utf8
=head1 NAME
Etcd3
=cut
our $VERSION = '0.007';
=head1 SYNOPSIS
Etcd v3.1.0 or greater is required. To use the v3 API make sure to set environment
variable ETCDCTL_API=3. Precompiled binaries can be downloaded at https://github.com/coreos/etcd/releases.
$etcd = Etcd3->new(); # host: 127.0.0.1 port: 2379
$etcd = Etcd3->new({ host => $host, port => $port, ssl => 1 });
# put key
$result = $etcd->put({ key =>'foo1', value => 'bar' });
# get single key
$key = $etcd->range({ key =>'test0' });
# return single key value or the first in a list.
$key->get_value
# get range of keys
$range = $etcd->range({ key =>'test0', range_end => 'test100' });
# return array { key => value } pairs from range request.
my @users = $range->all
# watch key range, streaming.
$watch = $etcd->watch( { key => 'foo', range_end => 'fop'}, sub {
my ($result) = @_;
print STDERR Dumper($result);
})->create;
# create/grant 20 second lease
$etcd->lease( { ID => 7587821338341002662, TTL => 20 } )->grant;
# attach lease to put
$etcd->put( { key => 'foo2', value => 'bar2', lease => 7587821338341002662 } );
=head1 DESCRIPTION
This module has been superseded by L<Net::Etcd> and will be removed from CPAN on June 29th 2017
=head1 ACCESSORS
=head2 host
=cut
has host => (
is => 'ro',
isa => Str,
default => '127.0.0.1'
);
=head2 port
=cut
has port => (
is => 'ro',
isa => Int,
default => '2379'
);
=head2 username
=cut
has name => (
is => 'ro',
isa => Str
);
=head2 password
=cut
has password => (
is => 'ro',
isa => Str
);
=head2 ssl
=cut
( run in 0.572 second using v1.01-cache-2.11-cpan-140bd7fdf52 )