Fastly/ConfigStoreApi.pm untested

filter: Statementstmt 0.0% 0 / 224 Branchbran 0.0% 0 / 56 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 17 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 314 CC 29 SCAR 31.4
CC
29
Cov
0%
update_config_store
42.0
delete_config_store
30.0
get_config_store
30.0
CRAP 23.2
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::ConfigStoreApi;
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 # create_config_store
51 #
52 # Create a config store
53 #
54 # @param string $name The name of the config store. (optional)
55 {
56 my $params = {
57 'name' => {
58 data_type => 'string',
59 description => 'The name of the config store.',
60 required => '0',
61 },
62 };
63 __PACKAGE__->method_documentation->{ 'create_config_store' } = {
64 summary => 'Create a config store',
65 params => $params,
66 returns => 'ConfigStoreResponse',
67 };
68 }
69 # @return ConfigStoreResponse
70 #
71 sub create_config_store {
72 my ($self, %args) = @_;
73  
74 # parse inputs
75 my $_resource_path = '/resources/stores/config';
76  
77 my $_method = 'POST';
78 my $query_params = {};
79 my $header_params = {};
80 my $form_params = {};
81  
82 # 'Accept' and 'Content-Type' header
83 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
84 if ($_header_accept) {
85 $header_params->{'Accept'} = $_header_accept;
86 }
87 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
88  
89 # form params
90 if ( exists $args{'name'} ) {
91 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
92 }
93  
94 my $_body_data;
95 # authentication setting, if any
96 my $auth_settings = [qw(token )];
97  
98 # make the API Call
99 my $response = $self->{api_client}->call_api($_resource_path, $_method,
100 $query_params, $form_params,
101 $header_params, $_body_data, $auth_settings);
102 if (!$response) {
103 return;
104 }
105 my $_response_object = $self->{api_client}->deserialize('ConfigStoreResponse', $response);
106 return $_response_object;
107 }
108  
109 #
110 # delete_config_store
111 #
112 # Delete a config store
113 #
114 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
115 {
116 my $params = {
117 'config_store_id' => {
118 data_type => 'string',
119 description => 'An alphanumeric string identifying the config store.',
120 required => '1',
121 },
122 };
123 __PACKAGE__->method_documentation->{ 'delete_config_store' } = {
124 summary => 'Delete a config store',
125 params => $params,
126 returns => 'InlineResponse200',
127 };
128 }
129 # @return InlineResponse200
130 #
131 sub delete_config_store {
132 my ($self, %args) = @_;
133  
134 # verify the required parameter 'config_store_id' is set
135 unless (exists $args{'config_store_id'}) {
136 croak("Missing the required parameter 'config_store_id' when calling delete_config_store");
137 }
138  
139 # parse inputs
140 my $_resource_path = '/resources/stores/config/{config_store_id}';
141  
142 my $_method = 'DELETE';
143 my $query_params = {};
144 my $header_params = {};
145 my $form_params = {};
146  
147 # 'Accept' and 'Content-Type' header
148 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
149 if ($_header_accept) {
150 $header_params->{'Accept'} = $_header_accept;
151 }
152 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
153  
154 # path params
155 if ( exists $args{'config_store_id'}) {
156 my $_base_variable = "{" . "config_store_id" . "}";
157 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
158 $_resource_path =~ s/$_base_variable/$_base_value/g;
159 }
160  
161 my $_body_data;
162 # authentication setting, if any
163 my $auth_settings = [qw(token )];
164  
165 # make the API Call
166 my $response = $self->{api_client}->call_api($_resource_path, $_method,
167 $query_params, $form_params,
168 $header_params, $_body_data, $auth_settings);
169 if (!$response) {
170 return;
171 }
172 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
173 return $_response_object;
174 }
175  
176 #
177 # get_config_store
178 #
179 # Describe a config store
180 #
181 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
182 {
183 my $params = {
184 'config_store_id' => {
185 data_type => 'string',
186 description => 'An alphanumeric string identifying the config store.',
187 required => '1',
188 },
189 };
190 __PACKAGE__->method_documentation->{ 'get_config_store' } = {
191 summary => 'Describe a config store',
192 params => $params,
193 returns => 'ConfigStoreResponse',
194 };
195 }
196 # @return ConfigStoreResponse
197 #
198 sub get_config_store {
199 my ($self, %args) = @_;
200  
201 # verify the required parameter 'config_store_id' is set
202 unless (exists $args{'config_store_id'}) {
203 croak("Missing the required parameter 'config_store_id' when calling get_config_store");
204 }
205  
206 # parse inputs
207 my $_resource_path = '/resources/stores/config/{config_store_id}';
208  
209 my $_method = 'GET';
210 my $query_params = {};
211 my $header_params = {};
212 my $form_params = {};
213  
214 # 'Accept' and 'Content-Type' header
215 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
216 if ($_header_accept) {
217 $header_params->{'Accept'} = $_header_accept;
218 }
219 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
220  
221 # path params
222 if ( exists $args{'config_store_id'}) {
223 my $_base_variable = "{" . "config_store_id" . "}";
224 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
225 $_resource_path =~ s/$_base_variable/$_base_value/g;
226 }
227  
228 my $_body_data;
229 # authentication setting, if any
230 my $auth_settings = [qw(token )];
231  
232 # make the API Call
233 my $response = $self->{api_client}->call_api($_resource_path, $_method,
234 $query_params, $form_params,
235 $header_params, $_body_data, $auth_settings);
236 if (!$response) {
237 return;
238 }
239 my $_response_object = $self->{api_client}->deserialize('ConfigStoreResponse', $response);
240 return $_response_object;
241 }
242  
243 #
244 # get_config_store_info
245 #
246 # Get config store metadata
247 #
248 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
249 {
250 my $params = {
251 'config_store_id' => {
252 data_type => 'string',
253 description => 'An alphanumeric string identifying the config store.',
254 required => '1',
255 },
256 };
257 __PACKAGE__->method_documentation->{ 'get_config_store_info' } = {
258 summary => 'Get config store metadata',
259 params => $params,
260 returns => 'ConfigStoreInfoResponse',
261 };
262 }
263 # @return ConfigStoreInfoResponse
264 #
265 sub get_config_store_info {
266 my ($self, %args) = @_;
267  
268 # verify the required parameter 'config_store_id' is set
269 unless (exists $args{'config_store_id'}) {
270 croak("Missing the required parameter 'config_store_id' when calling get_config_store_info");
271 }
272  
273 # parse inputs
274 my $_resource_path = '/resources/stores/config/{config_store_id}/info';
275  
276 my $_method = 'GET';
277 my $query_params = {};
278 my $header_params = {};
279 my $form_params = {};
280  
281 # 'Accept' and 'Content-Type' header
282 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
283 if ($_header_accept) {
284 $header_params->{'Accept'} = $_header_accept;
285 }
286 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
287  
288 # path params
289 if ( exists $args{'config_store_id'}) {
290 my $_base_variable = "{" . "config_store_id" . "}";
291 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
292 $_resource_path =~ s/$_base_variable/$_base_value/g;
293 }
294  
295 my $_body_data;
296 # authentication setting, if any
297 my $auth_settings = [qw(token )];
298  
299 # make the API Call
300 my $response = $self->{api_client}->call_api($_resource_path, $_method,
301 $query_params, $form_params,
302 $header_params, $_body_data, $auth_settings);
303 if (!$response) {
304 return;
305 }
306 my $_response_object = $self->{api_client}->deserialize('ConfigStoreInfoResponse', $response);
307 return $_response_object;
308 }
309  
310 #
311 # list_config_store_services
312 #
313 # List linked services
314 #
315 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
316 {
317 my $params = {
318 'config_store_id' => {
319 data_type => 'string',
320 description => 'An alphanumeric string identifying the config store.',
321 required => '1',
322 },
323 };
324 __PACKAGE__->method_documentation->{ 'list_config_store_services' } = {
325 summary => 'List linked services',
326 params => $params,
327 returns => 'object',
328 };
329 }
330 # @return object
331 #
332 sub list_config_store_services {
333 my ($self, %args) = @_;
334  
335 # verify the required parameter 'config_store_id' is set
336 unless (exists $args{'config_store_id'}) {
337 croak("Missing the required parameter 'config_store_id' when calling list_config_store_services");
338 }
339  
340 # parse inputs
341 my $_resource_path = '/resources/stores/config/{config_store_id}/services';
342  
343 my $_method = 'GET';
344 my $query_params = {};
345 my $header_params = {};
346 my $form_params = {};
347  
348 # 'Accept' and 'Content-Type' header
349 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
350 if ($_header_accept) {
351 $header_params->{'Accept'} = $_header_accept;
352 }
353 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
354  
355 # path params
356 if ( exists $args{'config_store_id'}) {
357 my $_base_variable = "{" . "config_store_id" . "}";
358 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
359 $_resource_path =~ s/$_base_variable/$_base_value/g;
360 }
361  
362 my $_body_data;
363 # authentication setting, if any
364 my $auth_settings = [qw(token )];
365  
366 # make the API Call
367 my $response = $self->{api_client}->call_api($_resource_path, $_method,
368 $query_params, $form_params,
369 $header_params, $_body_data, $auth_settings);
370 if (!$response) {
371 return;
372 }
373 my $_response_object = $self->{api_client}->deserialize('object', $response);
374 return $_response_object;
375 }
376  
377 #
378 # list_config_stores
379 #
380 # List config stores
381 #
382 # @param string $name Returns a one-element array containing the details for the named config store. (optional)
383 {
384 my $params = {
385 'name' => {
386 data_type => 'string',
387 description => 'Returns a one-element array containing the details for the named config store.',
388 required => '0',
389 },
390 };
391 __PACKAGE__->method_documentation->{ 'list_config_stores' } = {
392 summary => 'List config stores',
393 params => $params,
394 returns => 'ARRAY[ConfigStoreResponse]',
395 };
396 }
397 # @return ARRAY[ConfigStoreResponse]
398 #
399 sub list_config_stores {
400 my ($self, %args) = @_;
401  
402 # parse inputs
403 my $_resource_path = '/resources/stores/config';
404  
405 my $_method = 'GET';
406 my $query_params = {};
407 my $header_params = {};
408 my $form_params = {};
409  
410 # 'Accept' and 'Content-Type' header
411 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
412 if ($_header_accept) {
413 $header_params->{'Accept'} = $_header_accept;
414 }
415 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
416  
417 # query params
418 if ( exists $args{'name'}) {
419 $query_params->{'name'} = $self->{api_client}->to_query_value($args{'name'});
420 }
421  
422 my $_body_data;
423 # authentication setting, if any
424 my $auth_settings = [qw(token )];
425  
426 # make the API Call
427 my $response = $self->{api_client}->call_api($_resource_path, $_method,
428 $query_params, $form_params,
429 $header_params, $_body_data, $auth_settings);
430 if (!$response) {
431 return;
432 }
433 my $_response_object = $self->{api_client}->deserialize('ARRAY[ConfigStoreResponse]', $response);
434 return $_response_object;
435 }
436  
437 #
438 # update_config_store
439 #
440 # Update a config store
441 #
442 # @param string $config_store_id An alphanumeric string identifying the config store. (required)
443 # @param string $name The name of the config store. (optional)
444 {
445 my $params = {
446 'config_store_id' => {
447 data_type => 'string',
448 description => 'An alphanumeric string identifying the config store.',
449 required => '1',
450 },
451 'name' => {
452 data_type => 'string',
453 description => 'The name of the config store.',
454 required => '0',
455 },
456 };
457 __PACKAGE__->method_documentation->{ 'update_config_store' } = {
458 summary => 'Update a config store',
459 params => $params,
460 returns => 'ConfigStoreResponse',
461 };
462 }
463 # @return ConfigStoreResponse
464 #
465 sub update_config_store {
466 my ($self, %args) = @_;
467  
468 # verify the required parameter 'config_store_id' is set
469 unless (exists $args{'config_store_id'}) {
470 croak("Missing the required parameter 'config_store_id' when calling update_config_store");
471 }
472  
473 # parse inputs
474 my $_resource_path = '/resources/stores/config/{config_store_id}';
475  
476 my $_method = 'PUT';
477 my $query_params = {};
478 my $header_params = {};
479 my $form_params = {};
480  
481 # 'Accept' and 'Content-Type' header
482 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
483 if ($_header_accept) {
484 $header_params->{'Accept'} = $_header_accept;
485 }
486 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
487  
488 # path params
489 if ( exists $args{'config_store_id'}) {
490 my $_base_variable = "{" . "config_store_id" . "}";
491 my $_base_value = $self->{api_client}->to_path_value($args{'config_store_id'});
492 $_resource_path =~ s/$_base_variable/$_base_value/g;
493 }
494  
495 # form params
496 if ( exists $args{'name'} ) {
497 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
498 }
499  
500 my $_body_data;
501 # authentication setting, if any
502 my $auth_settings = [qw(token )];
503  
504 # make the API Call
505 my $response = $self->{api_client}->call_api($_resource_path, $_method,
506 $query_params, $form_params,
507 $header_params, $_body_data, $auth_settings);
508 if (!$response) {
509 return;
510 }
511 my $_response_object = $self->{api_client}->deserialize('ConfigStoreResponse', $response);
512 return $_response_object;
513 }
514  
515 1;