Fastly/TlsPrivateKeysApi.pm untested

filter: Statementstmt 0.0% 0 / 139 Branchbran 0.0% 0 / 32 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 199 CC 17 SCAR 29.8
CC
17
Cov
0%
list_tls_keys
42.0
get_tls_key
30.0
create_tls_key
20.0
CRAP 19.7
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::TlsPrivateKeysApi;
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_key
51 #
52 # Create a TLS private key
53 #
54 # @param TlsPrivateKey $tls_private_key (optional)
55 {
56 my $params = {
57 'tls_private_key' => {
58 data_type => 'TlsPrivateKey',
59 description => '',
60 required => '0',
61 },
62 };
63 __PACKAGE__->method_documentation->{ 'create_tls_key' } = {
64 summary => 'Create a TLS private key',
65 params => $params,
66 returns => 'TlsPrivateKeyResponse',
67 };
68 }
69 # @return TlsPrivateKeyResponse
70 #
71 sub create_tls_key {
72 my ($self, %args) = @_;
73  
74 # parse inputs
75 my $_resource_path = '/tls/private_keys';
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_private_key'}) {
92 $_body_data = $args{'tls_private_key'};
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('TlsPrivateKeyResponse', $response);
106 return $_response_object;
107 }
108  
109 #
110 # delete_tls_key
111 #
112 # Delete a TLS private key
113 #
114 # @param string $tls_private_key_id Alphanumeric string identifying a private Key. (required)
115 {
116 my $params = {
117 'tls_private_key_id' => {
118 data_type => 'string',
119 description => 'Alphanumeric string identifying a private Key.',
120 required => '1',
121 },
122 };
123 __PACKAGE__->method_documentation->{ 'delete_tls_key' } = {
124 summary => 'Delete a TLS private key',
125 params => $params,
126 returns => undef,
127 };
128 }
129 # @return void
130 #
131 sub delete_tls_key {
132 my ($self, %args) = @_;
133  
134 # verify the required parameter 'tls_private_key_id' is set
135 unless (exists $args{'tls_private_key_id'}) {
136 croak("Missing the required parameter 'tls_private_key_id' when calling delete_tls_key");
137 }
138  
139 # parse inputs
140 my $_resource_path = '/tls/private_keys/{tls_private_key_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_private_key_id'}) {
156 my $_base_variable = "{" . "tls_private_key_id" . "}";
157 my $_base_value = $self->{api_client}->to_path_value($args{'tls_private_key_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_key
174 #
175 # Get a TLS private key
176 #
177 # @param string $tls_private_key_id Alphanumeric string identifying a private Key. (required)
178 {
179 my $params = {
180 'tls_private_key_id' => {
181 data_type => 'string',
182 description => 'Alphanumeric string identifying a private Key.',
183 required => '1',
184 },
185 };
186 __PACKAGE__->method_documentation->{ 'get_tls_key' } = {
187 summary => 'Get a TLS private key',
188 params => $params,
189 returns => 'TlsPrivateKeyResponse',
190 };
191 }
192 # @return TlsPrivateKeyResponse
193 #
194 sub get_tls_key {
195 my ($self, %args) = @_;
196  
197 # verify the required parameter 'tls_private_key_id' is set
198 unless (exists $args{'tls_private_key_id'}) {
199 croak("Missing the required parameter 'tls_private_key_id' when calling get_tls_key");
200 }
201  
202 # parse inputs
203 my $_resource_path = '/tls/private_keys/{tls_private_key_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_private_key_id'}) {
219 my $_base_variable = "{" . "tls_private_key_id" . "}";
220 my $_base_value = $self->{api_client}->to_path_value($args{'tls_private_key_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('TlsPrivateKeyResponse', $response);
236 return $_response_object;
237 }
238  
239 #
240 # list_tls_keys
241 #
242 # List TLS private keys
243 #
244 # @param string $filter[in_use] Limit the returned keys to those without any matching TLS certificates. The only valid value is false. (optional)
245 # @param int $page[number] Current page. (optional)
246 # @param int $page[size] Number of records per page. (optional, default to 20)
247 {
248 my $params = {
249 'filter[in_use]' => {
250 data_type => 'string',
251 description => 'Limit the returned keys to those without any matching TLS certificates. The only valid value is false.',
252 required => '0',
253 },
254 'page[number]' => {
255 data_type => 'int',
256 description => 'Current page.',
257 required => '0',
258 },
259 'page[size]' => {
260 data_type => 'int',
261 description => 'Number of records per page.',
262 required => '0',
263 },
264 };
265 __PACKAGE__->method_documentation->{ 'list_tls_keys' } = {
266 summary => 'List TLS private keys',
267 params => $params,
268 returns => 'TlsPrivateKeysResponse',
269 };
270 }
271 # @return TlsPrivateKeysResponse
272 #
273 sub list_tls_keys {
274 my ($self, %args) = @_;
275  
276 # parse inputs
277 my $_resource_path = '/tls/private_keys';
278  
279 my $_method = 'GET';
280 my $query_params = {};
281 my $header_params = {};
282 my $form_params = {};
283  
284 # 'Accept' and 'Content-Type' header
285 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
286 if ($_header_accept) {
287 $header_params->{'Accept'} = $_header_accept;
288 }
289 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
290  
291 # query params
292 if ( exists $args{'filter[in_use]'}) {
293 $query_params->{'filter[in_use]'} = $self->{api_client}->to_query_value($args{'filter[in_use]'});
294 }
295  
296 # query params
297 if ( exists $args{'page[number]'}) {
298 $query_params->{'page[number]'} = $self->{api_client}->to_query_value($args{'page[number]'});
299 }
300  
301 # query params
302 if ( exists $args{'page[size]'}) {
303 $query_params->{'page[size]'} = $self->{api_client}->to_query_value($args{'page[size]'});
304 }
305  
306 my $_body_data;
307 # authentication setting, if any
308 my $auth_settings = [qw(token )];
309  
310 # make the API Call
311 my $response = $self->{api_client}->call_api($_resource_path, $_method,
312 $query_params, $form_params,
313 $header_params, $_body_data, $auth_settings);
314 if (!$response) {
315 return;
316 }
317 my $_response_object = $self->{api_client}->deserialize('TlsPrivateKeysResponse', $response);
318 return $_response_object;
319 }
320  
321 1;