lib/WWW/Hetzner/CLI/Cmd/LoadBalancerType.pm

filter: Statementstmt 82.7% 24 / 29 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 5 / 10 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 66.6% 36 / 54 CC 9 SCAR 23.5
CC
9
Cov
72%
execute
14.7
BEGIN
1.0
BEGIN
1.0
CRAP 10.5
« lib/WWW/Hetzner/CLI/Cmd/FloatingIp/Cmd/List.pm ↑ Summary lib/WWW/Hetzner/Robot/CLI/Cmd/Rdns.pm »
1 package WWW::Hetzner::CLI::Cmd::LoadBalancerType;
2 # ABSTRACT: Load balancer type commands
3  
4 1 our $VERSION = '0.102';
5  
6 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use MooX::Cmd;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use MooX::Options usage_string => 'USAGE: hcloud.pl load-balancer-type [options]';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use JSON::MaybeXS qw(encode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 1 ▶sub execute {
Subroutine execute: called CC=9 SCAR=26.9
Pod undocumented
13 1 my ($self, $args, $chain) = @_;
14  
15 1 my $main = $chain->[0];
16 1 my $cloud = $main->cloud;
17  
18 1 my $types = $cloud->load_balancer_types->list_all;
19  
20 1 ▶ if ($main->output eq 'json') {
Branch: 1 branch
BranchTrueFalseTotal
if ($main->output eq "json") 0 1 1
21 0 print encode_json([ map { $_->data } @$types ]), "\n";
22 0 return;
23 }
24  
25 1 ▶ if (!@$types) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@$types) 0 1 1
26 0 print "No load balancer types found.\n";
27 0 return;
28 }
29  
30 1 printf "%-8s %-10s %-14s %-10s %-10s %s\n",
31 'ID', 'NAME', 'CONNECTIONS', 'SERVICES', 'TARGETS', 'CERTIFICATES';
32 1 printf "%-8s %-10s %-14s %-10s %-10s %s\n",
33 '-' x 8, '-' x 10, '-' x 14, '-' x 10, '-' x 10, '-' x 12;
34  
35 1 for my $t (@$types) {
36 3 ▶ printf "%-8s %-10s %-14s %-10s %-10s %s\n",
Condition50%5/10
$t->name // "-"
l!l
30
$t->max_connections // "-"
l!l
30
$t->max_services // "-"
l!l
30
$t->max_targets // "-"
l!l
30
$t->max_assigned_certificates // "-"
l!l
30
MC/DC0%0/1
$t->name // "-"
$t->name
MC/DC0%0/1
$t->max_connections // "-"
$t->max_connections
MC/DC0%0/1
$t->max_services // "-"
$t->max_services
MC/DC0%0/1
$t->max_targets // "-"
$t->max_targets
MC/DC0%0/1
$t->max_assigned_certificates // "-"
$t->max_assigned_certificates
Truth table50%1/2
A
A= $t->name
Aresult
11
00
Truth table50%1/2
A
A= $t->max_connections
Aresult
11
00
Truth table50%1/2
A
A= $t->max_services
Aresult
11
00
Truth table50%1/2
A
A= $t->max_targets
Aresult
11
00
Truth table50%1/2
A
A= $t->max_assigned_certificates
Aresult
11
00
37 $t->id,
38 $t->name // '-',
39 $t->max_connections // '-',
40 $t->max_services // '-',
41 $t->max_targets // '-',
42 $t->max_assigned_certificates // '-';
43 }
44 }
45  
46 1 1;
47  
48 __END__
« lib/WWW/Hetzner/CLI/Cmd/FloatingIp/Cmd/List.pm ↑ Summary lib/WWW/Hetzner/Robot/CLI/Cmd/Rdns.pm »