| 1 | package WWW::Hetzner::CLI::Cmd::StorageBox::Cmd::UpdateAccessSettings; | ||||||||||
| 2 | # ABSTRACT: Update Storage Box access settings | ||||||||||
| 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 storage-box update-access-settings [options] <storage-box>'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | with 'WWW::Hetzner::CLI::Role::WaitsForAction'; | |||||||||
| 10 | |||||||||||
| 11 | |||||||||||
| 12 | 1 | option enable_samba => ( is => 'ro', negativable => 1, doc => 'Enable Samba' ); | |||||||||
| 13 | 1 | option enable_ssh => ( is => 'ro', negativable => 1, doc => 'Enable SSH' ); | |||||||||
| 14 | 1 | option enable_webdav => ( is => 'ro', negativable => 1, doc => 'Enable WebDAV' ); | |||||||||
| 15 | 1 | option enable_zfs => ( is => 'ro', negativable => 1, doc => 'Show the ZFS Snapshot folder' ); | |||||||||
| 16 | 1 | option reachable_externally => ( is => 'ro', negativable => 1, doc => 'Allow access outside Hetzner networks' ); | |||||||||
| 17 | |||||||||||
| 18 | 1 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: called CC=8 SCAR=22.4
Pod
undocumented
| |||||||||||
| 19 | 1 | my ($self, $args, $chain) = @_; | |||||||||
| 20 | 1 | ▶ | my $id = $args->[0] or die "Usage: hcloud.pl storage-box update-access-settings <storage-box>\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | |||||||||||
| 22 | 1 | my %body; | |||||||||
| 23 | 1 | ▶ | $body{samba_enabled} = $self->enable_samba if defined $self->enable_samba; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 1 | ▶ | $body{ssh_enabled} = $self->enable_ssh if defined $self->enable_ssh; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 1 | ▶ | $body{webdav_enabled} = $self->enable_webdav if defined $self->enable_webdav; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 1 | ▶ | $body{zfs_enabled} = $self->enable_zfs if defined $self->enable_zfs; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 1 | ▶ | $body{reachable_externally} = $self->reachable_externally if defined $self->reachable_externally; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | |||||||||||
| 29 | 1 | my $action = $chain->[0]->storage->storage_boxes->update_access_settings($id, %body); | |||||||||
| 30 | 1 | $self->handle_action($action); | |||||||||
| 31 | 1 | ▶ | print $self->no_wait ? "Storage Box access settings update requested.\n" : "Storage Box access settings updated.\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 1 | 1; | |||||||||
| 35 | |||||||||||
| 36 | __END__ | ||||||||||