Registry/Auth/ECR.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 28 CC 1 SCAR 6.9
CC
1
Cov
0%
authorize
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Docker::Registry::Auth::ECR;
2 use Moo;
3 use Types::Standard qw/Str/;
4 with 'Docker::Registry::Auth';
5  
6 use Paws;
7  
8 has region => (is => 'ro', isa => Str);
9  
10 has ecr => (is => 'ro', lazy => 1, default => sub {
11 my $self = shift;
12 die "Docker::Registry::Auth::ECR needs region" if (not defined $self->region);
13 Paws->service('ECR', region => $self->region);
14 });
15  
16 has token => (is => 'ro', isa => Str, required => 1, lazy => 1, default => sub {
17 my $self = shift;
18 $self->ecr->GetAuthorizationToken->AuthorizationData->[0]->AuthorizationToken;
19 });
20  
21 sub authorize {
22 my ($self, $request) = @_;
23  
24 $request->header('Authorization', 'Basic ' . $self->token);
25 return $request;
26 }
27  
28 1;