lib/WWW/Hetzner/CLI/Cmd/Certificate/Cmd/Describe.pm

filter: Statementstmt 94.1% 32 / 34 Branchbran 50.0% 3 / 6 Conditioncond 45.4% 5 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 71.4% 45 / 63 CC 10 SCAR 22.3
CC
10
Cov
78%
execute
12.6
BEGIN
1.0
BEGIN
1.0
CRAP 9.3
« lib/WWW/Hetzner/CLI/Cmd/Certificate/Cmd/List.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Snapshot/Cmd/List.pm »
1 package WWW::Hetzner::CLI::Cmd::Certificate::Cmd::Describe;
2 # ABSTRACT: Describe a certificate
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 protect_argv => 0, usage_string => 'USAGE: hcloud.pl certificate describe <id>';
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 1 ▶sub execute {
Subroutine execute: called CC=10 SCAR=25.4
Pod undocumented
12 1 my ($self, $args, $chain) = @_;
13 1 ▶ my $id = $args->[0] or die "Usage: hcloud.pl certificate describe <id>\n";
Branch: 1 branch
BranchTrueFalseTotal
my $id = $args->[0] or die "Usage: hcloud.pl certificate describe <id>\n" 1 0 1
14  
15 1 my $main = $chain->[0];
16 1 my $cloud = $main->cloud;
17  
18 1 my $cert = $cloud->certificates->get($id);
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($cert->data), "\n";
22 0 return;
23 }
24  
25 1 printf "ID: %s\n", $cert->id;
26 1 printf "Name: %s\n", $cert->name;
27 1 printf "Type: %s\n", $cert->type;
28 1 ▶ printf "Fingerprint: %s\n", $cert->fingerprint // '-';
Condition50%1/2
$cert->fingerprint // "-"
l!l
10
MC/DC0%0/1
$cert->fingerprint // "-"
$cert->fingerprint
Truth table50%1/2
A
A= $cert->fingerprint
Aresult
11
00
29 1 ▶ printf "Valid From: %s\n", $cert->not_valid_before // '-';
Condition50%1/2
$cert->not_valid_before // "-"
l!l
10
MC/DC0%0/1
$cert->not_valid_before // "-"
$cert->not_valid_before
Truth table50%1/2
A
A= $cert->not_valid_before
Aresult
11
00
30 1 ▶ printf "Valid Until: %s\n", $cert->not_valid_after // '-';
Condition50%1/2
$cert->not_valid_after // "-"
l!l
10
MC/DC0%0/1
$cert->not_valid_after // "-"
$cert->not_valid_after
Truth table50%1/2
A
A= $cert->not_valid_after
Aresult
11
00
31 1 ▶ printf "Created: %s\n", $cert->created // '-';
Condition50%1/2
$cert->created // "-"
l!l
10
MC/DC0%0/1
$cert->created // "-"
$cert->created
Truth table50%1/2
A
A= $cert->created
Aresult
11
00
32  
33 1 my $domains = $cert->domain_names;
34 1 ▶ if ($domains && @$domains) {
Branch: 1 branch
BranchTrueFalseTotal
if ($domains and @$domains) 1 0 1
Condition33%1/3
$domains and @$domains
!ll&&!rl&&r
001
MC/DC0%0/2
$domains and @$domains
$domains @$domains
Truth table33%1/3
A and B
A= $domainsB= @$domains
ABresult
0X0
100
111
35 1 print "Domains:\n";
36 1 for my $d (@$domains) {
37 2 print " - $d\n";
38 }
39 }
40 }
41  
42 1 1;
43  
44 __END__
« lib/WWW/Hetzner/CLI/Cmd/Certificate/Cmd/List.pm ↑ Summary lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Snapshot/Cmd/List.pm »