« lib/WWW/Hetzner/CLI/Cmd/FloatingIp/Cmd/Describe.pm
↑ Summary
lib/WWW/Hetzner/Robot/CLI/Cmd/Boot/Cmd/Vnc.pm »
| 1 | package WWW::Hetzner::CLI::Cmd::StorageBox::Cmd::Describe; | ||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Describe a Storage Box | ||||||||||||||||||||||||||||||
| 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 storage-box describe <storage-box>'; | ||||||||||||||||||||||||||||
|
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 | 2 | ▶ | sub execute { | ||||||||||||||||||||||||||||
|
Subroutine
execute: called CC=15 SCAR=30.4
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 12 | 2 | my ($self, $args, $chain) = @_; | |||||||||||||||||||||||||||||
| 13 | 2 | ▶ | my $id = $args->[0] or die "Usage: hcloud.pl storage-box describe <storage-box>\n"; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 14 | 2 | my $main = $chain->[0]; | |||||||||||||||||||||||||||||
| 15 | 2 | my $box = $main->storage->storage_boxes->get($id); | |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | if ($main->output eq 'json') { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 18 | 1 | print encode_json($box->data), "\n"; | |||||||||||||||||||||||||||||
| 19 | 1 | return; | |||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||
| 22 | 1 | my $type = $box->storage_box_type; | |||||||||||||||||||||||||||||
| 23 | 1 | my $location = $box->location; | |||||||||||||||||||||||||||||
| 24 | 1 | print "Storage Box:\n"; | |||||||||||||||||||||||||||||
| 25 | 1 | printf " ID: %s\n", $box->id; | |||||||||||||||||||||||||||||
| 26 | 1 | printf " Name: %s\n", $box->name; | |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | printf " Type: %s\n", ref $type eq 'HASH' ? ($type->{name} // '-') : ($type // '-'); | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition25%1/4
$type->{"name"} // "-"
$type // "-"
MC/DC0%0/1
$type->{"name"} // "-"
$type->{"name"}
MC/DC0%0/1
$type // "-"
$type
Truth table50%1/2
A
A= $type->{"name"}
Truth table0%0/2
A
A= $type
| |||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | printf " Location: %s\n", ref $location eq 'HASH' ? ($location->{name} // '-') : ($location // '-'); | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition25%1/4
$location->{"name"} // "-"
$location // "-"
MC/DC0%0/1
$location->{"name"} // "-"
$location->{"name"}
MC/DC0%0/1
$location // "-"
$location
Truth table50%1/2
A
A= $location->{"name"}
Truth table0%0/2
A
A= $location
| |||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | printf " Status: %s\n", $box->status // '-'; | ||||||||||||||||||||||||||||
|
Condition50%1/2
$box->status // "-"
MC/DC0%0/1
$box->status // "-"
$box->status
Truth table50%1/2
A
A= $box->status
| |||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | printf " Username: %s\n", $box->username // '-'; | ||||||||||||||||||||||||||||
|
Condition50%1/2
$box->username // "-"
MC/DC0%0/1
$box->username // "-"
$box->username
Truth table50%1/2
A
A= $box->username
| |||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | printf " Server: %s\n", $box->server // '-'; | ||||||||||||||||||||||||||||
|
Condition50%1/2
$box->server // "-"
MC/DC0%0/1
$box->server // "-"
$box->server
Truth table50%1/2
A
A= $box->server
| |||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | my $labels = $box->labels // {}; | ||||||||||||||||||||||||||||
|
Condition50%1/2
$box->labels // {}
MC/DC0%0/1
$box->labels // {}
$box->labels
Truth table50%1/2
A
A= $box->labels
| |||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | if (%$labels) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 34 | 1 | print " Labels:\n"; | |||||||||||||||||||||||||||||
| 35 | 1 | printf " %s: %s\n", $_, $labels->{$_} for sort keys %$labels; | |||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||
| 39 | 1 | 1; | |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||
| 41 | __END__ | ||||||||||||||||||||||||||||||