| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Kubernetes::REST::HTTPRequest; |
|
2
|
2
|
|
|
2
|
|
13
|
use Moo; |
|
|
2
|
|
|
|
|
11
|
|
|
|
2
|
|
|
|
|
14
|
|
|
3
|
2
|
|
|
2
|
|
1754
|
use Types::Standard qw/Str HashRef/; |
|
|
2
|
|
|
|
|
10
|
|
|
|
2
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has server => (is => 'ro', required => 1); |
|
6
|
|
|
|
|
|
|
has credentials => (is => 'ro'); |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub authenticate { |
|
9
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
10
|
0
|
|
|
|
|
|
my $auth = $self->credentials; |
|
11
|
0
|
0
|
|
|
|
|
if (defined $auth) { |
|
12
|
0
|
|
|
|
|
|
$self->headers->{ Authorization } = 'Bearer ' . $auth->token; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has uri => (is => 'rw', isa => Str); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has method => (is => 'rw', isa => Str); |
|
19
|
|
|
|
|
|
|
has url => (is => 'rw', isa => Str, lazy => 1, default => sub { |
|
20
|
|
|
|
|
|
|
my $self = shift; |
|
21
|
|
|
|
|
|
|
my $base_url = $self->server->endpoint; |
|
22
|
|
|
|
|
|
|
my $uri = $self->uri; |
|
23
|
|
|
|
|
|
|
return "${base_url}${uri}"; |
|
24
|
|
|
|
|
|
|
}); |
|
25
|
|
|
|
|
|
|
has headers => (is => 'rw', isa => HashRef, default => sub { {} }); |
|
26
|
|
|
|
|
|
|
has parameters => (is => 'rw', isa => HashRef); |
|
27
|
|
|
|
|
|
|
has content => (is => 'rw', isa => Str); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |