blib/lib/Cloudflare/API/SecretsStore.pm

filter: Statementstmt 56.5% 26 / 46 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 44.4% 8 / 18 Podpod 0.0% 0 / 14 totaltotal 42.7% 38 / 89 CC 5 SCAR 6.8
CC
5
Cov
55%
create_secret
3.5
create_store
2.0
update_secret
2.0
CRAP 2.0
« blib/lib/Cloudflare/API/Resource.pm ↑ Summary blib/lib/Cloudflare/API/Queues.pm »
1 #
2 # This file is part of Cloudflare::API.
3 #
4 # This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 # Full license text is available at:
10 #
11 # <http://dev.perl.org/licenses/>
12 #
13 package Cloudflare::API::SecretsStore;
14  
15  
16 # Compiler Pragma
17 #
18 1 ▶use strict qw(vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use vars qw(@ISA $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22  
23 # Cloudflare::API modules and inheritance
24 #
25 1 ▶use Cloudflare::API::Resource;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 @ISA=qw(Cloudflare::API::Resource);
27  
28  
29 # Version information
30 #
31 1 $VERSION='1.011';
32  
33  
34 # All done. Positive return
35 #
36 1 1;
37  
38  
39 #============================================================================
40  
41  
42 0 ▶sub list_stores {
Subroutine list_stores: not called CC=1 SCAR=6.9
Pod undocumented
43  
44 0 my ($self, %query)=@_;
45 0 return $self->collect_list($self->list_stores_page(%query));
46  
47 }
48  
49  
50 0 ▶sub list_stores_page {
Subroutine list_stores_page: not called CC=1 SCAR=6.9
Pod undocumented
51  
52 0 my ($self, %query)=@_;
53 0 return $self->list_pagination(
54 $self->api()->account_path('secrets_store', 'stores'),
55 { mode => 'page' }, \%query);
56  
57 }
58  
59  
60 0 ▶sub list_stores_page_response {
Subroutine list_stores_page_response: not called CC=1 SCAR=6.9
Pod undocumented
61  
62 0 my ($self, %query)=@_;
63 0 return $self->list_response(
64 $self->api()->account_path('secrets_store', 'stores'), \%query);
65  
66 }
67  
68  
69 0 ▶sub get_store {
Subroutine get_store: not called CC=1 SCAR=6.9
Pod undocumented
70  
71 0 my ($self, $id, %opt)=@_;
72 0 return $self->api()->request('GET',
73 $self->api()->account_path('secrets_store', 'stores', $id), %opt);
74  
75 }
76  
77  
78 1 ▶sub create_store {
Subroutine create_store: called CC=2 SCAR=7.1
Pod undocumented
79  
80 1 my ($self, $body_hr, %opt)=@_;
81 1 ▶ die "store body must be a hash reference\n" unless ref($body_hr) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $body_hr eq "HASH" 0 1 1
82 1 return $self->api()->request('POST',
83 $self->api()->account_path('secrets_store', 'stores'), json => $body_hr, %opt);
84  
85 }
86  
87  
88 0 ▶sub delete_store {
Subroutine delete_store: not called CC=1 SCAR=6.9
Pod undocumented
89  
90 0 my ($self, $id, %opt)=@_;
91 0 return $self->api()->request('DELETE',
92 $self->api()->account_path('secrets_store', 'stores', $id), %opt);
93  
94 }
95  
96  
97 0 ▶sub list_secrets {
Subroutine list_secrets: not called CC=1 SCAR=6.9
Pod undocumented
98  
99 0 my ($self, $store_id, %query)=@_;
100 0 return $self->collect_list($self->list_secrets_page($store_id, %query));
101  
102 }
103  
104  
105 0 ▶sub list_secrets_page {
Subroutine list_secrets_page: not called CC=1 SCAR=6.9
Pod undocumented
106  
107 0 my ($self, $store_id, %query)=@_;
108 0 return $self->list_pagination(
109 $self->api()->account_path('secrets_store', 'stores', $store_id, 'secrets'),
110 { mode => 'page' }, \%query);
111  
112 }
113  
114  
115 0 ▶sub list_secrets_page_response {
Subroutine list_secrets_page_response: not called CC=1 SCAR=6.9
Pod undocumented
116  
117 0 my ($self, $store_id, %query)=@_;
118 0 return $self->list_response(
119 $self->api()->account_path('secrets_store', 'stores', $store_id, 'secrets'), \%query);
120  
121 }
122  
123  
124 0 ▶sub get_secret {
Subroutine get_secret: not called CC=1 SCAR=6.9
Pod undocumented
125  
126 0 my ($self, $store_id, $secret_id, %opt)=@_;
127 0 return $self->api()->request('GET',
128 $self->api()->account_path('secrets_store', 'stores', $store_id, 'secrets', $secret_id),
129 %opt);
130  
131 }
132  
133  
134 1 ▶sub create_secret {
Subroutine create_secret: called CC=3 SCAR=12.5
Pod undocumented
135  
136  
137 # Cloudflare accepts an array even when creating one secret
138 #
139 1 my ($self, $store_id, $body_ar, %opt)=@_;
140 1 ▶ die "secret body must be a non-empty array reference\n"
Branch: 1 branch
BranchTrueFalseTotal
unless ref $body_ar eq "ARRAY" and @$body_ar 0 1 1
Condition33%1/3
ref $body_ar eq "ARRAY" and @$body_ar
!ll&&!rl&&r
001
MC/DC0%0/2
ref $body_ar eq "ARRAY" and @$body_ar
ref $body_ar eq "ARRAY" @$body_ar
Truth table33%1/3
A and B
A= ref $body_ar eq "ARRAY"B= @$body_ar
ABresult
0X0
100
111
141 unless ref($body_ar) eq 'ARRAY'&&@$body_ar;
142 1 return $self->api()->request('POST',
143 $self->api()->account_path('secrets_store', 'stores', $store_id, 'secrets'),
144 json => $body_ar, %opt);
145  
146 }
147  
148  
149 1 ▶sub update_secret {
Subroutine update_secret: called CC=2 SCAR=7.1
Pod undocumented
150  
151 1 my ($self, $store_id, $secret_id, $body_hr, %opt)=@_;
152 1 ▶ die "secret body must be a hash reference\n" unless ref($body_hr) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $body_hr eq "HASH" 0 1 1
153 1 return $self->api()->request('PATCH',
154 $self->api()->account_path('secrets_store', 'stores', $store_id, 'secrets', $secret_id),
155 json => $body_hr, %opt);
156  
157 }
158  
159  
160 0 ▶sub delete_secret {
Subroutine delete_secret: not called CC=1 SCAR=6.9
Pod undocumented
161  
162 0 my ($self, $store_id, $secret_id, %opt)=@_;
163 0 return $self->api()->request('DELETE',
164 $self->api()->account_path('secrets_store', 'stores', $store_id, 'secrets', $secret_id),
165 %opt);
166  
167 }
168  
169  
170 1 ▶sub get_quota {
Subroutine get_quota: called CC=1 SCAR=0.0
Pod undocumented
171  
172 1 my ($self, %opt)=@_;
173 1 return $self->api()->request('GET',
174 $self->api()->account_path('secrets_store', 'quota'), %opt);
175  
176 }
177 __END__
« blib/lib/Cloudflare/API/Resource.pm ↑ Summary blib/lib/Cloudflare/API/Queues.pm »