Fastly/KvStoreApi.pm untested

filter: Statementstmt 0.0% 0 / 168 Branchbran 0.0% 0 / 42 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 240 CC 22 SCAR 31.2
CC
22
Cov
0%
kv_store_list
42.0
kv_store_create
30.0
kv_store_get
30.0
CRAP 22.6
1 =begin comment
2  
3 Fastly API
4  
5 Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
6  
7 The version of the API Spec document: 1.0.0
8 Contact: oss@fastly.com
9  
10 =end comment
11  
12 =cut
13  
14 #
15 # NOTE: This class is auto generated.
16 # Do not edit the class manually.
17 #
18 package WebService::Fastly::KvStoreApi;
19  
20 require 5.6.0;
21 use strict;
22 use warnings;
23 use utf8;
24 use Exporter;
25 use Carp qw( croak );
26 use Log::Any qw($log);
27  
28 use WebService::Fastly::ApiClient;
29  
30 use base "Class::Data::Inheritable";
31  
32 __PACKAGE__->mk_classdata('method_documentation' => {});
33  
34 sub new {
35 my $class = shift;
36 my $api_client;
37  
38 if ($_[0] && ref $_[0] && ref $_[0] eq 'WebService::Fastly::ApiClient' ) {
39 $api_client = $_[0];
40 } else {
41 $api_client = WebService::Fastly::ApiClient->new(@_);
42 }
43  
44 bless { api_client => $api_client }, $class;
45  
46 }
47  
48  
49 #
50 # kv_store_create
51 #
52 # Create a KV store.
53 #
54 # @param string $location (optional)
55 # @param KvStoreRequestCreateOrUpdate $kv_store_request_create_or_update (optional)
56 {
57 my $params = {
58 'location' => {
59 data_type => 'string',
60 description => '',
61 required => '0',
62 },
63 'kv_store_request_create_or_update' => {
64 data_type => 'KvStoreRequestCreateOrUpdate',
65 description => '',
66 required => '0',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'kv_store_create' } = {
70 summary => 'Create a KV store.',
71 params => $params,
72 returns => 'KvStoreDetails',
73 };
74 }
75 # @return KvStoreDetails
76 #
77 sub kv_store_create {
78 my ($self, %args) = @_;
79  
80 # parse inputs
81 my $_resource_path = '/resources/stores/kv';
82  
83 my $_method = 'POST';
84 my $query_params = {};
85 my $header_params = {};
86 my $form_params = {};
87  
88 # 'Accept' and 'Content-Type' header
89 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
90 if ($_header_accept) {
91 $header_params->{'Accept'} = $_header_accept;
92 }
93 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
94  
95 # query params
96 if ( exists $args{'location'}) {
97 $query_params->{'location'} = $self->{api_client}->to_query_value($args{'location'});
98 }
99  
100 my $_body_data;
101 # body params
102 if ( exists $args{'kv_store_request_create_or_update'}) {
103 $_body_data = $args{'kv_store_request_create_or_update'};
104 }
105  
106 # authentication setting, if any
107 my $auth_settings = [qw(token )];
108  
109 # make the API Call
110 my $response = $self->{api_client}->call_api($_resource_path, $_method,
111 $query_params, $form_params,
112 $header_params, $_body_data, $auth_settings);
113 if (!$response) {
114 return;
115 }
116 my $_response_object = $self->{api_client}->deserialize('KvStoreDetails', $response);
117 return $_response_object;
118 }
119  
120 #
121 # kv_store_delete
122 #
123 # Delete a KV store.
124 #
125 # @param string $store_id (required)
126 {
127 my $params = {
128 'store_id' => {
129 data_type => 'string',
130 description => '',
131 required => '1',
132 },
133 };
134 __PACKAGE__->method_documentation->{ 'kv_store_delete' } = {
135 summary => 'Delete a KV store.',
136 params => $params,
137 returns => undef,
138 };
139 }
140 # @return void
141 #
142 sub kv_store_delete {
143 my ($self, %args) = @_;
144  
145 # verify the required parameter 'store_id' is set
146 unless (exists $args{'store_id'}) {
147 croak("Missing the required parameter 'store_id' when calling kv_store_delete");
148 }
149  
150 # parse inputs
151 my $_resource_path = '/resources/stores/kv/{store_id}';
152  
153 my $_method = 'DELETE';
154 my $query_params = {};
155 my $header_params = {};
156 my $form_params = {};
157  
158 # 'Accept' and 'Content-Type' header
159 my $_header_accept = $self->{api_client}->select_header_accept();
160 if ($_header_accept) {
161 $header_params->{'Accept'} = $_header_accept;
162 }
163 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
164  
165 # path params
166 if ( exists $args{'store_id'}) {
167 my $_base_variable = "{" . "store_id" . "}";
168 my $_base_value = $self->{api_client}->to_path_value($args{'store_id'});
169 $_resource_path =~ s/$_base_variable/$_base_value/g;
170 }
171  
172 my $_body_data;
173 # authentication setting, if any
174 my $auth_settings = [qw(token )];
175  
176 # make the API Call
177 $self->{api_client}->call_api($_resource_path, $_method,
178 $query_params, $form_params,
179 $header_params, $_body_data, $auth_settings);
180 return;
181 }
182  
183 #
184 # kv_store_get
185 #
186 # Describe a KV store.
187 #
188 # @param string $store_id (required)
189 {
190 my $params = {
191 'store_id' => {
192 data_type => 'string',
193 description => '',
194 required => '1',
195 },
196 };
197 __PACKAGE__->method_documentation->{ 'kv_store_get' } = {
198 summary => 'Describe a KV store.',
199 params => $params,
200 returns => 'KvStoreDetails',
201 };
202 }
203 # @return KvStoreDetails
204 #
205 sub kv_store_get {
206 my ($self, %args) = @_;
207  
208 # verify the required parameter 'store_id' is set
209 unless (exists $args{'store_id'}) {
210 croak("Missing the required parameter 'store_id' when calling kv_store_get");
211 }
212  
213 # parse inputs
214 my $_resource_path = '/resources/stores/kv/{store_id}';
215  
216 my $_method = 'GET';
217 my $query_params = {};
218 my $header_params = {};
219 my $form_params = {};
220  
221 # 'Accept' and 'Content-Type' header
222 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
223 if ($_header_accept) {
224 $header_params->{'Accept'} = $_header_accept;
225 }
226 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
227  
228 # path params
229 if ( exists $args{'store_id'}) {
230 my $_base_variable = "{" . "store_id" . "}";
231 my $_base_value = $self->{api_client}->to_path_value($args{'store_id'});
232 $_resource_path =~ s/$_base_variable/$_base_value/g;
233 }
234  
235 my $_body_data;
236 # authentication setting, if any
237 my $auth_settings = [qw(token )];
238  
239 # make the API Call
240 my $response = $self->{api_client}->call_api($_resource_path, $_method,
241 $query_params, $form_params,
242 $header_params, $_body_data, $auth_settings);
243 if (!$response) {
244 return;
245 }
246 my $_response_object = $self->{api_client}->deserialize('KvStoreDetails', $response);
247 return $_response_object;
248 }
249  
250 #
251 # kv_store_list
252 #
253 # List all KV stores.
254 #
255 # @param string $cursor (optional)
256 # @param int $limit (optional, default to 1000)
257 # @param string $name Returns a one-element array containing the details for the named KV store. (optional)
258 {
259 my $params = {
260 'cursor' => {
261 data_type => 'string',
262 description => '',
263 required => '0',
264 },
265 'limit' => {
266 data_type => 'int',
267 description => '',
268 required => '0',
269 },
270 'name' => {
271 data_type => 'string',
272 description => 'Returns a one-element array containing the details for the named KV store.',
273 required => '0',
274 },
275 };
276 __PACKAGE__->method_documentation->{ 'kv_store_list' } = {
277 summary => 'List all KV stores.',
278 params => $params,
279 returns => 'InlineResponse20017',
280 };
281 }
282 # @return InlineResponse20017
283 #
284 sub kv_store_list {
285 my ($self, %args) = @_;
286  
287 # parse inputs
288 my $_resource_path = '/resources/stores/kv';
289  
290 my $_method = 'GET';
291 my $query_params = {};
292 my $header_params = {};
293 my $form_params = {};
294  
295 # 'Accept' and 'Content-Type' header
296 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
297 if ($_header_accept) {
298 $header_params->{'Accept'} = $_header_accept;
299 }
300 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
301  
302 # query params
303 if ( exists $args{'cursor'}) {
304 $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'});
305 }
306  
307 # query params
308 if ( exists $args{'limit'}) {
309 $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'});
310 }
311  
312 # query params
313 if ( exists $args{'name'}) {
314 $query_params->{'name'} = $self->{api_client}->to_query_value($args{'name'});
315 }
316  
317 my $_body_data;
318 # authentication setting, if any
319 my $auth_settings = [qw(token )];
320  
321 # make the API Call
322 my $response = $self->{api_client}->call_api($_resource_path, $_method,
323 $query_params, $form_params,
324 $header_params, $_body_data, $auth_settings);
325 if (!$response) {
326 return;
327 }
328 my $_response_object = $self->{api_client}->deserialize('InlineResponse20017', $response);
329 return $_response_object;
330 }
331  
332 #
333 # kv_store_put
334 #
335 # Update a KV store.
336 #
337 # @param string $store_id (required)
338 # @param KvStoreRequestCreateOrUpdate $kv_store_request_create_or_update (optional)
339 {
340 my $params = {
341 'store_id' => {
342 data_type => 'string',
343 description => '',
344 required => '1',
345 },
346 'kv_store_request_create_or_update' => {
347 data_type => 'KvStoreRequestCreateOrUpdate',
348 description => '',
349 required => '0',
350 },
351 };
352 __PACKAGE__->method_documentation->{ 'kv_store_put' } = {
353 summary => 'Update a KV store.',
354 params => $params,
355 returns => undef,
356 };
357 }
358 # @return void
359 #
360 sub kv_store_put {
361 my ($self, %args) = @_;
362  
363 # verify the required parameter 'store_id' is set
364 unless (exists $args{'store_id'}) {
365 croak("Missing the required parameter 'store_id' when calling kv_store_put");
366 }
367  
368 # parse inputs
369 my $_resource_path = '/resources/stores/kv/{store_id}';
370  
371 my $_method = 'PUT';
372 my $query_params = {};
373 my $header_params = {};
374 my $form_params = {};
375  
376 # 'Accept' and 'Content-Type' header
377 my $_header_accept = $self->{api_client}->select_header_accept();
378 if ($_header_accept) {
379 $header_params->{'Accept'} = $_header_accept;
380 }
381 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
382  
383 # path params
384 if ( exists $args{'store_id'}) {
385 my $_base_variable = "{" . "store_id" . "}";
386 my $_base_value = $self->{api_client}->to_path_value($args{'store_id'});
387 $_resource_path =~ s/$_base_variable/$_base_value/g;
388 }
389  
390 my $_body_data;
391 # body params
392 if ( exists $args{'kv_store_request_create_or_update'}) {
393 $_body_data = $args{'kv_store_request_create_or_update'};
394 }
395  
396 # authentication setting, if any
397 my $auth_settings = [qw(token )];
398  
399 # make the API Call
400 $self->{api_client}->call_api($_resource_path, $_method,
401 $query_params, $form_params,
402 $header_params, $_body_data, $auth_settings);
403 return;
404 }
405  
406 1;