| 1 | package WWW::Hetzner::CLI::Cmd::Volume::Cmd::Describe; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Describe a volume | ||||||||||||||||||||||||||||
| 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 volume 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=11 SCAR=26.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | 1 | my ($self, $args, $chain) = @_; | |||||||||||||||||||||||||||
| 13 | 1 | ▶ | my $id = $args->[0] or die "Usage: hcloud.pl volume describe <id>\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | my $main = $chain->[0]; | |||||||||||||||||||||||||||
| 16 | 1 | my $cloud = $main->cloud; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | my $volume = $cloud->volumes->get($id); | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | if ($main->output eq 'json') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 0 | print encode_json($volume->data), "\n"; | |||||||||||||||||||||||||||
| 22 | 0 | return; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | printf "ID: %s\n", $volume->id; | |||||||||||||||||||||||||||
| 26 | 1 | printf "Name: %s\n", $volume->name; | |||||||||||||||||||||||||||
| 27 | 1 | printf "Size: %s GB\n", $volume->size; | |||||||||||||||||||||||||||
| 28 | 1 | printf "Status: %s\n", $volume->status; | |||||||||||||||||||||||||||
| 29 | 1 | ▶ | printf "Location: %s\n", $volume->location // '-'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$volume->location // "-"
MC/DC0%0/1
$volume->location // "-"
$volume->location
Truth table50%1/2
A
A= $volume->location
| |||||||||||||||||||||||||||||
| 30 | 1 | ▶ | printf "Server: %s\n", $volume->server // 'not attached'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$volume->server // "not attached"
MC/DC0%0/1
$volume->server // "not attached"
$volume->server
Truth table50%1/2
A
A= $volume->server
| |||||||||||||||||||||||||||||
| 31 | 1 | ▶ | printf "Linux Device: %s\n", $volume->linux_device // '-'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$volume->linux_device // "-"
MC/DC0%0/1
$volume->linux_device // "-"
$volume->linux_device
Truth table50%1/2
A
A= $volume->linux_device
| |||||||||||||||||||||||||||||
| 32 | 1 | ▶ | printf "Format: %s\n", $volume->format // '-'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$volume->format // "-"
MC/DC0%0/1
$volume->format // "-"
$volume->format
Truth table50%1/2
A
A= $volume->format
| |||||||||||||||||||||||||||||
| 33 | 1 | ▶ | printf "Created: %s\n", $volume->created // '-'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$volume->created // "-"
MC/DC0%0/1
$volume->created // "-"
$volume->created
Truth table50%1/2
A
A= $volume->created
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | my $labels = $volume->labels; | |||||||||||||||||||||||||||
| 36 | 1 | ▶ | if ($labels && %$labels) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$labels and %$labels
MC/DC0%0/2
$labels and %$labels
$labels
%$labels
Truth table33%1/3
A and B
A= $labelsB= %$labels
| |||||||||||||||||||||||||||||
| 37 | 1 | print "Labels:\n"; | |||||||||||||||||||||||||||
| 38 | 1 | for my $k (sort keys %$labels) { | |||||||||||||||||||||||||||
| 39 | 1 | printf " %s: %s\n", $k, $labels->{$k}; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | 1; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||