Fastly/VersionApi.pm untested

filter: Statementstmt 0.0% 0 / 422 Branchbran 0.0% 0 / 148 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 21 Podpod 0.0% 0 / 12 totaltotal 0.0% 0 / 612 CC 75 SCAR 43.3
CC
75
Cov
0%
update_service_version
210.0
activate_service_version_environment
90.0
deactivate_service_version_environment
90.0
CRAP 76.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::VersionApi;
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 # activate_service_version
51 #
52 # Activate a service version
53 #
54 # @param string $service_id Alphanumeric string identifying the service. (required)
55 # @param int $version_id Integer identifying a service version. (required)
56 {
57 my $params = {
58 'service_id' => {
59 data_type => 'string',
60 description => 'Alphanumeric string identifying the service.',
61 required => '1',
62 },
63 'version_id' => {
64 data_type => 'int',
65 description => 'Integer identifying a service version.',
66 required => '1',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'activate_service_version' } = {
70 summary => 'Activate a service version',
71 params => $params,
72 returns => 'VersionResponse',
73 };
74 }
75 # @return VersionResponse
76 #
77 sub activate_service_version {
78 my ($self, %args) = @_;
79  
80 # verify the required parameter 'service_id' is set
81 unless (exists $args{'service_id'}) {
82 croak("Missing the required parameter 'service_id' when calling activate_service_version");
83 }
84  
85 # verify the required parameter 'version_id' is set
86 unless (exists $args{'version_id'}) {
87 croak("Missing the required parameter 'version_id' when calling activate_service_version");
88 }
89  
90 # parse inputs
91 my $_resource_path = '/service/{service_id}/version/{version_id}/activate';
92  
93 my $_method = 'PUT';
94 my $query_params = {};
95 my $header_params = {};
96 my $form_params = {};
97  
98 # 'Accept' and 'Content-Type' header
99 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
100 if ($_header_accept) {
101 $header_params->{'Accept'} = $_header_accept;
102 }
103 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
104  
105 # path params
106 if ( exists $args{'service_id'}) {
107 my $_base_variable = "{" . "service_id" . "}";
108 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
109 $_resource_path =~ s/$_base_variable/$_base_value/g;
110 }
111  
112 # path params
113 if ( exists $args{'version_id'}) {
114 my $_base_variable = "{" . "version_id" . "}";
115 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
116 $_resource_path =~ s/$_base_variable/$_base_value/g;
117 }
118  
119 my $_body_data;
120 # authentication setting, if any
121 my $auth_settings = [qw(token )];
122  
123 # make the API Call
124 my $response = $self->{api_client}->call_api($_resource_path, $_method,
125 $query_params, $form_params,
126 $header_params, $_body_data, $auth_settings);
127 if (!$response) {
128 return;
129 }
130 my $_response_object = $self->{api_client}->deserialize('VersionResponse', $response);
131 return $_response_object;
132 }
133  
134 #
135 # activate_service_version_environment
136 #
137 # Activate a service version on the specified environment
138 #
139 # @param string $service_id Alphanumeric string identifying the service. (required)
140 # @param int $version_id Integer identifying a service version. (required)
141 # @param EnvironmentName $environment_name (required)
142 {
143 my $params = {
144 'service_id' => {
145 data_type => 'string',
146 description => 'Alphanumeric string identifying the service.',
147 required => '1',
148 },
149 'version_id' => {
150 data_type => 'int',
151 description => 'Integer identifying a service version.',
152 required => '1',
153 },
154 'environment_name' => {
155 data_type => 'EnvironmentName',
156 description => '',
157 required => '1',
158 },
159 };
160 __PACKAGE__->method_documentation->{ 'activate_service_version_environment' } = {
161 summary => 'Activate a service version on the specified environment',
162 params => $params,
163 returns => 'VersionResponse',
164 };
165 }
166 # @return VersionResponse
167 #
168 sub activate_service_version_environment {
169 my ($self, %args) = @_;
170  
171 # verify the required parameter 'service_id' is set
172 unless (exists $args{'service_id'}) {
173 croak("Missing the required parameter 'service_id' when calling activate_service_version_environment");
174 }
175  
176 # verify the required parameter 'version_id' is set
177 unless (exists $args{'version_id'}) {
178 croak("Missing the required parameter 'version_id' when calling activate_service_version_environment");
179 }
180  
181 # verify the required parameter 'environment_name' is set
182 unless (exists $args{'environment_name'}) {
183 croak("Missing the required parameter 'environment_name' when calling activate_service_version_environment");
184 }
185  
186 # parse inputs
187 my $_resource_path = '/service/{service_id}/version/{version_id}/activate/{environment_name}';
188  
189 my $_method = 'PUT';
190 my $query_params = {};
191 my $header_params = {};
192 my $form_params = {};
193  
194 # 'Accept' and 'Content-Type' header
195 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
196 if ($_header_accept) {
197 $header_params->{'Accept'} = $_header_accept;
198 }
199 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
200  
201 # path params
202 if ( exists $args{'service_id'}) {
203 my $_base_variable = "{" . "service_id" . "}";
204 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
205 $_resource_path =~ s/$_base_variable/$_base_value/g;
206 }
207  
208 # path params
209 if ( exists $args{'version_id'}) {
210 my $_base_variable = "{" . "version_id" . "}";
211 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
212 $_resource_path =~ s/$_base_variable/$_base_value/g;
213 }
214  
215 # path params
216 if ( exists $args{'environment_name'}) {
217 my $_base_variable = "{" . "environment_name" . "}";
218 my $_base_value = $self->{api_client}->to_path_value($args{'environment_name'});
219 $_resource_path =~ s/$_base_variable/$_base_value/g;
220 }
221  
222 my $_body_data;
223 # authentication setting, if any
224 my $auth_settings = [qw(token )];
225  
226 # make the API Call
227 my $response = $self->{api_client}->call_api($_resource_path, $_method,
228 $query_params, $form_params,
229 $header_params, $_body_data, $auth_settings);
230 if (!$response) {
231 return;
232 }
233 my $_response_object = $self->{api_client}->deserialize('VersionResponse', $response);
234 return $_response_object;
235 }
236  
237 #
238 # clone_service_version
239 #
240 # Clone a service version
241 #
242 # @param string $service_id Alphanumeric string identifying the service. (required)
243 # @param int $version_id Integer identifying a service version. (required)
244 {
245 my $params = {
246 'service_id' => {
247 data_type => 'string',
248 description => 'Alphanumeric string identifying the service.',
249 required => '1',
250 },
251 'version_id' => {
252 data_type => 'int',
253 description => 'Integer identifying a service version.',
254 required => '1',
255 },
256 };
257 __PACKAGE__->method_documentation->{ 'clone_service_version' } = {
258 summary => 'Clone a service version',
259 params => $params,
260 returns => 'Version',
261 };
262 }
263 # @return Version
264 #
265 sub clone_service_version {
266 my ($self, %args) = @_;
267  
268 # verify the required parameter 'service_id' is set
269 unless (exists $args{'service_id'}) {
270 croak("Missing the required parameter 'service_id' when calling clone_service_version");
271 }
272  
273 # verify the required parameter 'version_id' is set
274 unless (exists $args{'version_id'}) {
275 croak("Missing the required parameter 'version_id' when calling clone_service_version");
276 }
277  
278 # parse inputs
279 my $_resource_path = '/service/{service_id}/version/{version_id}/clone';
280  
281 my $_method = 'PUT';
282 my $query_params = {};
283 my $header_params = {};
284 my $form_params = {};
285  
286 # 'Accept' and 'Content-Type' header
287 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
288 if ($_header_accept) {
289 $header_params->{'Accept'} = $_header_accept;
290 }
291 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
292  
293 # path params
294 if ( exists $args{'service_id'}) {
295 my $_base_variable = "{" . "service_id" . "}";
296 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
297 $_resource_path =~ s/$_base_variable/$_base_value/g;
298 }
299  
300 # path params
301 if ( exists $args{'version_id'}) {
302 my $_base_variable = "{" . "version_id" . "}";
303 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
304 $_resource_path =~ s/$_base_variable/$_base_value/g;
305 }
306  
307 my $_body_data;
308 # authentication setting, if any
309 my $auth_settings = [qw(token )];
310  
311 # make the API Call
312 my $response = $self->{api_client}->call_api($_resource_path, $_method,
313 $query_params, $form_params,
314 $header_params, $_body_data, $auth_settings);
315 if (!$response) {
316 return;
317 }
318 my $_response_object = $self->{api_client}->deserialize('Version', $response);
319 return $_response_object;
320 }
321  
322 #
323 # create_service_version
324 #
325 # Create a service version
326 #
327 # @param string $service_id Alphanumeric string identifying the service. (required)
328 {
329 my $params = {
330 'service_id' => {
331 data_type => 'string',
332 description => 'Alphanumeric string identifying the service.',
333 required => '1',
334 },
335 };
336 __PACKAGE__->method_documentation->{ 'create_service_version' } = {
337 summary => 'Create a service version',
338 params => $params,
339 returns => 'VersionCreateResponse',
340 };
341 }
342 # @return VersionCreateResponse
343 #
344 sub create_service_version {
345 my ($self, %args) = @_;
346  
347 # verify the required parameter 'service_id' is set
348 unless (exists $args{'service_id'}) {
349 croak("Missing the required parameter 'service_id' when calling create_service_version");
350 }
351  
352 # parse inputs
353 my $_resource_path = '/service/{service_id}/version';
354  
355 my $_method = 'POST';
356 my $query_params = {};
357 my $header_params = {};
358 my $form_params = {};
359  
360 # 'Accept' and 'Content-Type' header
361 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
362 if ($_header_accept) {
363 $header_params->{'Accept'} = $_header_accept;
364 }
365 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
366  
367 # path params
368 if ( exists $args{'service_id'}) {
369 my $_base_variable = "{" . "service_id" . "}";
370 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
371 $_resource_path =~ s/$_base_variable/$_base_value/g;
372 }
373  
374 my $_body_data;
375 # authentication setting, if any
376 my $auth_settings = [qw(token )];
377  
378 # make the API Call
379 my $response = $self->{api_client}->call_api($_resource_path, $_method,
380 $query_params, $form_params,
381 $header_params, $_body_data, $auth_settings);
382 if (!$response) {
383 return;
384 }
385 my $_response_object = $self->{api_client}->deserialize('VersionCreateResponse', $response);
386 return $_response_object;
387 }
388  
389 #
390 # deactivate_service_version
391 #
392 # Deactivate a service version
393 #
394 # @param string $service_id Alphanumeric string identifying the service. (required)
395 # @param int $version_id Integer identifying a service version. (required)
396 {
397 my $params = {
398 'service_id' => {
399 data_type => 'string',
400 description => 'Alphanumeric string identifying the service.',
401 required => '1',
402 },
403 'version_id' => {
404 data_type => 'int',
405 description => 'Integer identifying a service version.',
406 required => '1',
407 },
408 };
409 __PACKAGE__->method_documentation->{ 'deactivate_service_version' } = {
410 summary => 'Deactivate a service version',
411 params => $params,
412 returns => 'VersionResponse',
413 };
414 }
415 # @return VersionResponse
416 #
417 sub deactivate_service_version {
418 my ($self, %args) = @_;
419  
420 # verify the required parameter 'service_id' is set
421 unless (exists $args{'service_id'}) {
422 croak("Missing the required parameter 'service_id' when calling deactivate_service_version");
423 }
424  
425 # verify the required parameter 'version_id' is set
426 unless (exists $args{'version_id'}) {
427 croak("Missing the required parameter 'version_id' when calling deactivate_service_version");
428 }
429  
430 # parse inputs
431 my $_resource_path = '/service/{service_id}/version/{version_id}/deactivate';
432  
433 my $_method = 'PUT';
434 my $query_params = {};
435 my $header_params = {};
436 my $form_params = {};
437  
438 # 'Accept' and 'Content-Type' header
439 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
440 if ($_header_accept) {
441 $header_params->{'Accept'} = $_header_accept;
442 }
443 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
444  
445 # path params
446 if ( exists $args{'service_id'}) {
447 my $_base_variable = "{" . "service_id" . "}";
448 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
449 $_resource_path =~ s/$_base_variable/$_base_value/g;
450 }
451  
452 # path params
453 if ( exists $args{'version_id'}) {
454 my $_base_variable = "{" . "version_id" . "}";
455 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
456 $_resource_path =~ s/$_base_variable/$_base_value/g;
457 }
458  
459 my $_body_data;
460 # authentication setting, if any
461 my $auth_settings = [qw(token )];
462  
463 # make the API Call
464 my $response = $self->{api_client}->call_api($_resource_path, $_method,
465 $query_params, $form_params,
466 $header_params, $_body_data, $auth_settings);
467 if (!$response) {
468 return;
469 }
470 my $_response_object = $self->{api_client}->deserialize('VersionResponse', $response);
471 return $_response_object;
472 }
473  
474 #
475 # deactivate_service_version_environment
476 #
477 # Deactivate a service version on an environment
478 #
479 # @param string $service_id Alphanumeric string identifying the service. (required)
480 # @param int $version_id Integer identifying a service version. (required)
481 # @param EnvironmentName $environment_name (required)
482 {
483 my $params = {
484 'service_id' => {
485 data_type => 'string',
486 description => 'Alphanumeric string identifying the service.',
487 required => '1',
488 },
489 'version_id' => {
490 data_type => 'int',
491 description => 'Integer identifying a service version.',
492 required => '1',
493 },
494 'environment_name' => {
495 data_type => 'EnvironmentName',
496 description => '',
497 required => '1',
498 },
499 };
500 __PACKAGE__->method_documentation->{ 'deactivate_service_version_environment' } = {
501 summary => 'Deactivate a service version on an environment',
502 params => $params,
503 returns => 'VersionResponse',
504 };
505 }
506 # @return VersionResponse
507 #
508 sub deactivate_service_version_environment {
509 my ($self, %args) = @_;
510  
511 # verify the required parameter 'service_id' is set
512 unless (exists $args{'service_id'}) {
513 croak("Missing the required parameter 'service_id' when calling deactivate_service_version_environment");
514 }
515  
516 # verify the required parameter 'version_id' is set
517 unless (exists $args{'version_id'}) {
518 croak("Missing the required parameter 'version_id' when calling deactivate_service_version_environment");
519 }
520  
521 # verify the required parameter 'environment_name' is set
522 unless (exists $args{'environment_name'}) {
523 croak("Missing the required parameter 'environment_name' when calling deactivate_service_version_environment");
524 }
525  
526 # parse inputs
527 my $_resource_path = '/service/{service_id}/version/{version_id}/deactivate/{environment_name}';
528  
529 my $_method = 'PUT';
530 my $query_params = {};
531 my $header_params = {};
532 my $form_params = {};
533  
534 # 'Accept' and 'Content-Type' header
535 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
536 if ($_header_accept) {
537 $header_params->{'Accept'} = $_header_accept;
538 }
539 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
540  
541 # path params
542 if ( exists $args{'service_id'}) {
543 my $_base_variable = "{" . "service_id" . "}";
544 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
545 $_resource_path =~ s/$_base_variable/$_base_value/g;
546 }
547  
548 # path params
549 if ( exists $args{'version_id'}) {
550 my $_base_variable = "{" . "version_id" . "}";
551 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
552 $_resource_path =~ s/$_base_variable/$_base_value/g;
553 }
554  
555 # path params
556 if ( exists $args{'environment_name'}) {
557 my $_base_variable = "{" . "environment_name" . "}";
558 my $_base_value = $self->{api_client}->to_path_value($args{'environment_name'});
559 $_resource_path =~ s/$_base_variable/$_base_value/g;
560 }
561  
562 my $_body_data;
563 # authentication setting, if any
564 my $auth_settings = [qw(token )];
565  
566 # make the API Call
567 my $response = $self->{api_client}->call_api($_resource_path, $_method,
568 $query_params, $form_params,
569 $header_params, $_body_data, $auth_settings);
570 if (!$response) {
571 return;
572 }
573 my $_response_object = $self->{api_client}->deserialize('VersionResponse', $response);
574 return $_response_object;
575 }
576  
577 #
578 # get_service_version
579 #
580 # Get a version of a service
581 #
582 # @param string $service_id Alphanumeric string identifying the service. (required)
583 # @param int $version_id Integer identifying a service version. (required)
584 {
585 my $params = {
586 'service_id' => {
587 data_type => 'string',
588 description => 'Alphanumeric string identifying the service.',
589 required => '1',
590 },
591 'version_id' => {
592 data_type => 'int',
593 description => 'Integer identifying a service version.',
594 required => '1',
595 },
596 };
597 __PACKAGE__->method_documentation->{ 'get_service_version' } = {
598 summary => 'Get a version of a service',
599 params => $params,
600 returns => 'VersionResponse',
601 };
602 }
603 # @return VersionResponse
604 #
605 sub get_service_version {
606 my ($self, %args) = @_;
607  
608 # verify the required parameter 'service_id' is set
609 unless (exists $args{'service_id'}) {
610 croak("Missing the required parameter 'service_id' when calling get_service_version");
611 }
612  
613 # verify the required parameter 'version_id' is set
614 unless (exists $args{'version_id'}) {
615 croak("Missing the required parameter 'version_id' when calling get_service_version");
616 }
617  
618 # parse inputs
619 my $_resource_path = '/service/{service_id}/version/{version_id}';
620  
621 my $_method = 'GET';
622 my $query_params = {};
623 my $header_params = {};
624 my $form_params = {};
625  
626 # 'Accept' and 'Content-Type' header
627 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
628 if ($_header_accept) {
629 $header_params->{'Accept'} = $_header_accept;
630 }
631 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
632  
633 # path params
634 if ( exists $args{'service_id'}) {
635 my $_base_variable = "{" . "service_id" . "}";
636 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
637 $_resource_path =~ s/$_base_variable/$_base_value/g;
638 }
639  
640 # path params
641 if ( exists $args{'version_id'}) {
642 my $_base_variable = "{" . "version_id" . "}";
643 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
644 $_resource_path =~ s/$_base_variable/$_base_value/g;
645 }
646  
647 my $_body_data;
648 # authentication setting, if any
649 my $auth_settings = [qw(token )];
650  
651 # make the API Call
652 my $response = $self->{api_client}->call_api($_resource_path, $_method,
653 $query_params, $form_params,
654 $header_params, $_body_data, $auth_settings);
655 if (!$response) {
656 return;
657 }
658 my $_response_object = $self->{api_client}->deserialize('VersionResponse', $response);
659 return $_response_object;
660 }
661  
662 #
663 # list_service_versions
664 #
665 # List versions of a service
666 #
667 # @param string $service_id Alphanumeric string identifying the service. (required)
668 {
669 my $params = {
670 'service_id' => {
671 data_type => 'string',
672 description => 'Alphanumeric string identifying the service.',
673 required => '1',
674 },
675 };
676 __PACKAGE__->method_documentation->{ 'list_service_versions' } = {
677 summary => 'List versions of a service',
678 params => $params,
679 returns => 'ARRAY[VersionResponse]',
680 };
681 }
682 # @return ARRAY[VersionResponse]
683 #
684 sub list_service_versions {
685 my ($self, %args) = @_;
686  
687 # verify the required parameter 'service_id' is set
688 unless (exists $args{'service_id'}) {
689 croak("Missing the required parameter 'service_id' when calling list_service_versions");
690 }
691  
692 # parse inputs
693 my $_resource_path = '/service/{service_id}/version';
694  
695 my $_method = 'GET';
696 my $query_params = {};
697 my $header_params = {};
698 my $form_params = {};
699  
700 # 'Accept' and 'Content-Type' header
701 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
702 if ($_header_accept) {
703 $header_params->{'Accept'} = $_header_accept;
704 }
705 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
706  
707 # path params
708 if ( exists $args{'service_id'}) {
709 my $_base_variable = "{" . "service_id" . "}";
710 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
711 $_resource_path =~ s/$_base_variable/$_base_value/g;
712 }
713  
714 my $_body_data;
715 # authentication setting, if any
716 my $auth_settings = [qw(token )];
717  
718 # make the API Call
719 my $response = $self->{api_client}->call_api($_resource_path, $_method,
720 $query_params, $form_params,
721 $header_params, $_body_data, $auth_settings);
722 if (!$response) {
723 return;
724 }
725 my $_response_object = $self->{api_client}->deserialize('ARRAY[VersionResponse]', $response);
726 return $_response_object;
727 }
728  
729 #
730 # lock_service_version
731 #
732 # Lock a service version
733 #
734 # @param string $service_id Alphanumeric string identifying the service. (required)
735 # @param int $version_id Integer identifying a service version. (required)
736 {
737 my $params = {
738 'service_id' => {
739 data_type => 'string',
740 description => 'Alphanumeric string identifying the service.',
741 required => '1',
742 },
743 'version_id' => {
744 data_type => 'int',
745 description => 'Integer identifying a service version.',
746 required => '1',
747 },
748 };
749 __PACKAGE__->method_documentation->{ 'lock_service_version' } = {
750 summary => 'Lock a service version',
751 params => $params,
752 returns => 'Version',
753 };
754 }
755 # @return Version
756 #
757 sub lock_service_version {
758 my ($self, %args) = @_;
759  
760 # verify the required parameter 'service_id' is set
761 unless (exists $args{'service_id'}) {
762 croak("Missing the required parameter 'service_id' when calling lock_service_version");
763 }
764  
765 # verify the required parameter 'version_id' is set
766 unless (exists $args{'version_id'}) {
767 croak("Missing the required parameter 'version_id' when calling lock_service_version");
768 }
769  
770 # parse inputs
771 my $_resource_path = '/service/{service_id}/version/{version_id}/lock';
772  
773 my $_method = 'PUT';
774 my $query_params = {};
775 my $header_params = {};
776 my $form_params = {};
777  
778 # 'Accept' and 'Content-Type' header
779 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
780 if ($_header_accept) {
781 $header_params->{'Accept'} = $_header_accept;
782 }
783 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
784  
785 # path params
786 if ( exists $args{'service_id'}) {
787 my $_base_variable = "{" . "service_id" . "}";
788 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
789 $_resource_path =~ s/$_base_variable/$_base_value/g;
790 }
791  
792 # path params
793 if ( exists $args{'version_id'}) {
794 my $_base_variable = "{" . "version_id" . "}";
795 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
796 $_resource_path =~ s/$_base_variable/$_base_value/g;
797 }
798  
799 my $_body_data;
800 # authentication setting, if any
801 my $auth_settings = [qw(token )];
802  
803 # make the API Call
804 my $response = $self->{api_client}->call_api($_resource_path, $_method,
805 $query_params, $form_params,
806 $header_params, $_body_data, $auth_settings);
807 if (!$response) {
808 return;
809 }
810 my $_response_object = $self->{api_client}->deserialize('Version', $response);
811 return $_response_object;
812 }
813  
814 #
815 # update_service_version
816 #
817 # Update a service version
818 #
819 # @param string $service_id Alphanumeric string identifying the service. (required)
820 # @param int $version_id Integer identifying a service version. (required)
821 # @param boolean $active Whether this is the active version or not. (optional, default to false)
822 # @param string $comment A freeform descriptive note. (optional)
823 # @param boolean $deployed Unused at this time. (optional)
824 # @param boolean $locked Whether this version is locked or not. Objects can not be added or edited on locked versions. (optional, default to false)
825 # @param int $number The number of this version. (optional)
826 # @param boolean $staging Unused at this time. (optional, default to false)
827 # @param boolean $testing Unused at this time. (optional, default to false)
828 {
829 my $params = {
830 'service_id' => {
831 data_type => 'string',
832 description => 'Alphanumeric string identifying the service.',
833 required => '1',
834 },
835 'version_id' => {
836 data_type => 'int',
837 description => 'Integer identifying a service version.',
838 required => '1',
839 },
840 'active' => {
841 data_type => 'boolean',
842 description => 'Whether this is the active version or not.',
843 required => '0',
844 },
845 'comment' => {
846 data_type => 'string',
847 description => 'A freeform descriptive note.',
848 required => '0',
849 },
850 'deployed' => {
851 data_type => 'boolean',
852 description => 'Unused at this time.',
853 required => '0',
854 },
855 'locked' => {
856 data_type => 'boolean',
857 description => 'Whether this version is locked or not. Objects can not be added or edited on locked versions.',
858 required => '0',
859 },
860 'number' => {
861 data_type => 'int',
862 description => 'The number of this version.',
863 required => '0',
864 },
865 'staging' => {
866 data_type => 'boolean',
867 description => 'Unused at this time.',
868 required => '0',
869 },
870 'testing' => {
871 data_type => 'boolean',
872 description => 'Unused at this time.',
873 required => '0',
874 },
875 };
876 __PACKAGE__->method_documentation->{ 'update_service_version' } = {
877 summary => 'Update a service version',
878 params => $params,
879 returns => 'VersionResponse',
880 };
881 }
882 # @return VersionResponse
883 #
884 sub update_service_version {
885 my ($self, %args) = @_;
886  
887 # verify the required parameter 'service_id' is set
888 unless (exists $args{'service_id'}) {
889 croak("Missing the required parameter 'service_id' when calling update_service_version");
890 }
891  
892 # verify the required parameter 'version_id' is set
893 unless (exists $args{'version_id'}) {
894 croak("Missing the required parameter 'version_id' when calling update_service_version");
895 }
896  
897 # parse inputs
898 my $_resource_path = '/service/{service_id}/version/{version_id}';
899  
900 my $_method = 'PUT';
901 my $query_params = {};
902 my $header_params = {};
903 my $form_params = {};
904  
905 # 'Accept' and 'Content-Type' header
906 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
907 if ($_header_accept) {
908 $header_params->{'Accept'} = $_header_accept;
909 }
910 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
911  
912 # path params
913 if ( exists $args{'service_id'}) {
914 my $_base_variable = "{" . "service_id" . "}";
915 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
916 $_resource_path =~ s/$_base_variable/$_base_value/g;
917 }
918  
919 # path params
920 if ( exists $args{'version_id'}) {
921 my $_base_variable = "{" . "version_id" . "}";
922 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
923 $_resource_path =~ s/$_base_variable/$_base_value/g;
924 }
925  
926 # form params
927 if ( exists $args{'active'} ) {
928 $form_params->{'active'} = $self->{api_client}->to_form_value($args{'active'});
929 }
930  
931 # form params
932 if ( exists $args{'comment'} ) {
933 $form_params->{'comment'} = $self->{api_client}->to_form_value($args{'comment'});
934 }
935  
936 # form params
937 if ( exists $args{'deployed'} ) {
938 $form_params->{'deployed'} = $self->{api_client}->to_form_value($args{'deployed'});
939 }
940  
941 # form params
942 if ( exists $args{'locked'} ) {
943 $form_params->{'locked'} = $self->{api_client}->to_form_value($args{'locked'});
944 }
945  
946 # form params
947 if ( exists $args{'number'} ) {
948 $form_params->{'number'} = $self->{api_client}->to_form_value($args{'number'});
949 }
950  
951 # form params
952 if ( exists $args{'staging'} ) {
953 $form_params->{'staging'} = $self->{api_client}->to_form_value($args{'staging'});
954 }
955  
956 # form params
957 if ( exists $args{'testing'} ) {
958 $form_params->{'testing'} = $self->{api_client}->to_form_value($args{'testing'});
959 }
960  
961 my $_body_data;
962 # authentication setting, if any
963 my $auth_settings = [qw(token )];
964  
965 # make the API Call
966 my $response = $self->{api_client}->call_api($_resource_path, $_method,
967 $query_params, $form_params,
968 $header_params, $_body_data, $auth_settings);
969 if (!$response) {
970 return;
971 }
972 my $_response_object = $self->{api_client}->deserialize('VersionResponse', $response);
973 return $_response_object;
974 }
975  
976 #
977 # validate_service_version
978 #
979 # Validate a service version
980 #
981 # @param string $service_id Alphanumeric string identifying the service. (required)
982 # @param int $version_id Integer identifying a service version. (required)
983 {
984 my $params = {
985 'service_id' => {
986 data_type => 'string',
987 description => 'Alphanumeric string identifying the service.',
988 required => '1',
989 },
990 'version_id' => {
991 data_type => 'int',
992 description => 'Integer identifying a service version.',
993 required => '1',
994 },
995 };
996 __PACKAGE__->method_documentation->{ 'validate_service_version' } = {
997 summary => 'Validate a service version',
998 params => $params,
999 returns => 'InlineResponse200',
1000 };
1001 }
1002 # @return InlineResponse200
1003 #
1004 sub validate_service_version {
1005 my ($self, %args) = @_;
1006  
1007 # verify the required parameter 'service_id' is set
1008 unless (exists $args{'service_id'}) {
1009 croak("Missing the required parameter 'service_id' when calling validate_service_version");
1010 }
1011  
1012 # verify the required parameter 'version_id' is set
1013 unless (exists $args{'version_id'}) {
1014 croak("Missing the required parameter 'version_id' when calling validate_service_version");
1015 }
1016  
1017 # parse inputs
1018 my $_resource_path = '/service/{service_id}/version/{version_id}/validate';
1019  
1020 my $_method = 'GET';
1021 my $query_params = {};
1022 my $header_params = {};
1023 my $form_params = {};
1024  
1025 # 'Accept' and 'Content-Type' header
1026 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
1027 if ($_header_accept) {
1028 $header_params->{'Accept'} = $_header_accept;
1029 }
1030 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
1031  
1032 # path params
1033 if ( exists $args{'service_id'}) {
1034 my $_base_variable = "{" . "service_id" . "}";
1035 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
1036 $_resource_path =~ s/$_base_variable/$_base_value/g;
1037 }
1038  
1039 # path params
1040 if ( exists $args{'version_id'}) {
1041 my $_base_variable = "{" . "version_id" . "}";
1042 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
1043 $_resource_path =~ s/$_base_variable/$_base_value/g;
1044 }
1045  
1046 my $_body_data;
1047 # authentication setting, if any
1048 my $auth_settings = [qw(token )];
1049  
1050 # make the API Call
1051 my $response = $self->{api_client}->call_api($_resource_path, $_method,
1052 $query_params, $form_params,
1053 $header_params, $_body_data, $auth_settings);
1054 if (!$response) {
1055 return;
1056 }
1057 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
1058 return $_response_object;
1059 }
1060  
1061 1;