| 1 | package WWW::Hetzner::CLI::Cmd::LoadBalancerType; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Load balancer type commands | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 usage_string => 'USAGE: hcloud.pl load-balancer-type [options]'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | sub execute { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: called CC=9 SCAR=26.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | my ($self, $args, $chain) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | my $main = $chain->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | my $cloud = $main->cloud; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | my $types = $cloud->load_balancer_types->list_all; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | if ($main->output eq 'json') { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | print encode_json([ map { $_->data } @$types ]), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | if (!@$types) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | print "No load balancer types found.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | printf "%-8s %-10s %-14s %-10s %-10s %s\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 'ID', 'NAME', 'CONNECTIONS', 'SERVICES', 'TARGETS', 'CERTIFICATES'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | printf "%-8s %-10s %-14s %-10s %-10s %s\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | '-' x 8, '-' x 10, '-' x 14, '-' x 10, '-' x 10, '-' x 12; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | for my $t (@$types) { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | ▶ | printf "%-8s %-10s %-14s %-10s %-10s %s\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%5/10
$t->name // "-"
$t->max_connections // "-"
$t->max_services // "-"
$t->max_targets // "-"
$t->max_assigned_certificates // "-"
MC/DC0%0/1
$t->name // "-"
$t->name
MC/DC0%0/1
$t->max_connections // "-"
$t->max_connections
MC/DC0%0/1
$t->max_services // "-"
$t->max_services
MC/DC0%0/1
$t->max_targets // "-"
$t->max_targets
MC/DC0%0/1
$t->max_assigned_certificates // "-"
$t->max_assigned_certificates
Truth table50%1/2
A
A= $t->name
Truth table50%1/2
A
A= $t->max_connections
Truth table50%1/2
A
A= $t->max_services
Truth table50%1/2
A
A= $t->max_targets
Truth table50%1/2
A
A= $t->max_assigned_certificates
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | $t->id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | $t->name // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | $t->max_connections // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | $t->max_services // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | $t->max_targets // '-', | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | $t->max_assigned_certificates // '-'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||