line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
15
|
use utf8; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
18
|
|
2
|
|
|
|
|
|
|
package Etcd3::Lease::TimeToLive; |
3
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
136
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
70
|
|
5
|
4
|
|
|
4
|
|
14
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
79
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
13
|
use Moo; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
14
|
|
8
|
4
|
|
|
4
|
|
777
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
41
|
|
9
|
4
|
|
|
4
|
|
2385
|
use JSON; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
18
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'Etcd3::Role::Actions'; |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
396
|
use namespace::clean; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
19
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Etcd3::Lease::TimeToLive |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
LeaseTimeToLive retrieves lease information. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 endpoint |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
/kv/lease/timetolive |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has endpoint => ( |
34
|
|
|
|
|
|
|
is => 'ro', |
35
|
|
|
|
|
|
|
isa => Str, |
36
|
|
|
|
|
|
|
default => '/kv/lease/timetolive' |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 ID |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
ID is the requested ID for the lease. If ID is set to 0, the lessor chooses an ID. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has ID => ( |
46
|
|
|
|
|
|
|
is => 'ro', |
47
|
|
|
|
|
|
|
isa => Int, |
48
|
|
|
|
|
|
|
required => 1, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 keys |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
keys is true to query all the keys attached to this lease. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has keys => ( |
58
|
|
|
|
|
|
|
is => 'ro', |
59
|
|
|
|
|
|
|
isa => Bool, |
60
|
4
|
|
|
4
|
|
1334
|
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false } |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
896
|
|
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 json_args |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
arguments that will be sent to the api |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
has json_args => ( is => 'lazy', ); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _build_json_args { |
72
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
73
|
0
|
|
|
|
|
|
my $args; |
74
|
0
|
|
|
|
|
|
for my $key ( keys %{$self} ) { |
|
0
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
unless ( $key =~ /(?:_client|json_args|endpoint)$/ ) { |
76
|
0
|
|
|
|
|
|
$args->{$key} = $self->{$key}; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
|
return to_json($args); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 init |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub init { |
87
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
88
|
0
|
|
|
|
|
|
$self->json_args; |
89
|
0
|
|
|
|
|
|
return $self; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |