lib/WWW/Hetzner/Storage/StorageBox.pm

filter: Statementstmt 69.6% 55 / 79 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 61.9% 13 / 21 Podpod 100% 14 / 14 totaltotal 71.5% 83 / 116 CC 2 SCAR 3.8
CC
2
Cov
69%
_require_id
2.1
folders
2.0
change_protection
2.0
CRAP 1.5
« lib/WWW/Hetzner/Robot/Key.pm ↑ Summary lib/WWW/Hetzner/Cloud/API/Pricing.pm »
1 package WWW::Hetzner::Storage::StorageBox;
2 # ABSTRACT: Hetzner Storage Box object
3  
4 11 our $VERSION = '0.102';
5  
6 11 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 with 'WWW::Hetzner::Role::HasAction';
8 11 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 11 ▶use WWW::Hetzner::Storage::API::Actions;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use WWW::Hetzner::Storage::API::Snapshots;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 11 ▶use WWW::Hetzner::Storage::API::Subaccounts;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 11 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15 11 has _client => (
16 is => 'ro',
17 required => 1,
18 weak_ref => 1,
19 init_arg => 'client',
20 );
21  
22 11 has id => ( is => 'ro' );
23 11 has name => ( is => 'rw' );
24 11 has storage_box_type => ( is => 'ro' );
25 11 has location => ( is => 'ro' );
26 11 has access_settings => ( is => 'ro' );
27 11 has snapshot_plan => ( is => 'ro' );
28 11 has protection => ( is => 'ro' );
29 11 has labels => ( is => 'rw' );
30 11 has status => ( is => 'ro' );
31 11 has username => ( is => 'ro' );
32 11 has server => ( is => 'ro' );
33 11 has system => ( is => 'ro' );
34 11 has stats => ( is => 'ro' );
35 11 has created => ( is => 'ro' );
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51 11 ▶sub _require_id {
Subroutine _require_id: called CC=2 SCAR=7.2
52 11 my ($self) = @_;
53 11 ▶ croak 'Cannot use Storage Box without ID' unless $self->id;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->id 0 11 11
54 }
55  
56  
57 1 ▶sub update {
Subroutine update: called CC=1 SCAR=0.0
Pod documented
58 1 my ($self) = @_;
59 1 $self->_require_id;
60  
61 1 return $self->_client->storage_boxes->update(
62 $self->id,
63 name => $self->name,
64 labels => $self->labels,
65 );
66 }
67  
68  
69 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
Pod documented
70 1 my ($self) = @_;
71 1 $self->_require_id;
72 1 return $self->_client->storage_boxes->delete($self->id);
73 }
74  
75  
76 0 ▶sub folders {
Subroutine folders: not called CC=1 SCAR=6.9
Pod documented
77 0 my ($self, %params) = @_;
78 0 $self->_require_id;
79 0 return $self->_client->storage_boxes->folders($self->id, %params);
80 }
81  
82  
83 1 ▶sub actions {
Subroutine actions: called CC=1 SCAR=0.0
Pod documented
84 1 my ($self) = @_;
85 1 $self->_require_id;
86  
87 1 return WWW::Hetzner::Storage::API::Actions->new(
88 client => $self->_client,
89 storage_box_id => $self->id,
90 );
91 }
92  
93  
94 5 ▶sub subaccounts {
Subroutine subaccounts: called CC=1 SCAR=0.0
Pod documented
95 5 my ($self) = @_;
96 5 $self->_require_id;
97  
98 5 return WWW::Hetzner::Storage::API::Subaccounts->new(
99 client => $self->_client,
100 storage_box_id => $self->id,
101 );
102 }
103  
104  
105 3 ▶sub snapshots {
Subroutine snapshots: called CC=1 SCAR=0.0
Pod documented
106 3 my ($self) = @_;
107 3 $self->_require_id;
108  
109 3 return WWW::Hetzner::Storage::API::Snapshots->new(
110 client => $self->_client,
111 storage_box_id => $self->id,
112 );
113 }
114  
115  
116 0 ▶sub change_protection {
Subroutine change_protection: not called CC=1 SCAR=6.9
Pod documented
117 0 my ($self, %params) = @_;
118 0 $self->_require_id;
119 0 return $self->_client->storage_boxes->change_protection($self->id, %params);
120 }
121  
122  
123 0 ▶sub change_type {
Subroutine change_type: not called CC=1 SCAR=6.9
Pod documented
124 0 my ($self, %params) = @_;
125 0 $self->_require_id;
126 0 return $self->_client->storage_boxes->change_type($self->id, %params);
127 }
128  
129  
130 0 ▶sub reset_password {
Subroutine reset_password: not called CC=1 SCAR=6.9
Pod documented
131 0 my ($self, %params) = @_;
132 0 $self->_require_id;
133 0 return $self->_client->storage_boxes->reset_password($self->id, %params);
134 }
135  
136  
137 0 ▶sub update_access_settings {
Subroutine update_access_settings: not called CC=1 SCAR=6.9
Pod documented
138 0 my ($self, %params) = @_;
139 0 $self->_require_id;
140 0 return $self->_client->storage_boxes->update_access_settings($self->id, %params);
141 }
142  
143  
144 0 ▶sub rollback_snapshot {
Subroutine rollback_snapshot: not called CC=1 SCAR=6.9
Pod documented
145 0 my ($self, %params) = @_;
146 0 $self->_require_id;
147 0 return $self->_client->storage_boxes->rollback_snapshot($self->id, %params);
148 }
149  
150  
151 0 ▶sub enable_snapshot_plan {
Subroutine enable_snapshot_plan: not called CC=1 SCAR=6.9
Pod documented
152 0 my ($self, %params) = @_;
153 0 $self->_require_id;
154 0 return $self->_client->storage_boxes->enable_snapshot_plan($self->id, %params);
155 }
156  
157  
158 0 ▶sub disable_snapshot_plan {
Subroutine disable_snapshot_plan: not called CC=1 SCAR=6.9
Pod documented
159 0 my ($self) = @_;
160 0 $self->_require_id;
161 0 return $self->_client->storage_boxes->disable_snapshot_plan($self->id);
162 }
163  
164  
165 3 ▶sub data {
Subroutine data: called CC=1 SCAR=0.0
Pod documented
166 3 my ($self) = @_;
167 return {
168 3 id => $self->id,
169 name => $self->name,
170 storage_box_type => $self->storage_box_type,
171 location => $self->location,
172 access_settings => $self->access_settings,
173 snapshot_plan => $self->snapshot_plan,
174 protection => $self->protection,
175 labels => $self->labels,
176 status => $self->status,
177 username => $self->username,
178 server => $self->server,
179 system => $self->system,
180 stats => $self->stats,
181 created => $self->created,
182 };
183 }
184  
185  
186 11 1;
187  
188 __END__
« lib/WWW/Hetzner/Robot/Key.pm ↑ Summary lib/WWW/Hetzner/Cloud/API/Pricing.pm »