Fastly/ServiceAuthorizationsApi.pm untested

filter: Statementstmt 0.0% 0 / 215 Branchbran 0.0% 0 / 52 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 / 301 CC 27 SCAR 30.4
CC
27
Cov
0%
update_service_authorization
42.0
list_service_authorization
30.0
show_service_authorization
30.0
CRAP 21.0
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::ServiceAuthorizationsApi;
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_service_authorization
51 #
52 # Create service authorization
53 #
54 # @param ServiceAuthorization $service_authorization (optional)
55 {
56 my $params = {
57 'service_authorization' => {
58 data_type => 'ServiceAuthorization',
59 description => '',
60 required => '0',
61 },
62 };
63 __PACKAGE__->method_documentation->{ 'create_service_authorization' } = {
64 summary => 'Create service authorization',
65 params => $params,
66 returns => 'ServiceAuthorizationResponse',
67 };
68 }
69 # @return ServiceAuthorizationResponse
70 #
71 sub create_service_authorization {
72 my ($self, %args) = @_;
73  
74 # parse inputs
75 my $_resource_path = '/service-authorizations';
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/vnd.api+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/vnd.api+json');
88  
89 my $_body_data;
90 # body params
91 if ( exists $args{'service_authorization'}) {
92 $_body_data = $args{'service_authorization'};
93 }
94  
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('ServiceAuthorizationResponse', $response);
106 return $_response_object;
107 }
108  
109 #
110 # delete_service_authorization
111 #
112 # Delete service authorization
113 #
114 # @param string $service_authorization_id Alphanumeric string identifying a service authorization. (required)
115 {
116 my $params = {
117 'service_authorization_id' => {
118 data_type => 'string',
119 description => 'Alphanumeric string identifying a service authorization.',
120 required => '1',
121 },
122 };
123 __PACKAGE__->method_documentation->{ 'delete_service_authorization' } = {
124 summary => 'Delete service authorization',
125 params => $params,
126 returns => undef,
127 };
128 }
129 # @return void
130 #
131 sub delete_service_authorization {
132 my ($self, %args) = @_;
133  
134 # verify the required parameter 'service_authorization_id' is set
135 unless (exists $args{'service_authorization_id'}) {
136 croak("Missing the required parameter 'service_authorization_id' when calling delete_service_authorization");
137 }
138  
139 # parse inputs
140 my $_resource_path = '/service-authorizations/{service_authorization_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();
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{'service_authorization_id'}) {
156 my $_base_variable = "{" . "service_authorization_id" . "}";
157 my $_base_value = $self->{api_client}->to_path_value($args{'service_authorization_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 $self->{api_client}->call_api($_resource_path, $_method,
167 $query_params, $form_params,
168 $header_params, $_body_data, $auth_settings);
169 return;
170 }
171  
172 #
173 # delete_service_authorization2
174 #
175 # Delete service authorizations
176 #
177 # @param HASH[string,object] $request_body (optional)
178 {
179 my $params = {
180 'request_body' => {
181 data_type => 'HASH[string,object]',
182 description => '',
183 required => '0',
184 },
185 };
186 __PACKAGE__->method_documentation->{ 'delete_service_authorization2' } = {
187 summary => 'Delete service authorizations',
188 params => $params,
189 returns => 'InlineResponse20022',
190 };
191 }
192 # @return InlineResponse20022
193 #
194 sub delete_service_authorization2 {
195 my ($self, %args) = @_;
196  
197 # parse inputs
198 my $_resource_path = '/service-authorizations';
199  
200 my $_method = 'DELETE';
201 my $query_params = {};
202 my $header_params = {};
203 my $form_params = {};
204  
205 # 'Accept' and 'Content-Type' header
206 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json; ext=bulk');
207 if ($_header_accept) {
208 $header_params->{'Accept'} = $_header_accept;
209 }
210 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/vnd.api+json; ext=bulk');
211  
212 my $_body_data;
213 # body params
214 if ( exists $args{'request_body'}) {
215 $_body_data = $args{'request_body'};
216 }
217  
218 # authentication setting, if any
219 my $auth_settings = [qw(token )];
220  
221 # make the API Call
222 my $response = $self->{api_client}->call_api($_resource_path, $_method,
223 $query_params, $form_params,
224 $header_params, $_body_data, $auth_settings);
225 if (!$response) {
226 return;
227 }
228 my $_response_object = $self->{api_client}->deserialize('InlineResponse20022', $response);
229 return $_response_object;
230 }
231  
232 #
233 # list_service_authorization
234 #
235 # List service authorizations
236 #
237 # @param int $page[number] Current page. (optional)
238 # @param int $page[size] Number of records per page. (optional, default to 20)
239 {
240 my $params = {
241 'page[number]' => {
242 data_type => 'int',
243 description => 'Current page.',
244 required => '0',
245 },
246 'page[size]' => {
247 data_type => 'int',
248 description => 'Number of records per page.',
249 required => '0',
250 },
251 };
252 __PACKAGE__->method_documentation->{ 'list_service_authorization' } = {
253 summary => 'List service authorizations',
254 params => $params,
255 returns => 'ServiceAuthorizationsResponse',
256 };
257 }
258 # @return ServiceAuthorizationsResponse
259 #
260 sub list_service_authorization {
261 my ($self, %args) = @_;
262  
263 # parse inputs
264 my $_resource_path = '/service-authorizations';
265  
266 my $_method = 'GET';
267 my $query_params = {};
268 my $header_params = {};
269 my $form_params = {};
270  
271 # 'Accept' and 'Content-Type' header
272 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
273 if ($_header_accept) {
274 $header_params->{'Accept'} = $_header_accept;
275 }
276 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
277  
278 # query params
279 if ( exists $args{'page[number]'}) {
280 $query_params->{'page[number]'} = $self->{api_client}->to_query_value($args{'page[number]'});
281 }
282  
283 # query params
284 if ( exists $args{'page[size]'}) {
285 $query_params->{'page[size]'} = $self->{api_client}->to_query_value($args{'page[size]'});
286 }
287  
288 my $_body_data;
289 # authentication setting, if any
290 my $auth_settings = [qw(token )];
291  
292 # make the API Call
293 my $response = $self->{api_client}->call_api($_resource_path, $_method,
294 $query_params, $form_params,
295 $header_params, $_body_data, $auth_settings);
296 if (!$response) {
297 return;
298 }
299 my $_response_object = $self->{api_client}->deserialize('ServiceAuthorizationsResponse', $response);
300 return $_response_object;
301 }
302  
303 #
304 # show_service_authorization
305 #
306 # Show service authorization
307 #
308 # @param string $service_authorization_id Alphanumeric string identifying a service authorization. (required)
309 {
310 my $params = {
311 'service_authorization_id' => {
312 data_type => 'string',
313 description => 'Alphanumeric string identifying a service authorization.',
314 required => '1',
315 },
316 };
317 __PACKAGE__->method_documentation->{ 'show_service_authorization' } = {
318 summary => 'Show service authorization',
319 params => $params,
320 returns => 'ServiceAuthorizationResponse',
321 };
322 }
323 # @return ServiceAuthorizationResponse
324 #
325 sub show_service_authorization {
326 my ($self, %args) = @_;
327  
328 # verify the required parameter 'service_authorization_id' is set
329 unless (exists $args{'service_authorization_id'}) {
330 croak("Missing the required parameter 'service_authorization_id' when calling show_service_authorization");
331 }
332  
333 # parse inputs
334 my $_resource_path = '/service-authorizations/{service_authorization_id}';
335  
336 my $_method = 'GET';
337 my $query_params = {};
338 my $header_params = {};
339 my $form_params = {};
340  
341 # 'Accept' and 'Content-Type' header
342 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
343 if ($_header_accept) {
344 $header_params->{'Accept'} = $_header_accept;
345 }
346 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
347  
348 # path params
349 if ( exists $args{'service_authorization_id'}) {
350 my $_base_variable = "{" . "service_authorization_id" . "}";
351 my $_base_value = $self->{api_client}->to_path_value($args{'service_authorization_id'});
352 $_resource_path =~ s/$_base_variable/$_base_value/g;
353 }
354  
355 my $_body_data;
356 # authentication setting, if any
357 my $auth_settings = [qw(token )];
358  
359 # make the API Call
360 my $response = $self->{api_client}->call_api($_resource_path, $_method,
361 $query_params, $form_params,
362 $header_params, $_body_data, $auth_settings);
363 if (!$response) {
364 return;
365 }
366 my $_response_object = $self->{api_client}->deserialize('ServiceAuthorizationResponse', $response);
367 return $_response_object;
368 }
369  
370 #
371 # update_service_authorization
372 #
373 # Update service authorization
374 #
375 # @param string $service_authorization_id Alphanumeric string identifying a service authorization. (required)
376 # @param ServiceAuthorization $service_authorization (optional)
377 {
378 my $params = {
379 'service_authorization_id' => {
380 data_type => 'string',
381 description => 'Alphanumeric string identifying a service authorization.',
382 required => '1',
383 },
384 'service_authorization' => {
385 data_type => 'ServiceAuthorization',
386 description => '',
387 required => '0',
388 },
389 };
390 __PACKAGE__->method_documentation->{ 'update_service_authorization' } = {
391 summary => 'Update service authorization',
392 params => $params,
393 returns => 'ServiceAuthorizationResponse',
394 };
395 }
396 # @return ServiceAuthorizationResponse
397 #
398 sub update_service_authorization {
399 my ($self, %args) = @_;
400  
401 # verify the required parameter 'service_authorization_id' is set
402 unless (exists $args{'service_authorization_id'}) {
403 croak("Missing the required parameter 'service_authorization_id' when calling update_service_authorization");
404 }
405  
406 # parse inputs
407 my $_resource_path = '/service-authorizations/{service_authorization_id}';
408  
409 my $_method = 'PATCH';
410 my $query_params = {};
411 my $header_params = {};
412 my $form_params = {};
413  
414 # 'Accept' and 'Content-Type' header
415 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
416 if ($_header_accept) {
417 $header_params->{'Accept'} = $_header_accept;
418 }
419 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
420  
421 # path params
422 if ( exists $args{'service_authorization_id'}) {
423 my $_base_variable = "{" . "service_authorization_id" . "}";
424 my $_base_value = $self->{api_client}->to_path_value($args{'service_authorization_id'});
425 $_resource_path =~ s/$_base_variable/$_base_value/g;
426 }
427  
428 my $_body_data;
429 # body params
430 if ( exists $args{'service_authorization'}) {
431 $_body_data = $args{'service_authorization'};
432 }
433  
434 # authentication setting, if any
435 my $auth_settings = [qw(token )];
436  
437 # make the API Call
438 my $response = $self->{api_client}->call_api($_resource_path, $_method,
439 $query_params, $form_params,
440 $header_params, $_body_data, $auth_settings);
441 if (!$response) {
442 return;
443 }
444 my $_response_object = $self->{api_client}->deserialize('ServiceAuthorizationResponse', $response);
445 return $_response_object;
446 }
447  
448 #
449 # update_service_authorization2
450 #
451 # Update service authorizations
452 #
453 # @param HASH[string,object] $request_body (optional)
454 {
455 my $params = {
456 'request_body' => {
457 data_type => 'HASH[string,object]',
458 description => '',
459 required => '0',
460 },
461 };
462 __PACKAGE__->method_documentation->{ 'update_service_authorization2' } = {
463 summary => 'Update service authorizations',
464 params => $params,
465 returns => 'ServiceAuthorizationsResponse',
466 };
467 }
468 # @return ServiceAuthorizationsResponse
469 #
470 sub update_service_authorization2 {
471 my ($self, %args) = @_;
472  
473 # parse inputs
474 my $_resource_path = '/service-authorizations';
475  
476 my $_method = 'PATCH';
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/vnd.api+json; ext=bulk');
483 if ($_header_accept) {
484 $header_params->{'Accept'} = $_header_accept;
485 }
486 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/vnd.api+json; ext=bulk');
487  
488 my $_body_data;
489 # body params
490 if ( exists $args{'request_body'}) {
491 $_body_data = $args{'request_body'};
492 }
493  
494 # authentication setting, if any
495 my $auth_settings = [qw(token )];
496  
497 # make the API Call
498 my $response = $self->{api_client}->call_api($_resource_path, $_method,
499 $query_params, $form_params,
500 $header_params, $_body_data, $auth_settings);
501 if (!$response) {
502 return;
503 }
504 my $_response_object = $self->{api_client}->deserialize('ServiceAuthorizationsResponse', $response);
505 return $_response_object;
506 }
507  
508 1;