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