« 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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 // "-"
MC/DC0%0/1
$cert->fingerprint // "-"
$cert->fingerprint
Truth table50%1/2
A
A= $cert->fingerprint
| |||||||||||||||||||||||||||||
| 29 | 1 | ▶ | printf "Valid From: %s\n", $cert->not_valid_before // '-'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$cert->not_valid_before // "-"
MC/DC0%0/1
$cert->not_valid_before // "-"
$cert->not_valid_before
Truth table50%1/2
A
A= $cert->not_valid_before
| |||||||||||||||||||||||||||||
| 30 | 1 | ▶ | printf "Valid Until: %s\n", $cert->not_valid_after // '-'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$cert->not_valid_after // "-"
MC/DC0%0/1
$cert->not_valid_after // "-"
$cert->not_valid_after
Truth table50%1/2
A
A= $cert->not_valid_after
| |||||||||||||||||||||||||||||
| 31 | 1 | ▶ | printf "Created: %s\n", $cert->created // '-'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$cert->created // "-"
MC/DC0%0/1
$cert->created // "-"
$cert->created
Truth table50%1/2
A
A= $cert->created
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 1 | my $domains = $cert->domain_names; | |||||||||||||||||||||||||||
| 34 | 1 | ▶ | if ($domains && @$domains) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$domains and @$domains
MC/DC0%0/2
$domains and @$domains
$domains
@$domains
Truth table33%1/3
A and B
A= $domainsB= @$domains
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||