File Coverage

blib/lib/Docker/Registry/Azure.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Docker::Registry::Azure;
2 1     1   14193 use Moo;
  1         3  
  1         7  
3 1     1   354 use Types::Standard qw/Str/;
  1         2  
  1         9  
4              
5             extends 'Docker::Registry::V2';
6              
7             has '+url' => (lazy => 1, default => sub {
8             my $self = shift;
9             die "Must specify name" if (not defined $self->name);
10             sprintf 'https://%s.azurecr.io', $self->name;
11             });
12              
13             around build_auth => sub {
14             my ($orig, $self) = @_;
15             if (defined $self->password) {
16             # We're using the "Admin Account" mode
17             # https://docs.microsoft.com/en-us/azure/container-registry/container-registry-authentication#admin-account
18             require Docker::Registry::Auth::Basic;
19             Docker::Registry::Auth::Basic->new(
20             username => $self->name,
21             password => $self->password,
22             );
23             } else {
24             # We're using Service Principal mode
25             require Docker::Registry::Auth::AzureServicePrincipal;
26             Docker::Registry::Auth::AzureServicePrincipal->new;
27             }
28             };
29              
30             has name => (is => 'ro', isa => Str);
31             has password => (is => 'ro', isa => Str);
32              
33             1;