FargateStack/Route53.pm

filter: Statementstmt 57.4% 31 / 54 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 10 / 12 Podpod 0.0% 0 / 2 totaltotal 51.9% 41 / 79 CC 6 SCAR 23.1
CC
6
Cov
49%
display_hosted_zones
30.0
cmd_list_zones
6.0
BEGIN
1.0
CRAP 10.1
« Command.pm ↑ Summary ApplicationAutoscaling.pm »
1 package App::FargateStack::Route53;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use App::FargateStack::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use App::Route53;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use CLI::Simple::Constants qw(:booleans);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use English qw(no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Text::ASCIITable::EasyTable;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 ########################################################################
19 0 ▶sub cmd_list_zones {
Subroutine cmd_list_zones: not called CC=2 SCAR=17.9
Pod undocumented
20 ########################################################################
21 0 my ($self) = @_;
22  
23 0 my ($domain) = $self->get_args;
24  
25 croak sprintf "usage: %s list-zones domain\n", $ENV{SCRIPT_NAME}
26 0 ▶ if !$domain;
Branch: 1 branch
BranchTrueFalseTotal
unless $domain 0 0 0
27  
28 0 print {*STDOUT} $self->display_hosted_zones($domain);
29  
30 0 return $SUCCESS;
31 }
32  
33 ########################################################################
34 0 ▶sub display_hosted_zones {
Subroutine display_hosted_zones: not called CC=5 SCAR=34.0
Pod undocumented
35 ########################################################################
36 0 my ( $self, $domain ) = @_;
37  
38 0 my $route53 = $self->fetch_route53;
39  
40 0 my $hosted_zones = $route53->list_hosted_zones;
41  
42 return
43 0 ▶ if !$hosted_zones || !@{ $hosted_zones->{HostedZones} };
Branch: 1 branch
BranchTrueFalseTotal
unless $hosted_zones and @{$hosted_zones->{"HostedZones"};} 0 0 0
Condition0%0/3
$hosted_zones and @{$hosted_zones->{"HostedZones"};}
!ll&&!rl&&r
000
MC/DC0%0/2
$hosted_zones and @{$hosted_zones->{"HostedZones"};}
$hosted_zones @{$hosted_zones->{"HostedZones"};}
Truth table0%0/3
A and B
A= $hosted_zonesB= @{$hosted_zones->{"HostedZones"};}
ABresult
0X0
100
111
44  
45 0 my @zones = @{ $hosted_zones->{HostedZones} };
46  
47 0 my @data;
48  
49 0 foreach my $zone (@zones) {
50 0 my $name = $zone->{Name};
51 0 $name =~ s/[.]$//xsm;
52  
53 0 ▶ next if $domain !~ /$name/xsm;
Branch: 1 branch
BranchTrueFalseTotal
unless $domain =~ /$name/msx 0 0 0
54  
55 0 my ($zone_id) = ( split /\//xsm, $zone->{Id} )[-1];
56  
57 0 push @data, { 'Zone Id' => $zone_id, Name => $zone->{Name} };
58 }
59  
60 0 my $title = sprintf 'Hosted Zones (%s)', $domain;
61  
62 0 my $table = easy_table(
63 data => [@data],
64 table_options => { headingText => $title },
65 columns => [ 'Zone Id', 'Name' ],
66 );
67  
68 0 return $table;
69 }
70  
71 1 1;
« Command.pm ↑ Summary ApplicationAutoscaling.pm »