lib/WWW/Hetzner/CLI/Cmd/StorageBox/Cmd/Subaccount/Cmd/UpdateAccessSettings.pm

filter: Statementstmt 100% 33 / 33 Branchbran 50.0% 8 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 83.6% 46 / 55 CC 9 SCAR 20.4
CC
9
Cov
84%
execute
10.7
BEGIN
1.0
BEGIN
1.0
CRAP 7.7
« lib/WWW/Hetzner/CLI/Cmd/Zone.pm ↑ Summary lib/WWW/Hetzner/Robot/CLI/Cmd/Key.pm »
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
BranchTrueFalseTotal
my $id = $args->[0] or die "Usage: hcloud.pl storage-box subaccount update-access-settings <storage-box> <subaccount>\n" 1 0 1
22 1 ▶ my $sub = $args->[1] or die "Usage: hcloud.pl storage-box subaccount update-access-settings <storage-box> <subaccount>\n";
Branch: 1 branch
BranchTrueFalseTotal
my $sub = $args->[1] or die "Usage: hcloud.pl storage-box subaccount update-access-settings <storage-box> <subaccount>\n" 1 0 1
23  
24 1 my %body;
25 1 ▶ $body{samba_enabled} = $self->enable_samba if defined $self->enable_samba;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->enable_samba 1 0 1
26 1 ▶ $body{ssh_enabled} = $self->enable_ssh if defined $self->enable_ssh;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->enable_ssh 1 0 1
27 1 ▶ $body{webdav_enabled} = $self->enable_webdav if defined $self->enable_webdav;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->enable_webdav 1 0 1
28 1 ▶ $body{reachable_externally} = $self->reachable_externally if defined $self->reachable_externally;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->reachable_externally 1 0 1
29 1 ▶ $body{readonly} = $self->readonly if defined $self->readonly;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->readonly 1 0 1
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
BranchTrueFalseTotal
$self->no_wait ? : 1 0 1
38 }
39  
40 1 1;
41  
42 __END__
« lib/WWW/Hetzner/CLI/Cmd/Zone.pm ↑ Summary lib/WWW/Hetzner/Robot/CLI/Cmd/Key.pm »