| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Consul::API::Status; |
|
2
|
|
|
|
|
|
|
$Consul::API::Status::VERSION = '0.027'; |
|
3
|
9
|
|
|
9
|
|
4477
|
use namespace::autoclean; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
47
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
625
|
use Moo::Role; |
|
|
9
|
|
|
|
|
15
|
|
|
|
9
|
|
|
|
|
46
|
|
|
6
|
9
|
|
|
9
|
|
2893
|
use Types::Standard qw(Str); |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
52
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
requires qw(_version_prefix _api_exec); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has _status_endpoint => ( is => 'lazy', isa => Str ); |
|
11
|
|
|
|
|
|
|
sub _build__status_endpoint { |
|
12
|
0
|
|
|
0
|
|
|
shift->_version_prefix . '/status'; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub status { |
|
16
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
17
|
0
|
0
|
|
|
|
|
$self = Consul->new(@_) unless ref $self; |
|
18
|
0
|
|
|
|
|
|
return bless \$self, "Consul::API::Status::Impl"; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package |
|
22
|
|
|
|
|
|
|
Consul::API::Status::Impl; # hide from PAUSE |
|
23
|
|
|
|
|
|
|
|
|
24
|
9
|
|
|
9
|
|
5055
|
use Moo; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
49
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
9
|
|
|
9
|
|
2743
|
use Carp qw(croak); |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
1347
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub leader { |
|
29
|
0
|
|
|
0
|
0
|
|
my ($self, %args) = @_; |
|
30
|
0
|
|
|
|
|
|
$$self->_api_exec($$self->_status_endpoint."/leader", "GET", %args); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub peers { |
|
34
|
0
|
|
|
0
|
0
|
|
my ($self, %args) = @_; |
|
35
|
0
|
|
|
|
|
|
$$self->_api_exec($$self->_status_endpoint."/peers", "GET", %args); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding UTF-8 |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Consul::API::Status - System status API |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
use Consul; |
|
51
|
|
|
|
|
|
|
my $status = Consul->status; |
|
52
|
|
|
|
|
|
|
my $peers = $status->peers; |
|
53
|
|
|
|
|
|
|
say "@$peers"; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The system status API is used to get information about the status of the Consul |
|
58
|
|
|
|
|
|
|
cluster. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This API is fully documented at L. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHODS |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 leader |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$status->leader; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Returns the address of the Raft leader for the datacenter in which the agent is |
|
69
|
|
|
|
|
|
|
running. Returns an IP:port string. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 peers |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$status->peers; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Retrieves the Raft peers for the datacenter in which the agent is running. |
|
76
|
|
|
|
|
|
|
Returns an arrayref of IP:port strings. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
L |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |