« lib/WWW/Hetzner/CLI/Cmd/Volume/Cmd/Detach.pm
↑ Summary
lib/WWW/Hetzner/CLI/Cmd/FloatingIp/Cmd/Assign.pm »
| 1 | package WWW::Hetzner::CLI::Cmd::Firewall::Cmd::RemoveFrom; | ||||||||||
| 2 | # ABSTRACT: Remove a firewall from a 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: hcloud.pl firewall remove-from <firewall-id> --server <server-id>'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | with 'WWW::Hetzner::CLI::Role::WaitsForAction'; | |||||||||
| 10 | |||||||||||
| 11 | 1 | option server => ( | |||||||||
| 12 | is => 'ro', | ||||||||||
| 13 | format => 'i', | ||||||||||
| 14 | required => 1, | ||||||||||
| 15 | doc => 'Server ID to remove firewall from', | ||||||||||
| 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 firewall remove-from <firewall-id> --server <server-id>\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | |||||||||||
| 22 | 1 | my $main = $chain->[0]; | |||||||||
| 23 | 1 | my $cloud = $main->cloud; | |||||||||
| 24 | |||||||||||
| 25 | 1 | print "Removing firewall $id from server ", $self->server, "...\n"; | |||||||||
| 26 | 1 | my $actions = $cloud->firewalls->remove_from_resources($id, | |||||||||
| 27 | { type => 'server', server => { id => $self->server } }, | ||||||||||
| 28 | ); | ||||||||||
| 29 | 1 | $self->handle_action($actions); | |||||||||
| 30 | 1 | ▶ | print $self->no_wait ? "Firewall removal requested.\n" : "Firewall removed.\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 1 | 1; | |||||||||
| 34 | |||||||||||
| 35 | __END__ | ||||||||||