« lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount.pm
↑ Summary
lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/Update.pm »
| 1 | package WWW::Hetzner::CLI::Cmd::StorageBox::Cmd::Subaccount::Cmd::Describe; | ||||||||||||||||||||
| 2 | # ABSTRACT: Describe a Storage Box subaccount | ||||||||||||||||||||
| 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 subaccount describe <storage-box> <subaccount>'; | ||||||||||||||||||
|
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 | 1 | ▶ | use WWW::Hetzner::Storage::API::Subaccounts; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 2 | ▶ | sub execute { | ||||||||||||||||||
|
Subroutine
execute: called CC=14 SCAR=28.4
Pod
undocumented
| |||||||||||||||||||||
| 14 | 2 | my ($self, $args, $chain) = @_; | |||||||||||||||||||
| 15 | 2 | ▶ | my $id = $args->[0] or die "Usage: hcloud.pl storage-box subaccount describe <storage-box> <subaccount>\n"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 16 | 2 | ▶ | my $sub = $args->[1] or die "Usage: hcloud.pl storage-box subaccount describe <storage-box> <subaccount>\n"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 17 | 2 | my $main = $chain->[0]; | |||||||||||||||||||
| 18 | 2 | my $subaccounts = WWW::Hetzner::Storage::API::Subaccounts->new( | |||||||||||||||||||
| 19 | client => $main->storage, | ||||||||||||||||||||
| 20 | storage_box_id => $id, | ||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||
| 22 | 2 | my $subaccount = $subaccounts->get($sub); | |||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 2 | ▶ | if ($main->output eq 'json') { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 25 | 1 | print encode_json($subaccount->data), "\n"; | |||||||||||||||||||
| 26 | 1 | return; | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 1 | print "Subaccount:\n"; | |||||||||||||||||||
| 30 | 1 | printf " ID: %s\n", $subaccount->id; | |||||||||||||||||||
| 31 | 1 | ▶ | printf " Name: %s\n", ($subaccount->name // '') ne '' ? $subaccount->name : '-'; | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$subaccount->name // ""
MC/DC0%0/1
$subaccount->name // ""
$subaccount->name
Truth table50%1/2
A
A= $subaccount->name
| |||||||||||||||||||||
| 32 | 1 | ▶ | printf " Username: %s\n", $subaccount->username // '-'; | ||||||||||||||||||
|
Condition50%1/2
$subaccount->username // "-"
MC/DC0%0/1
$subaccount->username // "-"
$subaccount->username
Truth table50%1/2
A
A= $subaccount->username
| |||||||||||||||||||||
| 33 | 1 | ▶ | printf " Home Directory: %s\n", $subaccount->home_directory // '-'; | ||||||||||||||||||
|
Condition50%1/2
$subaccount->home_directory // "-"
MC/DC0%0/1
$subaccount->home_directory // "-"
$subaccount->home_directory
Truth table50%1/2
A
A= $subaccount->home_directory
| |||||||||||||||||||||
| 34 | 1 | ▶ | printf " Description: %s\n", ($subaccount->description // '') ne '' ? $subaccount->description : '-'; | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$subaccount->description // ""
MC/DC0%0/1
$subaccount->description // ""
$subaccount->description
Truth table50%1/2
A
A= $subaccount->description
| |||||||||||||||||||||
| 35 | 1 | ▶ | printf " Created: %s\n", $subaccount->created // '-'; | ||||||||||||||||||
|
Condition50%1/2
$subaccount->created // "-"
MC/DC0%0/1
$subaccount->created // "-"
$subaccount->created
Truth table50%1/2
A
A= $subaccount->created
| |||||||||||||||||||||
| 36 | 1 | ▶ | my $labels = $subaccount->labels // {}; | ||||||||||||||||||
|
Condition50%1/2
$subaccount->labels // {}
MC/DC0%0/1
$subaccount->labels // {}
$subaccount->labels
Truth table50%1/2
A
A= $subaccount->labels
| |||||||||||||||||||||
| 37 | 1 | ▶ | if (%$labels) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 38 | 1 | print " Labels:\n"; | |||||||||||||||||||
| 39 | 1 | printf " %s: %s\n", $_, $labels->{$_} for sort keys %$labels; | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 1 | 1; | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||