line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Docker::Registry::RequestBuilder; |
2
|
5
|
|
|
5
|
|
38
|
use Moo; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
36
|
|
3
|
|
|
|
|
|
|
|
4
|
5
|
|
|
5
|
|
1919
|
use Docker::Registry::Request; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
180
|
|
5
|
5
|
|
|
5
|
|
29
|
use Docker::Registry::Types qw(DockerRegistryURI); |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
74
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has url => (is => 'ro', coerce => 1, isa => DockerRegistryURI, required => 1); |
8
|
|
|
|
|
|
|
has api_base => (is => 'ro', default => 'v2'); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub build_request { |
11
|
14
|
|
|
14
|
0
|
36863
|
my ($self, $call) = @_; |
12
|
14
|
|
|
|
|
42
|
my $request; |
13
|
|
|
|
|
|
|
|
14
|
14
|
|
|
|
|
44
|
my $url_params = $self->_build_url_params($call); |
15
|
|
|
|
|
|
|
|
16
|
14
|
100
|
|
|
|
388
|
if (ref($call) eq 'Docker::Registry::Call::Repositories') { |
|
|
50
|
|
|
|
|
|
17
|
6
|
|
|
|
|
150
|
$request = Docker::Registry::Request->new( |
18
|
|
|
|
|
|
|
method => 'GET', |
19
|
|
|
|
|
|
|
url => (join '/', $self->url, $self->api_base, "_catalog$url_params"), |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
} elsif (ref($call) eq 'Docker::Registry::Call::RepositoryTags') { |
23
|
8
|
|
|
|
|
133
|
$request = Docker::Registry::Request->new( |
24
|
|
|
|
|
|
|
method => 'GET', |
25
|
|
|
|
|
|
|
url => (join '/', $self->url, $self->api_base, $call->repository, "tags/list$url_params"), |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
} else { |
28
|
0
|
|
|
|
|
0
|
Docker::Exception->throw( |
29
|
|
|
|
|
|
|
message => sprintf("Unknown call class: %s", ref($call)), |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
14
|
|
|
|
|
1241
|
return $request; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _build_url_params { |
37
|
14
|
|
|
14
|
|
33
|
my ($self, $call) = @_; |
38
|
14
|
|
|
|
|
58
|
my $url_params = URI->new(); |
39
|
|
|
|
|
|
|
|
40
|
14
|
100
|
100
|
|
|
793
|
if ($call->n or $call->last) { |
41
|
2
|
100
|
66
|
|
|
24
|
if ($call->n and !$call->last) { |
|
|
50
|
33
|
|
|
|
|
42
|
1
|
|
|
|
|
8
|
$url_params->query_form(n => $call->n); |
43
|
|
|
|
|
|
|
} elsif (!$call->n and $call->last) { |
44
|
1
|
|
|
|
|
6
|
$url_params->query_form(last => $call->last); |
45
|
|
|
|
|
|
|
} else { |
46
|
0
|
|
|
|
|
0
|
$url_params->query_form(last => $call->last, n => $call->n); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
14
|
|
|
|
|
274
|
return $url_params->as_string; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |