Fastly/TlsCertificatesApi.pm untested

filter: Statementstmt 0.0% 0 / 205 Branchbran 0.0% 0 / 58 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 16 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 295 CC 30 SCAR 37.1
CC
30
Cov
0%
list_tls_certs
110.0
update_tls_cert
42.0
get_tls_cert
30.0
CRAP 40.9
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::TlsCertificatesApi;
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_tls_cert
51 #
52 # Create a TLS certificate
53 #
54 # @param TlsCertificate $tls_certificate (optional)
55 {
56 my $params = {
57 'tls_certificate' => {
58 data_type => 'TlsCertificate',
59 description => '',
60 required => '0',
61 },
62 };
63 __PACKAGE__->method_documentation->{ 'create_tls_cert' } = {
64 summary => 'Create a TLS certificate',
65 params => $params,
66 returns => 'object',
67 };
68 }
69 # @return object
70 #
71 sub create_tls_cert {
72 my ($self, %args) = @_;
73  
74 # parse inputs
75 my $_resource_path = '/tls/certificates';
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{'tls_certificate'}) {
92 $_body_data = $args{'tls_certificate'};
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('object', $response);
106 return $_response_object;
107 }
108  
109 #
110 # delete_tls_cert
111 #
112 # Delete a TLS certificate
113 #
114 # @param string $tls_certificate_id Alphanumeric string identifying a TLS certificate. (required)
115 {
116 my $params = {
117 'tls_certificate_id' => {
118 data_type => 'string',
119 description => 'Alphanumeric string identifying a TLS certificate.',
120 required => '1',
121 },
122 };
123 __PACKAGE__->method_documentation->{ 'delete_tls_cert' } = {
124 summary => 'Delete a TLS certificate',
125 params => $params,
126 returns => undef,
127 };
128 }
129 # @return void
130 #
131 sub delete_tls_cert {
132 my ($self, %args) = @_;
133  
134 # verify the required parameter 'tls_certificate_id' is set
135 unless (exists $args{'tls_certificate_id'}) {
136 croak("Missing the required parameter 'tls_certificate_id' when calling delete_tls_cert");
137 }
138  
139 # parse inputs
140 my $_resource_path = '/tls/certificates/{tls_certificate_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{'tls_certificate_id'}) {
156 my $_base_variable = "{" . "tls_certificate_id" . "}";
157 my $_base_value = $self->{api_client}->to_path_value($args{'tls_certificate_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 # get_tls_cert
174 #
175 # Get a TLS certificate
176 #
177 # @param string $tls_certificate_id Alphanumeric string identifying a TLS certificate. (required)
178 {
179 my $params = {
180 'tls_certificate_id' => {
181 data_type => 'string',
182 description => 'Alphanumeric string identifying a TLS certificate.',
183 required => '1',
184 },
185 };
186 __PACKAGE__->method_documentation->{ 'get_tls_cert' } = {
187 summary => 'Get a TLS certificate',
188 params => $params,
189 returns => 'TlsCertificateResponse',
190 };
191 }
192 # @return TlsCertificateResponse
193 #
194 sub get_tls_cert {
195 my ($self, %args) = @_;
196  
197 # verify the required parameter 'tls_certificate_id' is set
198 unless (exists $args{'tls_certificate_id'}) {
199 croak("Missing the required parameter 'tls_certificate_id' when calling get_tls_cert");
200 }
201  
202 # parse inputs
203 my $_resource_path = '/tls/certificates/{tls_certificate_id}';
204  
205 my $_method = 'GET';
206 my $query_params = {};
207 my $header_params = {};
208 my $form_params = {};
209  
210 # 'Accept' and 'Content-Type' header
211 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
212 if ($_header_accept) {
213 $header_params->{'Accept'} = $_header_accept;
214 }
215 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
216  
217 # path params
218 if ( exists $args{'tls_certificate_id'}) {
219 my $_base_variable = "{" . "tls_certificate_id" . "}";
220 my $_base_value = $self->{api_client}->to_path_value($args{'tls_certificate_id'});
221 $_resource_path =~ s/$_base_variable/$_base_value/g;
222 }
223  
224 my $_body_data;
225 # authentication setting, if any
226 my $auth_settings = [qw(token )];
227  
228 # make the API Call
229 my $response = $self->{api_client}->call_api($_resource_path, $_method,
230 $query_params, $form_params,
231 $header_params, $_body_data, $auth_settings);
232 if (!$response) {
233 return;
234 }
235 my $_response_object = $self->{api_client}->deserialize('TlsCertificateResponse', $response);
236 return $_response_object;
237 }
238  
239 #
240 # get_tls_cert_blob
241 #
242 # Get a TLS certificate blob (Limited Availability)
243 #
244 # @param string $tls_certificate_id Alphanumeric string identifying a TLS certificate. (required)
245 {
246 my $params = {
247 'tls_certificate_id' => {
248 data_type => 'string',
249 description => 'Alphanumeric string identifying a TLS certificate.',
250 required => '1',
251 },
252 };
253 __PACKAGE__->method_documentation->{ 'get_tls_cert_blob' } = {
254 summary => 'Get a TLS certificate blob (Limited Availability)',
255 params => $params,
256 returns => 'TlsCertificateBlobResponse',
257 };
258 }
259 # @return TlsCertificateBlobResponse
260 #
261 sub get_tls_cert_blob {
262 my ($self, %args) = @_;
263  
264 # verify the required parameter 'tls_certificate_id' is set
265 unless (exists $args{'tls_certificate_id'}) {
266 croak("Missing the required parameter 'tls_certificate_id' when calling get_tls_cert_blob");
267 }
268  
269 # parse inputs
270 my $_resource_path = '/tls/certificates/{tls_certificate_id}/blob';
271  
272 my $_method = 'GET';
273 my $query_params = {};
274 my $header_params = {};
275 my $form_params = {};
276  
277 # 'Accept' and 'Content-Type' header
278 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
279 if ($_header_accept) {
280 $header_params->{'Accept'} = $_header_accept;
281 }
282 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
283  
284 # path params
285 if ( exists $args{'tls_certificate_id'}) {
286 my $_base_variable = "{" . "tls_certificate_id" . "}";
287 my $_base_value = $self->{api_client}->to_path_value($args{'tls_certificate_id'});
288 $_resource_path =~ s/$_base_variable/$_base_value/g;
289 }
290  
291 my $_body_data;
292 # authentication setting, if any
293 my $auth_settings = [qw(token )];
294  
295 # make the API Call
296 my $response = $self->{api_client}->call_api($_resource_path, $_method,
297 $query_params, $form_params,
298 $header_params, $_body_data, $auth_settings);
299 if (!$response) {
300 return;
301 }
302 my $_response_object = $self->{api_client}->deserialize('TlsCertificateBlobResponse', $response);
303 return $_response_object;
304 }
305  
306 #
307 # list_tls_certs
308 #
309 # List TLS certificates
310 #
311 # @param string $filter[in_use] Optional. Limit the returned certificates to those currently using Fastly to terminate TLS (that is, certificates associated with an activation). Permitted values: true, false. (optional)
312 # @param string $filter[not_after] Limit the returned certificates to those that expire prior to the specified date in UTC. Accepts parameters: lte (e.g., filter[not_after][lte]=2020-05-05). (optional)
313 # @param string $filter[tls_domains/id] Limit the returned certificates to those that include the specific domain. (optional)
314 # @param string $include Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`. (optional)
315 # @param string $sort The order in which to list the results. (optional, default to '-created_at')
316 # @param int $page[number] Current page. (optional)
317 # @param int $page[size] Number of records per page. (optional, default to 20)
318 {
319 my $params = {
320 'filter[in_use]' => {
321 data_type => 'string',
322 description => 'Optional. Limit the returned certificates to those currently using Fastly to terminate TLS (that is, certificates associated with an activation). Permitted values: true, false.',
323 required => '0',
324 },
325 'filter[not_after]' => {
326 data_type => 'string',
327 description => 'Limit the returned certificates to those that expire prior to the specified date in UTC. Accepts parameters: lte (e.g., filter[not_after][lte]=2020-05-05). ',
328 required => '0',
329 },
330 'filter[tls_domains/id]' => {
331 data_type => 'string',
332 description => 'Limit the returned certificates to those that include the specific domain.',
333 required => '0',
334 },
335 'include' => {
336 data_type => 'string',
337 description => 'Include related objects. Optional, comma-separated values. Permitted values: `tls_activations`. ',
338 required => '0',
339 },
340 'sort' => {
341 data_type => 'string',
342 description => 'The order in which to list the results.',
343 required => '0',
344 },
345 'page[number]' => {
346 data_type => 'int',
347 description => 'Current page.',
348 required => '0',
349 },
350 'page[size]' => {
351 data_type => 'int',
352 description => 'Number of records per page.',
353 required => '0',
354 },
355 };
356 __PACKAGE__->method_documentation->{ 'list_tls_certs' } = {
357 summary => 'List TLS certificates',
358 params => $params,
359 returns => 'TlsCertificatesResponse',
360 };
361 }
362 # @return TlsCertificatesResponse
363 #
364 sub list_tls_certs {
365 my ($self, %args) = @_;
366  
367 # parse inputs
368 my $_resource_path = '/tls/certificates';
369  
370 my $_method = 'GET';
371 my $query_params = {};
372 my $header_params = {};
373 my $form_params = {};
374  
375 # 'Accept' and 'Content-Type' header
376 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
377 if ($_header_accept) {
378 $header_params->{'Accept'} = $_header_accept;
379 }
380 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
381  
382 # query params
383 if ( exists $args{'filter[in_use]'}) {
384 $query_params->{'filter[in_use]'} = $self->{api_client}->to_query_value($args{'filter[in_use]'});
385 }
386  
387 # query params
388 if ( exists $args{'filter[not_after]'}) {
389 $query_params->{'filter[not_after]'} = $self->{api_client}->to_query_value($args{'filter[not_after]'});
390 }
391  
392 # query params
393 if ( exists $args{'filter[tls_domains/id]'}) {
394 $query_params->{'filter[tls_domains.id]'} = $self->{api_client}->to_query_value($args{'filter[tls_domains/id]'});
395 }
396  
397 # query params
398 if ( exists $args{'include'}) {
399 $query_params->{'include'} = $self->{api_client}->to_query_value($args{'include'});
400 }
401  
402 # query params
403 if ( exists $args{'sort'}) {
404 $query_params->{'sort'} = $self->{api_client}->to_query_value($args{'sort'});
405 }
406  
407 # query params
408 if ( exists $args{'page[number]'}) {
409 $query_params->{'page[number]'} = $self->{api_client}->to_query_value($args{'page[number]'});
410 }
411  
412 # query params
413 if ( exists $args{'page[size]'}) {
414 $query_params->{'page[size]'} = $self->{api_client}->to_query_value($args{'page[size]'});
415 }
416  
417 my $_body_data;
418 # authentication setting, if any
419 my $auth_settings = [qw(token )];
420  
421 # make the API Call
422 my $response = $self->{api_client}->call_api($_resource_path, $_method,
423 $query_params, $form_params,
424 $header_params, $_body_data, $auth_settings);
425 if (!$response) {
426 return;
427 }
428 my $_response_object = $self->{api_client}->deserialize('TlsCertificatesResponse', $response);
429 return $_response_object;
430 }
431  
432 #
433 # update_tls_cert
434 #
435 # Update a TLS certificate
436 #
437 # @param string $tls_certificate_id Alphanumeric string identifying a TLS certificate. (required)
438 # @param TlsCertificate $tls_certificate (optional)
439 {
440 my $params = {
441 'tls_certificate_id' => {
442 data_type => 'string',
443 description => 'Alphanumeric string identifying a TLS certificate.',
444 required => '1',
445 },
446 'tls_certificate' => {
447 data_type => 'TlsCertificate',
448 description => '',
449 required => '0',
450 },
451 };
452 __PACKAGE__->method_documentation->{ 'update_tls_cert' } = {
453 summary => 'Update a TLS certificate',
454 params => $params,
455 returns => 'TlsCertificateResponse',
456 };
457 }
458 # @return TlsCertificateResponse
459 #
460 sub update_tls_cert {
461 my ($self, %args) = @_;
462  
463 # verify the required parameter 'tls_certificate_id' is set
464 unless (exists $args{'tls_certificate_id'}) {
465 croak("Missing the required parameter 'tls_certificate_id' when calling update_tls_cert");
466 }
467  
468 # parse inputs
469 my $_resource_path = '/tls/certificates/{tls_certificate_id}';
470  
471 my $_method = 'PATCH';
472 my $query_params = {};
473 my $header_params = {};
474 my $form_params = {};
475  
476 # 'Accept' and 'Content-Type' header
477 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
478 if ($_header_accept) {
479 $header_params->{'Accept'} = $_header_accept;
480 }
481 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/vnd.api+json');
482  
483 # path params
484 if ( exists $args{'tls_certificate_id'}) {
485 my $_base_variable = "{" . "tls_certificate_id" . "}";
486 my $_base_value = $self->{api_client}->to_path_value($args{'tls_certificate_id'});
487 $_resource_path =~ s/$_base_variable/$_base_value/g;
488 }
489  
490 my $_body_data;
491 # body params
492 if ( exists $args{'tls_certificate'}) {
493 $_body_data = $args{'tls_certificate'};
494 }
495  
496 # authentication setting, if any
497 my $auth_settings = [qw(token )];
498  
499 # make the API Call
500 my $response = $self->{api_client}->call_api($_resource_path, $_method,
501 $query_params, $form_params,
502 $header_params, $_body_data, $auth_settings);
503 if (!$response) {
504 return;
505 }
506 my $_response_object = $self->{api_client}->deserialize('TlsCertificateResponse', $response);
507 return $_response_object;
508 }
509  
510 1;