lib/WWW/Hetzner/Cloud/PlacementGroup.pm

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