Kubernetes/Resource.pm

filter: Statementstmt 90.4% 19 / 21 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 66.6% 2 / 3 totaltotal 84.3% 27 / 32 CC 3 SCAR 5.5
CC
3
Cov
84%
delete
2.1
update
2.1
BEGIN
1.0
CRAP 1.7
« my-author-experiment.pl ↑ Summary Kubernetes/Resource/Role/State.pm »
1 package Net::Kubernetes::Resource;
2 # ABSTRACT: Base class for all Net::Kubernetes::Resource objects.
3 4 $Net::Kubernetes::Resource::VERSION = '0.19';
4 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 with 'Net::Kubernetes::Role::APIAccess';
7  
8  
9 4 has kind => (
10 is => 'ro',
11 isa => 'Str',
12 required => 0,
13 );
14  
15 4 has api_version => (
16 is => 'ro',
17 isa => 'Str',
18 required => 0,
19 );
20  
21 4 has metadata => (
22 is => 'rw',
23 isa => 'HashRef',
24 required => 1
25 );
26  
27  
28 sub delete {
29 6 ▶ my($self) = @_;
Subroutine delete: called CC=2 SCAR=7.4
Pod documented
30 6 my($res) = $self->ua->request($self->create_request(DELETE => $self->path));
31 6 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) 6 0 6
32 6 return 1;
33 }
34 0 return 0;
35 }
36  
37 sub update {
38 6 ▶ my($self) = @_;
Subroutine update: called CC=2 SCAR=7.4
Pod documented
39 6 my($res) = $self->ua->request($self->create_request(PUT => $self->path, undef, $self->json->encode($self->as_hashref)));
40 6 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) 6 0 6
41 6 return 1;
42 }
43 0 return 0;
44 }
45  
46 sub as_hashref
47 {
48 6 ▶ my($self) = @_;
Subroutine as_hashref: called CC=1 SCAR=0.0
Pod undocumented
49 return {
50 6 inner(),
51 apiVersion=>$self->api_version,
52 kind=>$self->kind,
53 metadata=>$self->metadata
54 };
55 }
56  
57 4 return 42;
58  
59 __END__
60  
61 =pod
62  
63 =encoding UTF-8
64  
65 =head1 NAME
66  
67 Net::Kubernetes::Resource - Base class for all Net::Kubernetes::Resource objects.
68  
69 =head1 VERSION
70  
71 version 0.19
72  
73 =head1 METHODS
74  
75 =head2 $resource->delete
76  
77 Delete this rsource.
78  
79 =head2 $resource->update (send local changes to api server)
80  
81 Saves any changes made to metadata, or spec or any other resource type specific changes
82 made since this item was last pulled from the server.
83  
84 =head2 $resource->refresh
85  
86 Update status information from server. This is only available for reosurce types which have
87 a status field (Currently that is everything other than 'Secret' objects)
88  
89 =head1 AUTHOR
90  
91 Dave Mueller <dave@perljedi.com>
92  
93 =head1 COPYRIGHT AND LICENSE
94  
95 This software is Copyright (c) 2015 by Dave Mueller.
96  
97 This is free software, licensed under:
98  
99 The MIT (X11) License
100  
101 =head1 SEE ALSO
102  
103 Please see those modules/websites for more information related to this module.
104  
105 =over 4
106  
107 =item *
108  
109 L<Net::Kubernetes|Net::Kubernetes>
110  
111 =back
112  
113 =head1 CONSUMES
114  
115 =over 4
116  
117 =item * L<Net::Kubernetes::Role::APIAccess>
118  
119 =back
120  
121 =cut
« my-author-experiment.pl ↑ Summary Kubernetes/Resource/Role/State.pm »