line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kubernetes::REST::HTTPTinyIO; |
2
|
1
|
|
|
1
|
|
1053
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
3
|
1
|
|
|
1
|
|
291
|
use HTTP::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
65
|
|
4
|
1
|
|
|
1
|
|
691
|
use IO::Socket::SSL; |
|
1
|
|
|
|
|
40191
|
|
|
1
|
|
|
|
|
8
|
|
5
|
1
|
|
|
1
|
|
532
|
use Kubernetes::REST::HTTPResponse; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
6
|
1
|
|
|
1
|
|
5
|
use Types::Standard qw/Bool/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has ssl_verify_server => (is => 'ro', isa => Bool, default => 1); |
9
|
|
|
|
|
|
|
has ssl_cert_file => (is => 'ro'); |
10
|
|
|
|
|
|
|
has ssl_key_file => (is => 'ro'); |
11
|
|
|
|
|
|
|
has ssl_ca_file => (is => 'ro'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has ua => (is => 'ro', lazy => 1, default => sub { |
14
|
|
|
|
|
|
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %options; |
17
|
|
|
|
|
|
|
$options{ SSL_verify_mode } = SSL_VERIFY_PEER if ($self->ssl_verify_server); |
18
|
|
|
|
|
|
|
$options{ SSL_cert_file } = $self->ssl_cert_file if (defined $self->ssl_cert_file); |
19
|
|
|
|
|
|
|
$options{ SSL_key_file } = $self->ssl_key_file if (defined $self->ssl_key_file); |
20
|
|
|
|
|
|
|
$options{ SSL_ca_file } = $self->ssl_ca_file if (defined $self->ssl_ca_file); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return HTTP::Tiny->new( |
23
|
|
|
|
|
|
|
agent => 'Kubernetes::REST Perl Client ' . $Kubernetes::REST::VERSION, |
24
|
|
|
|
|
|
|
SSL_options => \%options, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
}); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub call { |
29
|
0
|
|
|
0
|
0
|
|
my ($self, $call, $req) = @_; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
$req->authenticate if (defined $req->credentials); |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
my $res = $self->ua->request( |
34
|
|
|
|
|
|
|
$req->method, |
35
|
|
|
|
|
|
|
$req->url, |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
headers => $req->headers, |
38
|
|
|
|
|
|
|
(defined $req->content) ? (content => $req->content) : (), |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
return Kubernetes::REST::HTTPResponse->new( |
43
|
|
|
|
|
|
|
status => $res->{ status }, |
44
|
0
|
0
|
|
|
|
|
(defined $res->{ content })?( content => $res->{ content } ) : (), |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |