« lib/WWW/Hetzner/Robot/CLI/Cmd/Boot/Cmd/Linux.pm
↑ Summary
lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/AddLabel.pm »
| 1 | package WWW::Hetzner::CLI::Cmd::Iso; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: ISO 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 iso [--architecture x86|arm] [--name NAME] [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 | option architecture => ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | format => 's', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | doc => 'Filter by architecture (x86, arm)', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | option name => ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | format => 's', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | doc => 'Filter by exact ISO name', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | sub execute { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: called CC=11 SCAR=27.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | my ($self, $args, $chain) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | my $main = $chain->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | my $cloud = $main->cloud; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | my %params; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | $params{architecture} = $self->architecture if $self->architecture; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | $params{name} = $self->name if $self->name; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | my $isos = $cloud->isos->list_all(%params); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | ▶ | if ($main->output eq 'json') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | print encode_json([ map { $_->data } @$isos ]), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | if (!@$isos) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | print "No ISOs found.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | printf "%-8s %-40s %-8s %-6s %s\n", 'ID', 'NAME', 'TYPE', 'ARCH', 'DEPRECATED'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | printf "%-8s %-40s %-8s %-6s %s\n", '-' x 8, '-' x 40, '-' x 8, '-' x 6, '-' x 10; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | for my $iso (@$isos) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | printf "%-8s %-40s %-8s %-6s %s\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | $iso->id, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | $iso->name // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | $iso->type // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | $iso->architecture // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ($iso->deprecation ? $iso->deprecation->{unavailable_after} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 3 | ▶ | : $iso->deprecated) // '-'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition62%5/8
$iso->name // "-"
$iso->type // "-"
$iso->architecture // "-"
($iso->deprecation ? $iso->deprecation->{"unavailable_after"} : $iso->deprecated) // "-"
MC/DC0%0/1
$iso->name // "-"
$iso->name
MC/DC0%0/1
$iso->type // "-"
$iso->type
MC/DC0%0/1
$iso->architecture // "-"
$iso->architecture
MC/DC100%1/1
($iso->deprecation ? $iso->deprecation->{"unavailable_after"} : $iso->deprecated) // "-"
($iso->deprecation ? $iso->deprecation->{"unavailable_after"} : $iso->deprecated)
Truth table50%1/2
A
A= $iso->name
Truth table50%1/2
A
A= $iso->type
Truth table50%1/2
A
A= $iso->architecture
Truth table100%2/2
A
A= ($iso->deprecation ? $iso->deprecation->{"unavailable_after"} : $iso->deprecated)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||