« lib/WWW/Hetzner/Robot/CLI/Cmd/Boot/Cmd/Rescue.pm
↑ Summary
lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Snapshot/Cmd/RemoveLabel.pm »
| 1 | package WWW::Hetzner::CLI::Cmd::LoadBalancer::Cmd::List; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: List load balancers | ||||||||||||||||||||||||||||||||||||||||||
| 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 load-balancer list'; | ||||||||||||||||||||||||||||||||||||||||
|
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=8 SCAR=25.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | my ($self, $args, $chain) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | my $main = $chain->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | my $cloud = $main->cloud; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | my $lbs = $cloud->load_balancers->list_all; | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | if ($main->output eq 'json') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | print encode_json([ map { $_->data } @$lbs ]), "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | if (!@$lbs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | print "No load balancers found.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | printf "%-8s %-25s %-10s %-18s %-10s\n", 'ID', 'NAME', 'TYPE', 'IPV4', 'LOCATION'; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | printf "%-8s %-25s %-10s %-18s %-10s\n", '-' x 8, '-' x 25, '-' x 10, '-' x 18, '-' x 10; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | for my $lb (@$lbs) { | |||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | printf "%-8s %-25s %-10s %-18s %-10s\n", | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%4/8
$lb->name // "-"
$lb->type_name // "-"
$lb->ipv4 // "-"
$lb->location_name // "-"
MC/DC0%0/1
$lb->name // "-"
$lb->name
MC/DC0%0/1
$lb->type_name // "-"
$lb->type_name
MC/DC0%0/1
$lb->ipv4 // "-"
$lb->ipv4
MC/DC0%0/1
$lb->location_name // "-"
$lb->location_name
Truth table50%1/2
A
A= $lb->name
Truth table50%1/2
A
A= $lb->type_name
Truth table50%1/2
A
A= $lb->ipv4
Truth table50%1/2
A
A= $lb->location_name
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | $lb->id, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | $lb->name // '-', | ||||||||||||||||||||||||||||||||||||||||||
| 36 | $lb->type_name // '-', | ||||||||||||||||||||||||||||||||||||||||||
| 37 | $lb->ipv4 // '-', | ||||||||||||||||||||||||||||||||||||||||||
| 38 | $lb->location_name // '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | __END__ | ||||||||||||||||||||||||||||||||||||||||||