line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Docker::Client; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
385060
|
use Moose; |
|
5
|
|
|
|
|
2267242
|
|
|
5
|
|
|
|
|
34
|
|
4
|
5
|
|
|
5
|
|
35642
|
use Moose::Util::TypeConstraints; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
48
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
10419
|
use Carp; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
392
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
3482
|
use Array::Utils qw( array_minus ); |
|
5
|
|
|
|
|
2202
|
|
|
5
|
|
|
|
|
315
|
|
9
|
5
|
|
|
5
|
|
2471
|
use Class::Inspector; |
|
5
|
|
|
|
|
17838
|
|
|
5
|
|
|
|
|
177
|
|
10
|
5
|
|
|
5
|
|
2463
|
use OpenAPI::Client; |
|
5
|
|
|
|
|
2401880
|
|
|
5
|
|
|
|
|
45
|
|
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
3035
|
use File::ShareDir qw( dist_dir ); |
|
5
|
|
|
|
|
84158
|
|
|
5
|
|
|
|
|
314
|
|
13
|
|
|
|
|
|
|
|
14
|
5
|
|
|
5
|
|
41
|
use Mojo::File; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
170
|
|
15
|
5
|
|
|
5
|
|
31
|
use Mojo::URL; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
347
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.1.1'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
class_type 'Mojo::URL'; |
20
|
|
|
|
|
|
|
coerce 'Mojo::URL', from 'Str', via { Mojo::URL->new(shift) }; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'endpoint' => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => 'Mojo::URL', |
25
|
|
|
|
|
|
|
default => sub { |
26
|
|
|
|
|
|
|
return Mojo::URL->new('http+unix://%2Fvar%2Frun%2Fdocker.sock'); |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
coerce => 1, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has 'version' => ( |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
isa => enum( |
34
|
|
|
|
|
|
|
[ |
35
|
|
|
|
|
|
|
'v1.40', 'v1.39', 'v1.38', 'v1.37', 'v1.36', 'v1.35', |
36
|
|
|
|
|
|
|
'v1.34', 'v1.33', 'v1.32', 'v1.31', 'v1.30', 'v1.29', |
37
|
|
|
|
|
|
|
, 'v1.28', 'v1.27', 'v1.26', 'v1.25', |
38
|
|
|
|
|
|
|
] |
39
|
|
|
|
|
|
|
), |
40
|
|
|
|
|
|
|
default => 'v1.40', |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has 'ua' => ( |
44
|
|
|
|
|
|
|
is => 'ro', |
45
|
|
|
|
|
|
|
isa => 'Mojo::UserAgent', |
46
|
|
|
|
|
|
|
lazy => 1, |
47
|
|
|
|
|
|
|
default => sub { |
48
|
|
|
|
|
|
|
return shift->api()->ua(); |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has 'api' => ( |
53
|
|
|
|
|
|
|
is => 'ro', |
54
|
|
|
|
|
|
|
isa => 'OpenAPI::Client', |
55
|
|
|
|
|
|
|
lazy => 1, |
56
|
|
|
|
|
|
|
default => sub { |
57
|
|
|
|
|
|
|
my $self = shift; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
## Making sure we use the correct version path |
60
|
|
|
|
|
|
|
my $base_url = |
61
|
|
|
|
|
|
|
$self->endpoint()->clone()->path( sprintf '/%s', $self->version() ); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
## Loading correct version specification from disk. |
64
|
|
|
|
|
|
|
my $spec = |
65
|
|
|
|
|
|
|
Mojo::File->new( dist_dir('Docker-Client') )->child('specs') |
66
|
|
|
|
|
|
|
->child( sprintf '%s.yaml', $self->version() ); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
## Creating the OpenAPI Client instance using the defined parameters. |
69
|
|
|
|
|
|
|
my $api = |
70
|
|
|
|
|
|
|
OpenAPI::Client->new( $spec->to_string(), |
71
|
|
|
|
|
|
|
base_url => $self->endpoint() ); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
## If the protocol is local we need to replace the "Host" header on each request |
74
|
|
|
|
|
|
|
if ( $self->endpoint()->protocol() eq 'http+unix' ) { |
75
|
|
|
|
|
|
|
$api->ua()->on( |
76
|
|
|
|
|
|
|
start => sub { |
77
|
|
|
|
|
|
|
my ( $ua, $tx ) = @_; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
$tx->req()->headers()->header( 'Host' => 'localhost' ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
return $api; |
85
|
|
|
|
|
|
|
}, |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub BUILD { |
89
|
6
|
|
|
6
|
0
|
11751
|
my $self = shift; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
## Making sure we extract only the methods corresponding to the OpenAPI definition. |
92
|
6
|
|
|
|
|
234
|
my $api_methods = Class::Inspector->methods( ref $self->api(), 'public' ); |
93
|
6
|
|
|
|
|
17171
|
my $base_methods = Class::Inspector->methods( 'OpenAPI::Client', 'public' ); |
94
|
|
|
|
|
|
|
|
95
|
6
|
|
|
|
|
3032
|
my @methods = array_minus( @{$api_methods}, @{$base_methods} ); |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
41
|
|
96
|
6
|
50
|
|
|
|
737
|
croak 'No methods found!' |
97
|
|
|
|
|
|
|
unless ( scalar @methods ); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
## Creating corresponding methods names in the current instance. |
100
|
6
|
|
|
|
|
21
|
foreach my $name (@methods) { |
101
|
|
|
|
|
|
|
$self->meta()->add_method( |
102
|
|
|
|
|
|
|
$name, |
103
|
|
|
|
|
|
|
sub { |
104
|
4
|
|
|
4
|
|
258
|
return shift->api()->$name(@_); |
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|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