Fastly/DmDomainsApi.pm untested

filter: Statementstmt 0.0% 0 / 179 Branchbran 0.0% 0 / 52 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 261 CC 27 SCAR 39.1
CC
27
Cov
0%
list_dm_domains
132.0
update_dm_domain
42.0
get_dm_domain
30.0
CRAP 49.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::DmDomainsApi;
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_dm_domain
51 #
52 # Create a domain
53 #
54 # @param RequestBodyForCreate $request_body_for_create (optional)
55 {
56 my $params = {
57 'request_body_for_create' => {
58 data_type => 'RequestBodyForCreate',
59 description => '',
60 required => '0',
61 },
62 };
63 __PACKAGE__->method_documentation->{ 'create_dm_domain' } = {
64 summary => 'Create a domain',
65 params => $params,
66 returns => 'SuccessfulResponseAsObject',
67 };
68 }
69 # @return SuccessfulResponseAsObject
70 #
71 sub create_dm_domain {
72 my ($self, %args) = @_;
73  
74 # parse inputs
75 my $_resource_path = '/domain-management/v1/domains';
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/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/json');
88  
89 my $_body_data;
90 # body params
91 if ( exists $args{'request_body_for_create'}) {
92 $_body_data = $args{'request_body_for_create'};
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('SuccessfulResponseAsObject', $response);
106 return $_response_object;
107 }
108  
109 #
110 # delete_dm_domain
111 #
112 # Delete a domain
113 #
114 # @param string $domain_id (required)
115 {
116 my $params = {
117 'domain_id' => {
118 data_type => 'string',
119 description => '',
120 required => '1',
121 },
122 };
123 __PACKAGE__->method_documentation->{ 'delete_dm_domain' } = {
124 summary => 'Delete a domain',
125 params => $params,
126 returns => undef,
127 };
128 }
129 # @return void
130 #
131 sub delete_dm_domain {
132 my ($self, %args) = @_;
133  
134 # verify the required parameter 'domain_id' is set
135 unless (exists $args{'domain_id'}) {
136 croak("Missing the required parameter 'domain_id' when calling delete_dm_domain");
137 }
138  
139 # parse inputs
140 my $_resource_path = '/domain-management/v1/domains/{domain_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{'domain_id'}) {
156 my $_base_variable = "{" . "domain_id" . "}";
157 my $_base_value = $self->{api_client}->to_path_value($args{'domain_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_dm_domain
174 #
175 # Get a domain
176 #
177 # @param string $domain_id (required)
178 {
179 my $params = {
180 'domain_id' => {
181 data_type => 'string',
182 description => '',
183 required => '1',
184 },
185 };
186 __PACKAGE__->method_documentation->{ 'get_dm_domain' } = {
187 summary => 'Get a domain',
188 params => $params,
189 returns => 'SuccessfulResponseAsObject',
190 };
191 }
192 # @return SuccessfulResponseAsObject
193 #
194 sub get_dm_domain {
195 my ($self, %args) = @_;
196  
197 # verify the required parameter 'domain_id' is set
198 unless (exists $args{'domain_id'}) {
199 croak("Missing the required parameter 'domain_id' when calling get_dm_domain");
200 }
201  
202 # parse inputs
203 my $_resource_path = '/domain-management/v1/domains/{domain_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/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{'domain_id'}) {
219 my $_base_variable = "{" . "domain_id" . "}";
220 my $_base_value = $self->{api_client}->to_path_value($args{'domain_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('SuccessfulResponseAsObject', $response);
236 return $_response_object;
237 }
238  
239 #
240 # list_dm_domains
241 #
242 # List domains
243 #
244 # @param string $fqdn (optional)
245 # @param string $fqdn_match (Optional) Filter fully-qualified domain name (FQDN) specifically by match type. If used, requires filtering by FQDN. (optional, default to 'contains')
246 # @param string $service_id Filter results based on a service_id. (optional)
247 # @param string $sort The order in which to list the results. (optional, default to 'fqdn')
248 # @param boolean $activated (optional)
249 # @param boolean $verified (optional)
250 # @param string $cursor Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. (optional)
251 # @param int $limit Limit how many results are returned. (optional, default to 20)
252 {
253 my $params = {
254 'fqdn' => {
255 data_type => 'string',
256 description => '',
257 required => '0',
258 },
259 'fqdn_match' => {
260 data_type => 'string',
261 description => '(Optional) Filter fully-qualified domain name (FQDN) specifically by match type. If used, requires filtering by FQDN.',
262 required => '0',
263 },
264 'service_id' => {
265 data_type => 'string',
266 description => 'Filter results based on a service_id.',
267 required => '0',
268 },
269 'sort' => {
270 data_type => 'string',
271 description => 'The order in which to list the results.',
272 required => '0',
273 },
274 'activated' => {
275 data_type => 'boolean',
276 description => '',
277 required => '0',
278 },
279 'verified' => {
280 data_type => 'boolean',
281 description => '',
282 required => '0',
283 },
284 'cursor' => {
285 data_type => 'string',
286 description => 'Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty.',
287 required => '0',
288 },
289 'limit' => {
290 data_type => 'int',
291 description => 'Limit how many results are returned.',
292 required => '0',
293 },
294 };
295 __PACKAGE__->method_documentation->{ 'list_dm_domains' } = {
296 summary => 'List domains',
297 params => $params,
298 returns => 'InlineResponse20014',
299 };
300 }
301 # @return InlineResponse20014
302 #
303 sub list_dm_domains {
304 my ($self, %args) = @_;
305  
306 # parse inputs
307 my $_resource_path = '/domain-management/v1/domains';
308  
309 my $_method = 'GET';
310 my $query_params = {};
311 my $header_params = {};
312 my $form_params = {};
313  
314 # 'Accept' and 'Content-Type' header
315 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
316 if ($_header_accept) {
317 $header_params->{'Accept'} = $_header_accept;
318 }
319 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
320  
321 # query params
322 if ( exists $args{'fqdn'}) {
323 $query_params->{'fqdn'} = $self->{api_client}->to_query_value($args{'fqdn'});
324 }
325  
326 # query params
327 if ( exists $args{'fqdn_match'}) {
328 $query_params->{'fqdn_match'} = $self->{api_client}->to_query_value($args{'fqdn_match'});
329 }
330  
331 # query params
332 if ( exists $args{'service_id'}) {
333 $query_params->{'service_id'} = $self->{api_client}->to_query_value($args{'service_id'});
334 }
335  
336 # query params
337 if ( exists $args{'sort'}) {
338 $query_params->{'sort'} = $self->{api_client}->to_query_value($args{'sort'});
339 }
340  
341 # query params
342 if ( exists $args{'activated'}) {
343 $query_params->{'activated'} = $self->{api_client}->to_query_value($args{'activated'});
344 }
345  
346 # query params
347 if ( exists $args{'verified'}) {
348 $query_params->{'verified'} = $self->{api_client}->to_query_value($args{'verified'});
349 }
350  
351 # query params
352 if ( exists $args{'cursor'}) {
353 $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'});
354 }
355  
356 # query params
357 if ( exists $args{'limit'}) {
358 $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'});
359 }
360  
361 my $_body_data;
362 # authentication setting, if any
363 my $auth_settings = [qw(token )];
364  
365 # make the API Call
366 my $response = $self->{api_client}->call_api($_resource_path, $_method,
367 $query_params, $form_params,
368 $header_params, $_body_data, $auth_settings);
369 if (!$response) {
370 return;
371 }
372 my $_response_object = $self->{api_client}->deserialize('InlineResponse20014', $response);
373 return $_response_object;
374 }
375  
376 #
377 # update_dm_domain
378 #
379 # Update a domain
380 #
381 # @param string $domain_id (required)
382 # @param RequestBodyForUpdate $request_body_for_update (optional)
383 {
384 my $params = {
385 'domain_id' => {
386 data_type => 'string',
387 description => '',
388 required => '1',
389 },
390 'request_body_for_update' => {
391 data_type => 'RequestBodyForUpdate',
392 description => '',
393 required => '0',
394 },
395 };
396 __PACKAGE__->method_documentation->{ 'update_dm_domain' } = {
397 summary => 'Update a domain',
398 params => $params,
399 returns => 'SuccessfulResponseAsObject',
400 };
401 }
402 # @return SuccessfulResponseAsObject
403 #
404 sub update_dm_domain {
405 my ($self, %args) = @_;
406  
407 # verify the required parameter 'domain_id' is set
408 unless (exists $args{'domain_id'}) {
409 croak("Missing the required parameter 'domain_id' when calling update_dm_domain");
410 }
411  
412 # parse inputs
413 my $_resource_path = '/domain-management/v1/domains/{domain_id}';
414  
415 my $_method = 'PATCH';
416 my $query_params = {};
417 my $header_params = {};
418 my $form_params = {};
419  
420 # 'Accept' and 'Content-Type' header
421 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
422 if ($_header_accept) {
423 $header_params->{'Accept'} = $_header_accept;
424 }
425 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
426  
427 # path params
428 if ( exists $args{'domain_id'}) {
429 my $_base_variable = "{" . "domain_id" . "}";
430 my $_base_value = $self->{api_client}->to_path_value($args{'domain_id'});
431 $_resource_path =~ s/$_base_variable/$_base_value/g;
432 }
433  
434 my $_body_data;
435 # body params
436 if ( exists $args{'request_body_for_update'}) {
437 $_body_data = $args{'request_body_for_update'};
438 }
439  
440 # authentication setting, if any
441 my $auth_settings = [qw(token )];
442  
443 # make the API Call
444 my $response = $self->{api_client}->call_api($_resource_path, $_method,
445 $query_params, $form_params,
446 $header_params, $_body_data, $auth_settings);
447 if (!$response) {
448 return;
449 }
450 my $_response_object = $self->{api_client}->deserialize('SuccessfulResponseAsObject', $response);
451 return $_response_object;
452 }
453  
454 1;