Fastly/TlsConfigurationsApi.pm untested

filter: Statementstmt 0.0% 0 / 124 Branchbran 0.0% 0 / 34 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 184 CC 18 SCAR 34.3
CC
18
Cov
0%
list_tls_configs
56.0
get_tls_config
42.0
update_tls_config
42.0
CRAP 30.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::TlsConfigurationsApi;
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 # get_tls_config
51 #
52 # Get a TLS configuration
53 #
54 # @param string $tls_configuration_id Alphanumeric string identifying a TLS configuration. (required)
55 # @param string $include Include related objects. Optional, comma-separated values. Permitted values: `dns_records`. (optional)
56 {
57 my $params = {
58 'tls_configuration_id' => {
59 data_type => 'string',
60 description => 'Alphanumeric string identifying a TLS configuration.',
61 required => '1',
62 },
63 'include' => {
64 data_type => 'string',
65 description => 'Include related objects. Optional, comma-separated values. Permitted values: `dns_records`. ',
66 required => '0',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'get_tls_config' } = {
70 summary => 'Get a TLS configuration',
71 params => $params,
72 returns => 'TlsConfigurationResponse',
73 };
74 }
75 # @return TlsConfigurationResponse
76 #
77 sub get_tls_config {
78 my ($self, %args) = @_;
79  
80 # verify the required parameter 'tls_configuration_id' is set
81 unless (exists $args{'tls_configuration_id'}) {
82 croak("Missing the required parameter 'tls_configuration_id' when calling get_tls_config");
83 }
84  
85 # parse inputs
86 my $_resource_path = '/tls/configurations/{tls_configuration_id}';
87  
88 my $_method = 'GET';
89 my $query_params = {};
90 my $header_params = {};
91 my $form_params = {};
92  
93 # 'Accept' and 'Content-Type' header
94 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
95 if ($_header_accept) {
96 $header_params->{'Accept'} = $_header_accept;
97 }
98 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
99  
100 # query params
101 if ( exists $args{'include'}) {
102 $query_params->{'include'} = $self->{api_client}->to_query_value($args{'include'});
103 }
104  
105 # path params
106 if ( exists $args{'tls_configuration_id'}) {
107 my $_base_variable = "{" . "tls_configuration_id" . "}";
108 my $_base_value = $self->{api_client}->to_path_value($args{'tls_configuration_id'});
109 $_resource_path =~ s/$_base_variable/$_base_value/g;
110 }
111  
112 my $_body_data;
113 # authentication setting, if any
114 my $auth_settings = [qw(token )];
115  
116 # make the API Call
117 my $response = $self->{api_client}->call_api($_resource_path, $_method,
118 $query_params, $form_params,
119 $header_params, $_body_data, $auth_settings);
120 if (!$response) {
121 return;
122 }
123 my $_response_object = $self->{api_client}->deserialize('TlsConfigurationResponse', $response);
124 return $_response_object;
125 }
126  
127 #
128 # list_tls_configs
129 #
130 # List TLS configurations
131 #
132 # @param string $filter[bulk] Optionally filters by the bulk attribute. (optional)
133 # @param string $include Include related objects. Optional, comma-separated values. Permitted values: `dns_records`. (optional)
134 # @param int $page[number] Current page. (optional)
135 # @param int $page[size] Number of records per page. (optional, default to 20)
136 {
137 my $params = {
138 'filter[bulk]' => {
139 data_type => 'string',
140 description => 'Optionally filters by the bulk attribute.',
141 required => '0',
142 },
143 'include' => {
144 data_type => 'string',
145 description => 'Include related objects. Optional, comma-separated values. Permitted values: `dns_records`. ',
146 required => '0',
147 },
148 'page[number]' => {
149 data_type => 'int',
150 description => 'Current page.',
151 required => '0',
152 },
153 'page[size]' => {
154 data_type => 'int',
155 description => 'Number of records per page.',
156 required => '0',
157 },
158 };
159 __PACKAGE__->method_documentation->{ 'list_tls_configs' } = {
160 summary => 'List TLS configurations',
161 params => $params,
162 returns => 'TlsConfigurationsResponse',
163 };
164 }
165 # @return TlsConfigurationsResponse
166 #
167 sub list_tls_configs {
168 my ($self, %args) = @_;
169  
170 # parse inputs
171 my $_resource_path = '/tls/configurations';
172  
173 my $_method = 'GET';
174 my $query_params = {};
175 my $header_params = {};
176 my $form_params = {};
177  
178 # 'Accept' and 'Content-Type' header
179 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
180 if ($_header_accept) {
181 $header_params->{'Accept'} = $_header_accept;
182 }
183 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
184  
185 # query params
186 if ( exists $args{'filter[bulk]'}) {
187 $query_params->{'filter[bulk]'} = $self->{api_client}->to_query_value($args{'filter[bulk]'});
188 }
189  
190 # query params
191 if ( exists $args{'include'}) {
192 $query_params->{'include'} = $self->{api_client}->to_query_value($args{'include'});
193 }
194  
195 # query params
196 if ( exists $args{'page[number]'}) {
197 $query_params->{'page[number]'} = $self->{api_client}->to_query_value($args{'page[number]'});
198 }
199  
200 # query params
201 if ( exists $args{'page[size]'}) {
202 $query_params->{'page[size]'} = $self->{api_client}->to_query_value($args{'page[size]'});
203 }
204  
205 my $_body_data;
206 # authentication setting, if any
207 my $auth_settings = [qw(token )];
208  
209 # make the API Call
210 my $response = $self->{api_client}->call_api($_resource_path, $_method,
211 $query_params, $form_params,
212 $header_params, $_body_data, $auth_settings);
213 if (!$response) {
214 return;
215 }
216 my $_response_object = $self->{api_client}->deserialize('TlsConfigurationsResponse', $response);
217 return $_response_object;
218 }
219  
220 #
221 # update_tls_config
222 #
223 # Update a TLS configuration
224 #
225 # @param string $tls_configuration_id Alphanumeric string identifying a TLS configuration. (required)
226 # @param TlsConfiguration $tls_configuration (optional)
227 {
228 my $params = {
229 'tls_configuration_id' => {
230 data_type => 'string',
231 description => 'Alphanumeric string identifying a TLS configuration.',
232 required => '1',
233 },
234 'tls_configuration' => {
235 data_type => 'TlsConfiguration',
236 description => '',
237 required => '0',
238 },
239 };
240 __PACKAGE__->method_documentation->{ 'update_tls_config' } = {
241 summary => 'Update a TLS configuration',
242 params => $params,
243 returns => 'TlsConfigurationResponse',
244 };
245 }
246 # @return TlsConfigurationResponse
247 #
248 sub update_tls_config {
249 my ($self, %args) = @_;
250  
251 # verify the required parameter 'tls_configuration_id' is set
252 unless (exists $args{'tls_configuration_id'}) {
253 croak("Missing the required parameter 'tls_configuration_id' when calling update_tls_config");
254 }
255  
256 # parse inputs
257 my $_resource_path = '/tls/configurations/{tls_configuration_id}';
258  
259 my $_method = 'PATCH';
260 my $query_params = {};
261 my $header_params = {};
262 my $form_params = {};
263  
264 # 'Accept' and 'Content-Type' header
265 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
266 if ($_header_accept) {
267 $header_params->{'Accept'} = $_header_accept;
268 }
269 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/vnd.api+json');
270  
271 # path params
272 if ( exists $args{'tls_configuration_id'}) {
273 my $_base_variable = "{" . "tls_configuration_id" . "}";
274 my $_base_value = $self->{api_client}->to_path_value($args{'tls_configuration_id'});
275 $_resource_path =~ s/$_base_variable/$_base_value/g;
276 }
277  
278 my $_body_data;
279 # body params
280 if ( exists $args{'tls_configuration'}) {
281 $_body_data = $args{'tls_configuration'};
282 }
283  
284 # authentication setting, if any
285 my $auth_settings = [qw(token )];
286  
287 # make the API Call
288 my $response = $self->{api_client}->call_api($_resource_path, $_method,
289 $query_params, $form_params,
290 $header_params, $_body_data, $auth_settings);
291 if (!$response) {
292 return;
293 }
294 my $_response_object = $self->{api_client}->deserialize('TlsConfigurationResponse', $response);
295 return $_response_object;
296 }
297  
298 1;