« lib/WWW/Hetzner/Robot/CLI/Cmd/Boot/Cmd/Windows.pm
↑ Summary
lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/List.pm »
| 1 | package WWW::Hetzner::Robot::CLI::Cmd::Server::Cmd::Describe; | ||||||||||||
| 2 | # ABSTRACT: Describe a dedicated server | ||||||||||||
| 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: hrobot.pl server describe <server-number> [options]'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | |||||||||||||
| 11 | 1 | ▶ | sub execute { | ||||||||||
|
Subroutine
execute: called CC=12 SCAR=29.0
Pod
undocumented
| |||||||||||||
| 12 | 1 | my ($self, $args, $chain) = @_; | |||||||||||
| 13 | 1 | my $root = $chain->[0]; | |||||||||||
| 14 | 1 | my $robot = $root->robot; | |||||||||||
| 15 | |||||||||||||
| 16 | 1 | ▶ | my $server_number = $args->[0] or die "Usage: hrobot.pl server describe <server-number>\n"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | |||||||||||||
| 18 | 1 | my $s = $robot->servers->get($server_number); | |||||||||||
| 19 | |||||||||||||
| 20 | 1 | ▶ | if ($root->output eq 'json') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | 0 | require JSON::MaybeXS; | |||||||||||
| 22 | 0 | print JSON::MaybeXS::encode_json({ | |||||||||||
| 23 | server_number => $s->server_number, | ||||||||||||
| 24 | server_name => $s->server_name, | ||||||||||||
| 25 | server_ip => $s->server_ip, | ||||||||||||
| 26 | product => $s->product, | ||||||||||||
| 27 | dc => $s->dc, | ||||||||||||
| 28 | status => $s->status, | ||||||||||||
| 29 | traffic => $s->traffic, | ||||||||||||
| 30 | cancelled => $s->cancelled, | ||||||||||||
| 31 | paid_until => $s->paid_until, | ||||||||||||
| 32 | }); | ||||||||||||
| 33 | 0 | print "\n"; | |||||||||||
| 34 | } else { | ||||||||||||
| 35 | 1 | ▶ | print "Server Number: ", $s->server_number // '', "\n"; | ||||||||||
|
Condition50%1/2
$s->server_number // ""
MC/DC0%0/1
$s->server_number // ""
$s->server_number
Truth table50%1/2
A
A= $s->server_number
| |||||||||||||
| 36 | 1 | ▶ | print "Name: ", $s->server_name // '', "\n"; | ||||||||||
|
Condition50%1/2
$s->server_name // ""
MC/DC0%0/1
$s->server_name // ""
$s->server_name
Truth table50%1/2
A
A= $s->server_name
| |||||||||||||
| 37 | 1 | ▶ | print "IP: ", $s->server_ip // '', "\n"; | ||||||||||
|
Condition50%1/2
$s->server_ip // ""
MC/DC0%0/1
$s->server_ip // ""
$s->server_ip
Truth table50%1/2
A
A= $s->server_ip
| |||||||||||||
| 38 | 1 | ▶ | print "Product: ", $s->product // '', "\n"; | ||||||||||
|
Condition50%1/2
$s->product // ""
MC/DC0%0/1
$s->product // ""
$s->product
Truth table50%1/2
A
A= $s->product
| |||||||||||||
| 39 | 1 | ▶ | print "Datacenter: ", $s->dc // '', "\n"; | ||||||||||
|
Condition50%1/2
$s->dc // ""
MC/DC0%0/1
$s->dc // ""
$s->dc
Truth table50%1/2
A
A= $s->dc
| |||||||||||||
| 40 | 1 | ▶ | print "Status: ", $s->status // '', "\n"; | ||||||||||
|
Condition50%1/2
$s->status // ""
MC/DC0%0/1
$s->status // ""
$s->status
Truth table50%1/2
A
A= $s->status
| |||||||||||||
| 41 | 1 | ▶ | print "Traffic: ", $s->traffic // '', "\n"; | ||||||||||
|
Condition50%1/2
$s->traffic // ""
MC/DC0%0/1
$s->traffic // ""
$s->traffic
Truth table50%1/2
A
A= $s->traffic
| |||||||||||||
| 42 | 1 | ▶ | print "Cancelled: ", $s->cancelled ? 'yes' : 'no', "\n"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 43 | 1 | ▶ | print "Paid Until: ", $s->paid_until // '', "\n"; | ||||||||||
|
Condition50%1/2
$s->paid_until // ""
MC/DC0%0/1
$s->paid_until // ""
$s->paid_until
Truth table50%1/2
A
A= $s->paid_until
| |||||||||||||
| 44 | } | ||||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | 1 | 1; | |||||||||||
| 48 | |||||||||||||
| 49 | __END__ | ||||||||||||