« lib/WWW/Hetzner/CLI/Cmd/PrimaryIp/Cmd/Assign.pm
↑ Summary
lib/WWW/Hetzner/CLI/Cmd/Network/Cmd/AddRoute.pm »
| 1 | package WWW::Hetzner::CLI::Cmd::Volume::Cmd::Resize; | ||||||||||
| 2 | # ABSTRACT: Resize a volume | ||||||||||
| 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 volume resize <id> --size <gb>'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | with 'WWW::Hetzner::CLI::Role::WaitsForAction'; | |||||||||
| 10 | |||||||||||
| 11 | 1 | option size => ( | |||||||||
| 12 | is => 'ro', | ||||||||||
| 13 | format => 'i', | ||||||||||
| 14 | required => 1, | ||||||||||
| 15 | doc => 'New size in GB (can only increase)', | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 1 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||
| 19 | 1 | my ($self, $args, $chain) = @_; | |||||||||
| 20 | 1 | ▶ | my $id = $args->[0] or die "Usage: hcloud.pl volume resize <id> --size <gb>\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | |||||||||||
| 22 | 1 | my $main = $chain->[0]; | |||||||||
| 23 | 1 | my $cloud = $main->cloud; | |||||||||
| 24 | |||||||||||
| 25 | 1 | print "Resizing volume $id to ", $self->size, " GB...\n"; | |||||||||
| 26 | 1 | my $action = $cloud->volumes->resize($id, $self->size); | |||||||||
| 27 | 1 | $self->handle_action($action); | |||||||||
| 28 | 1 | ▶ | print $self->no_wait ? "Volume resize requested.\n" : "Volume resized.\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 1 | 1; | |||||||||
| 32 | |||||||||||
| 33 | __END__ | ||||||||||