« lib/WWW/Hetzner/CLI/Cmd/Volume/Cmd/List.pm
↑ Summary
lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Folders.pm »
| 1 | package WWW::Hetzner::CLI::Cmd::PlacementGroup::Cmd::Describe; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Describe a placement group | ||||||||||||||||||||||||||||
| 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 placement-group 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=6 SCAR=19.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | 1 | my ($self, $args, $chain) = @_; | |||||||||||||||||||||||||||
| 13 | 1 | ▶ | my $id = $args->[0] or die "Usage: hcloud.pl placement-group describe <id>\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | my $main = $chain->[0]; | |||||||||||||||||||||||||||
| 16 | 1 | my $cloud = $main->cloud; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | my $pg = $cloud->placement_groups->get($id); | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | if ($main->output eq 'json') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 0 | print encode_json($pg->data), "\n"; | |||||||||||||||||||||||||||
| 22 | 0 | return; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | printf "ID: %s\n", $pg->id; | |||||||||||||||||||||||||||
| 26 | 1 | printf "Name: %s\n", $pg->name; | |||||||||||||||||||||||||||
| 27 | 1 | printf "Type: %s\n", $pg->type; | |||||||||||||||||||||||||||
| 28 | 1 | ▶ | printf "Created: %s\n", $pg->created // '-'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$pg->created // "-"
MC/DC0%0/1
$pg->created // "-"
$pg->created
Truth table50%1/2
A
A= $pg->created
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 1 | my $servers = $pg->servers; | |||||||||||||||||||||||||||
| 31 | 1 | ▶ | if ($servers && @$servers) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$servers and @$servers
MC/DC0%0/2
$servers and @$servers
$servers
@$servers
Truth table33%1/3
A and B
A= $serversB= @$servers
| |||||||||||||||||||||||||||||
| 32 | 1 | printf "Servers: %s\n", join(', ', @$servers); | |||||||||||||||||||||||||||
| 33 | } else { | ||||||||||||||||||||||||||||
| 34 | 0 | print "Servers: none\n"; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 1 | 1; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | __END__ | ||||||||||||||||||||||||||||