lib/WWW/Hetzner/Cloud/PlacementGroup.pm

filter: Statementstmt 61.2% 19 / 31 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 37.5% 3 / 8 Podpod 100% 3 / 3 totaltotal 54.3% 25 / 46 CC 3 SCAR 11.4
CC
3
Cov
54%
update
6.0
delete
6.0
data
2.0
CRAP 3.1
« lib/WWW/Hetzner/Cloud/API/RRSets.pm ↑ Summary lib/WWW/Hetzner/Storage/API/StorageBoxes.pm »
1 package WWW::Hetzner::Cloud::PlacementGroup;
2 # ABSTRACT: Hetzner Cloud Placement Group object
3  
4 60 our $VERSION = '0.102';
5  
6 60 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 60 with 'WWW::Hetzner::Role::HasAction';
8 60 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 60 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 60 has _client => (
13 is => 'ro',
14 required => 1,
15 weak_ref => 1,
16 init_arg => 'client',
17 );
18  
19 60 has id => ( is => 'ro' );
20  
21  
22 60 has name => ( is => 'rw' );
23  
24  
25 60 has type => ( is => 'ro' );
26  
27  
28 0 ▶has servers => ( is => 'ro', default => sub { [] } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
29  
30  
31 0 ▶has labels => ( is => 'rw', default => sub { {} } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
32  
33  
34 60 has created => ( is => 'ro' );
35  
36  
37 # Actions
38 0 ▶sub update {
Subroutine update: not called CC=2 SCAR=17.9
Pod documented
39 0 my ($self) = @_;
40 0 ▶ croak "Cannot update placement group without ID" unless $self->id;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->id 0 0 0
41  
42 0 $self->_client->put("/placement_groups/" . $self->id, {
43 name => $self->name,
44 labels => $self->labels,
45 });
46 0 return $self;
47 }
48  
49  
50 0 ▶sub delete {
Subroutine delete: not called CC=2 SCAR=17.9
Pod documented
51 0 my ($self) = @_;
52 0 ▶ croak "Cannot delete placement group without ID" unless $self->id;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->id 0 0 0
53  
54 0 $self->_client->delete("/placement_groups/" . $self->id);
55 0 return 1;
56 }
57  
58  
59 0 ▶sub data {
Subroutine data: not called CC=1 SCAR=6.9
Pod documented
60 0 my ($self) = @_;
61 return {
62 0 id => $self->id,
63 name => $self->name,
64 type => $self->type,
65 servers => $self->servers,
66 labels => $self->labels,
67 created => $self->created,
68 };
69 }
70  
71  
72  
73 60 1.
74  
75 __END__
« lib/WWW/Hetzner/Cloud/API/RRSets.pm ↑ Summary lib/WWW/Hetzner/Storage/API/StorageBoxes.pm »