Skip to content

Commit

Permalink
Update README and Changes in preparation for release. (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
hexfusion authored Aug 30, 2017
1 parent f4fd0cb commit 7486783
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 23 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Revision history for Net::Etcd

0.014
[ BUG FIX ]
* Resolved bug which prevented range delete transaction from completing. Closed via GH #25 Thanks Ananth Kavuri!

0.013
[ ENHANCEMENTS ]
* Add Net::Etcd::Auth::RolePermission class allowing roles to be defined by key/range.
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ lib/Net/Etcd/Maintenance.pm
lib/Net/Etcd/Role/Actions.pm
lib/Net/Etcd/KV.pm
lib/Net/Etcd/KV/Compare.pm
lib/Net/Etcd/KV/DeleteRange.pm
lib/Net/Etcd/KV/Op.pm
lib/Net/Etcd/KV/Put.pm
lib/Net/Etcd/KV/Range.pm
Expand Down
32 changes: 27 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ SYNOPSIS
# return array { key => value } pairs from range request.
my @users = $range->all

# delete single key
$etcd->deleterange({ key => 'test0' });

# watch key range, streaming.
$watch = $etcd->watch( { key => 'foo', range_end => 'fop'}, sub {
my ($result) = @_;
Expand All @@ -39,7 +42,10 @@ SYNOPSIS
$etcd->user( { name => 'samba', password => 'foo' } )->add;

# add new user role
$role = $etcd->role( { name => 'myrole' } )->add;
$role = $etcd->role( { name => 'myrole' } )->add;

# grant read permission for the foo key to myrole
$etcd->role_perm( { name => 'myrole', key => 'foo', permType => 'READWRITE' } )->grant;

# grant role
$etcd->user_role( { user => 'samba', role => 'myrole' } )->grant;
Expand Down Expand Up @@ -86,6 +92,12 @@ PUBLIC METHODS

$etcd->role({ role => 'foo' });

role_perm
See Net::Etcd::Auth::RolePermission

Grants or revoke permission of a specified key or range to a specified
role.

user_role
See Net::Etcd::User::Role

Expand All @@ -95,8 +107,8 @@ PUBLIC METHODS
See Net::Etcd::Auth

$etcd->auth({ name => 'samba', password => 'foo' })->authenticate;
$etcd->auth()->enable;
$etcd->auth()->disable
$etcd->auth()->enable;
$etcd->auth()->disable

lease
See Net::Etcd::Lease
Expand All @@ -118,6 +130,11 @@ PUBLIC METHODS

$etcd->put({ key =>'foo1', value => 'bar' });

deleterange
See Net::Etcd::KV::DeleteRange

$etcd->deleterange({ key=>'test0' });

range
See Net::Etcd::KV::Range

Expand All @@ -132,7 +149,7 @@ PUBLIC METHODS
See Net::Etcd::KV::Op

$etcd->op({ request_put => $put });
$etcd->op({ request_delete_range => $range });
$etcd->op({ request_delete_range => $range });

compare
See Net::Etcd::KV::Compare
Expand All @@ -144,7 +161,10 @@ PUBLIC METHODS
Initialize configuration checks to see it etcd is installed locally.

AUTHOR
Sam Batschelet, <sbatschelet at mac.com>
Sam Batschelet (hexfusion)

CONTRIBUTORS
Ananth Kavuri

ACKNOWLEDGEMENTS
The etcd <https://github.com/coreos/etcd> developers and community.
Expand All @@ -155,6 +175,8 @@ CAVEATS
<https://github.com/coreos/etcd/blob/master/Documentation/dev-guide/api_
reference_v3.md> for latest details.

Authentication provided by this module will only work with etcd v3.3.0+

LICENSE AND COPYRIGHT
Copyright 2017 Sam Batschelet (hexfusion).

Expand Down
38 changes: 29 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Net::Etcd - etcd v3 REST API.
# return array { key => value } pairs from range request.
my @users = $range->all

# delete single key
$etcd->deleterange({ key => 'test0' });

# watch key range, streaming.
$watch = $etcd->watch( { key => 'foo', range_end => 'fop'}, sub {
my ($result) = @_;
Expand All @@ -43,7 +46,10 @@ Net::Etcd - etcd v3 REST API.
$etcd->user( { name => 'samba', password => 'foo' } )->add;

# add new user role
$role = $etcd->role( { name => 'myrole' } )->add;
$role = $etcd->role( { name => 'myrole' } )->add;

# grant read permission for the foo key to myrole
$etcd->role_perm( { name => 'myrole', key => 'foo', permType => 'READWRITE' } )->grant;

# grant role
$etcd->user_role( { user => 'samba', role => 'myrole' } )->grant;
Expand Down Expand Up @@ -101,6 +107,12 @@ See [Net::Etcd::Auth::Role](https://metacpan.org/pod/Net::Etcd::Auth::Role)

$etcd->role({ role => 'foo' });

## role\_perm

See [Net::Etcd::Auth::RolePermission](https://metacpan.org/pod/Net::Etcd::Auth::RolePermission)

Grants or revoke permission of a specified key or range to a specified role.

## user\_role

See [Net::Etcd::User::Role](https://metacpan.org/pod/Net::Etcd::User::Role)
Expand All @@ -112,8 +124,8 @@ See [Net::Etcd::User::Role](https://metacpan.org/pod/Net::Etcd::User::Role)
See [Net::Etcd::Auth](https://metacpan.org/pod/Net::Etcd::Auth)

$etcd->auth({ name => 'samba', password => 'foo' })->authenticate;
$etcd->auth()->enable;
$etcd->auth()->disable
$etcd->auth()->enable;
$etcd->auth()->disable

## lease

Expand All @@ -139,6 +151,12 @@ See [Net::Etcd::KV::Put](https://metacpan.org/pod/Net::Etcd::KV::Put)

$etcd->put({ key =>'foo1', value => 'bar' });

## deleterange

See [Net::Etcd::KV::DeleteRange](https://metacpan.org/pod/Net::Etcd::KV::DeleteRange)

$etcd->deleterange({ key=>'test0' });

## range

See [Net::Etcd::KV::Range](https://metacpan.org/pod/Net::Etcd::KV::Range)
Expand All @@ -156,7 +174,7 @@ See [Net::Etcd::KV::Txn](https://metacpan.org/pod/Net::Etcd::KV::Txn)
See [Net::Etcd::KV::Op](https://metacpan.org/pod/Net::Etcd::KV::Op)

$etcd->op({ request_put => $put });
$etcd->op({ request_delete_range => $range });
$etcd->op({ request_delete_range => $range });

## compare

Expand All @@ -171,22 +189,24 @@ Initialize configuration checks to see it etcd is installed locally.

# AUTHOR

Sam Batschelet, &lt;sbatschelet at mac.com>
Sam Batschelet (hexfusion)

# CONTRIBUTORS

Ananth Kavuri

# ACKNOWLEDGEMENTS

The [etcd](https://github.com/coreos/etcd) developers and community.

# CAVEATS

Authentication will not be available until etcd release 3.2.1. For testing puposes you can use my pre-release.

[v3.2.0_plus_git](https://github.com/hexfusion/etcd/releases/tag/v3.2.0_plus_git)

The [etcd](https://github.com/coreos/etcd) v3 API is in heavy development and can change at anytime please see
[api\_reference\_v3](https://github.com/coreos/etcd/blob/master/Documentation/dev-guide/api_reference_v3.md)
for latest details.

Authentication provided by this module will only work with etcd v3.3.0+

# LICENSE AND COPYRIGHT

Copyright 2017 Sam Batschelet (hexfusion).
Expand Down
22 changes: 14 additions & 8 deletions lib/Net/Etcd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ our $VERSION = '0.014';
$etcd->user( { name => 'samba', password => 'foo' } )->add;
# add new user role
$role = $etcd->role( { name => 'myrole' } )->add;
$role = $etcd->role( { name => 'myrole' } )->add;
# grant read permission for the foo key to myrole
$etcd->role_perm( { name => 'myrole', key => 'foo', permType => 'READWRITE' } )->grant;
Expand Down Expand Up @@ -230,13 +230,13 @@ Grants or revoke permission of a specified key or range to a specified role.
=cut

sub role_perm {
my ( $self, $options ) = @_;
my ( $self, $options ) = @_;
my $cb = pop if ref $_[-1] eq 'CODE';
my $perm = Net::Etcd::Auth::RolePermission->new(
etcd => $self,
cb => $cb,
( $options ? %$options : () ),
);
);
}

=head2 user_role
Expand All @@ -262,8 +262,8 @@ sub user_role {
See L<Net::Etcd::Auth>
$etcd->auth({ name => 'samba', password => 'foo' })->authenticate;
$etcd->auth()->enable;
$etcd->auth()->disable
$etcd->auth()->enable;
$etcd->auth()->disable
=cut

Expand Down Expand Up @@ -368,7 +368,7 @@ See L<Net::Etcd::KV::Txn>
See L<Net::Etcd::KV::Op>
$etcd->op({ request_put => $put });
$etcd->op({ request_delete_range => $range });
$etcd->op({ request_delete_range => $range });
=cut

Expand Down Expand Up @@ -398,13 +398,17 @@ sub BUILD {
$msg .= ">> Please install etcd - https://coreos.com/etcd/docs/latest/";
die $msg;
}
# set the intial auth token
# set the intial auth token
$self->auth()->authenticate;
}

=head1 AUTHOR
Sam Batschelet, <sbatschelet at mac.com>
Sam Batschelet (hexfusion)
=head1 CONTRIBUTORS
Ananth Kavuri
=head1 ACKNOWLEDGEMENTS
Expand All @@ -416,6 +420,8 @@ The L<etcd|https://github.com/coreos/etcd> v3 API is in heavy development and ca
L<api_reference_v3|https://github.com/coreos/etcd/blob/master/Documentation/dev-guide/api_reference_v3.md>
for latest details.
Authentication provided by this module will only work with etcd v3.3.0+
=head1 LICENSE AND COPYRIGHT
Copyright 2017 Sam Batschelet (hexfusion).
Expand Down
5 changes: 4 additions & 1 deletion t/pod-spelling.t
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,7 @@ paxosdb
Txn
MultiOp
txn
Ananth
Kavuri
READWRITE
permType

0 comments on commit 7486783

Please sign in to comment.