Fastly/LoggingKinesisApi.pm untested

filter: Statementstmt 0.0% 0 / 240 Branchbran 0.0% 0 / 92 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 / 362 CC 47 SCAR 47.7
CC
47
Cov
0%
create_log_kinesis
272.0
delete_log_kinesis
90.0
get_log_kinesis
90.0
CRAP 118.1
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::LoggingKinesisApi;
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_log_kinesis
51 #
52 # Create an Amazon Kinesis log endpoint
53 #
54 # @param string $service_id Alphanumeric string identifying the service. (required)
55 # @param int $version_id Integer identifying a service version. (required)
56 # @param string $name The name for the real-time logging configuration. (optional)
57 # @param LoggingPlacement $placement (optional)
58 # @param string $format A Fastly [log format string](https://www.fastly.com/documentation/guides/integrations/streaming-logs/custom-log-formats/). (optional, default to '{"timestamp":"%{begin:%Y-%m-%dT%H:%M:%S}t","time_elapsed":"%{time.elapsed.usec}V","is_tls":"%{if(req.is_ssl, \"true\", \"false\")}V","client_ip":"%{req.http.Fastly-Client-IP}V","geo_city":"%{client.geo.city}V","geo_country_code":"%{client.geo.country_code}V","request":"%{req.request}V","host":"%{req.http.Fastly-Orig-Host}V","url":"%{json.escape(req.url)}V","request_referer":"%{json.escape(req.http.Referer)}V","request_user_agent":"%{json.escape(req.http.User-Agent)}V","request_accept_language":"%{json.escape(req.http.Accept-Language)}V","request_accept_charset":"%{json.escape(req.http.Accept-Charset)}V","cache_status":"%{regsub(fastly_info.state, \"^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*\", \"\\2\\3\") }V"}')
59 # @param string $topic The Amazon Kinesis stream to send logs to. Required. (optional)
60 # @param AwsRegion $region (optional)
61 # @param string $secret_key The secret key associated with the target Amazon Kinesis stream. Not required if `iam_role` is specified. (optional)
62 # @param string $access_key The access key associated with the target Amazon Kinesis stream. Not required if `iam_role` is specified. (optional)
63 # @param string $iam_role The ARN for an IAM role granting Fastly access to the target Amazon Kinesis stream. Not required if `access_key` and `secret_key` are provided. (optional)
64 # @param int $format_version The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. (optional, default to 2)
65 {
66 my $params = {
67 'service_id' => {
68 data_type => 'string',
69 description => 'Alphanumeric string identifying the service.',
70 required => '1',
71 },
72 'version_id' => {
73 data_type => 'int',
74 description => 'Integer identifying a service version.',
75 required => '1',
76 },
77 'name' => {
78 data_type => 'string',
79 description => 'The name for the real-time logging configuration.',
80 required => '0',
81 },
82 'placement' => {
83 data_type => 'LoggingPlacement',
84 description => '',
85 required => '0',
86 },
87 'format' => {
88 data_type => 'string',
89 description => 'A Fastly [log format string](https://www.fastly.com/documentation/guides/integrations/streaming-logs/custom-log-formats/).',
90 required => '0',
91 },
92 'topic' => {
93 data_type => 'string',
94 description => 'The Amazon Kinesis stream to send logs to. Required.',
95 required => '0',
96 },
97 'region' => {
98 data_type => 'AwsRegion',
99 description => '',
100 required => '0',
101 },
102 'secret_key' => {
103 data_type => 'string',
104 description => 'The secret key associated with the target Amazon Kinesis stream. Not required if `iam_role` is specified.',
105 required => '0',
106 },
107 'access_key' => {
108 data_type => 'string',
109 description => 'The access key associated with the target Amazon Kinesis stream. Not required if `iam_role` is specified.',
110 required => '0',
111 },
112 'iam_role' => {
113 data_type => 'string',
114 description => 'The ARN for an IAM role granting Fastly access to the target Amazon Kinesis stream. Not required if `access_key` and `secret_key` are provided.',
115 required => '0',
116 },
117 'format_version' => {
118 data_type => 'int',
119 description => 'The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in `vcl_log` if `format_version` is set to `2` and in `vcl_deliver` if `format_version` is set to `1`. ',
120 required => '0',
121 },
122 };
123 __PACKAGE__->method_documentation->{ 'create_log_kinesis' } = {
124 summary => 'Create an Amazon Kinesis log endpoint',
125 params => $params,
126 returns => 'LoggingKinesisResponse',
127 };
128 }
129 # @return LoggingKinesisResponse
130 #
131 sub create_log_kinesis {
132 my ($self, %args) = @_;
133  
134 # verify the required parameter 'service_id' is set
135 unless (exists $args{'service_id'}) {
136 croak("Missing the required parameter 'service_id' when calling create_log_kinesis");
137 }
138  
139 # verify the required parameter 'version_id' is set
140 unless (exists $args{'version_id'}) {
141 croak("Missing the required parameter 'version_id' when calling create_log_kinesis");
142 }
143  
144 # parse inputs
145 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/kinesis';
146  
147 my $_method = 'POST';
148 my $query_params = {};
149 my $header_params = {};
150 my $form_params = {};
151  
152 # 'Accept' and 'Content-Type' header
153 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
154 if ($_header_accept) {
155 $header_params->{'Accept'} = $_header_accept;
156 }
157 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
158  
159 # path params
160 if ( exists $args{'service_id'}) {
161 my $_base_variable = "{" . "service_id" . "}";
162 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
163 $_resource_path =~ s/$_base_variable/$_base_value/g;
164 }
165  
166 # path params
167 if ( exists $args{'version_id'}) {
168 my $_base_variable = "{" . "version_id" . "}";
169 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
170 $_resource_path =~ s/$_base_variable/$_base_value/g;
171 }
172  
173 # form params
174 if ( exists $args{'name'} ) {
175 $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'});
176 }
177  
178 # form params
179 if ( exists $args{'placement'} ) {
180 $form_params->{'placement'} = $self->{api_client}->to_form_value($args{'placement'});
181 }
182  
183 # form params
184 if ( exists $args{'format'} ) {
185 $form_params->{'format'} = $self->{api_client}->to_form_value($args{'format'});
186 }
187  
188 # form params
189 if ( exists $args{'topic'} ) {
190 $form_params->{'topic'} = $self->{api_client}->to_form_value($args{'topic'});
191 }
192  
193 # form params
194 if ( exists $args{'region'} ) {
195 $form_params->{'region'} = $self->{api_client}->to_form_value($args{'region'});
196 }
197  
198 # form params
199 if ( exists $args{'secret_key'} ) {
200 $form_params->{'secret_key'} = $self->{api_client}->to_form_value($args{'secret_key'});
201 }
202  
203 # form params
204 if ( exists $args{'access_key'} ) {
205 $form_params->{'access_key'} = $self->{api_client}->to_form_value($args{'access_key'});
206 }
207  
208 # form params
209 if ( exists $args{'iam_role'} ) {
210 $form_params->{'iam_role'} = $self->{api_client}->to_form_value($args{'iam_role'});
211 }
212  
213 # form params
214 if ( exists $args{'format_version'} ) {
215 $form_params->{'format_version'} = $self->{api_client}->to_form_value($args{'format_version'});
216 }
217  
218 my $_body_data;
219 # authentication setting, if any
220 my $auth_settings = [qw(token )];
221  
222 # make the API Call
223 my $response = $self->{api_client}->call_api($_resource_path, $_method,
224 $query_params, $form_params,
225 $header_params, $_body_data, $auth_settings);
226 if (!$response) {
227 return;
228 }
229 my $_response_object = $self->{api_client}->deserialize('LoggingKinesisResponse', $response);
230 return $_response_object;
231 }
232  
233 #
234 # delete_log_kinesis
235 #
236 # Delete the Amazon Kinesis log endpoint
237 #
238 # @param string $service_id Alphanumeric string identifying the service. (required)
239 # @param int $version_id Integer identifying a service version. (required)
240 # @param string $logging_kinesis_name The name for the real-time logging configuration. (required)
241 {
242 my $params = {
243 'service_id' => {
244 data_type => 'string',
245 description => 'Alphanumeric string identifying the service.',
246 required => '1',
247 },
248 'version_id' => {
249 data_type => 'int',
250 description => 'Integer identifying a service version.',
251 required => '1',
252 },
253 'logging_kinesis_name' => {
254 data_type => 'string',
255 description => 'The name for the real-time logging configuration.',
256 required => '1',
257 },
258 };
259 __PACKAGE__->method_documentation->{ 'delete_log_kinesis' } = {
260 summary => 'Delete the Amazon Kinesis log endpoint',
261 params => $params,
262 returns => 'InlineResponse200',
263 };
264 }
265 # @return InlineResponse200
266 #
267 sub delete_log_kinesis {
268 my ($self, %args) = @_;
269  
270 # verify the required parameter 'service_id' is set
271 unless (exists $args{'service_id'}) {
272 croak("Missing the required parameter 'service_id' when calling delete_log_kinesis");
273 }
274  
275 # verify the required parameter 'version_id' is set
276 unless (exists $args{'version_id'}) {
277 croak("Missing the required parameter 'version_id' when calling delete_log_kinesis");
278 }
279  
280 # verify the required parameter 'logging_kinesis_name' is set
281 unless (exists $args{'logging_kinesis_name'}) {
282 croak("Missing the required parameter 'logging_kinesis_name' when calling delete_log_kinesis");
283 }
284  
285 # parse inputs
286 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/kinesis/{logging_kinesis_name}';
287  
288 my $_method = 'DELETE';
289 my $query_params = {};
290 my $header_params = {};
291 my $form_params = {};
292  
293 # 'Accept' and 'Content-Type' header
294 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
295 if ($_header_accept) {
296 $header_params->{'Accept'} = $_header_accept;
297 }
298 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
299  
300 # path params
301 if ( exists $args{'service_id'}) {
302 my $_base_variable = "{" . "service_id" . "}";
303 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
304 $_resource_path =~ s/$_base_variable/$_base_value/g;
305 }
306  
307 # path params
308 if ( exists $args{'version_id'}) {
309 my $_base_variable = "{" . "version_id" . "}";
310 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
311 $_resource_path =~ s/$_base_variable/$_base_value/g;
312 }
313  
314 # path params
315 if ( exists $args{'logging_kinesis_name'}) {
316 my $_base_variable = "{" . "logging_kinesis_name" . "}";
317 my $_base_value = $self->{api_client}->to_path_value($args{'logging_kinesis_name'});
318 $_resource_path =~ s/$_base_variable/$_base_value/g;
319 }
320  
321 my $_body_data;
322 # authentication setting, if any
323 my $auth_settings = [qw(token )];
324  
325 # make the API Call
326 my $response = $self->{api_client}->call_api($_resource_path, $_method,
327 $query_params, $form_params,
328 $header_params, $_body_data, $auth_settings);
329 if (!$response) {
330 return;
331 }
332 my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
333 return $_response_object;
334 }
335  
336 #
337 # get_log_kinesis
338 #
339 # Get an Amazon Kinesis log endpoint
340 #
341 # @param string $service_id Alphanumeric string identifying the service. (required)
342 # @param int $version_id Integer identifying a service version. (required)
343 # @param string $logging_kinesis_name The name for the real-time logging configuration. (required)
344 {
345 my $params = {
346 'service_id' => {
347 data_type => 'string',
348 description => 'Alphanumeric string identifying the service.',
349 required => '1',
350 },
351 'version_id' => {
352 data_type => 'int',
353 description => 'Integer identifying a service version.',
354 required => '1',
355 },
356 'logging_kinesis_name' => {
357 data_type => 'string',
358 description => 'The name for the real-time logging configuration.',
359 required => '1',
360 },
361 };
362 __PACKAGE__->method_documentation->{ 'get_log_kinesis' } = {
363 summary => 'Get an Amazon Kinesis log endpoint',
364 params => $params,
365 returns => 'LoggingKinesisResponse',
366 };
367 }
368 # @return LoggingKinesisResponse
369 #
370 sub get_log_kinesis {
371 my ($self, %args) = @_;
372  
373 # verify the required parameter 'service_id' is set
374 unless (exists $args{'service_id'}) {
375 croak("Missing the required parameter 'service_id' when calling get_log_kinesis");
376 }
377  
378 # verify the required parameter 'version_id' is set
379 unless (exists $args{'version_id'}) {
380 croak("Missing the required parameter 'version_id' when calling get_log_kinesis");
381 }
382  
383 # verify the required parameter 'logging_kinesis_name' is set
384 unless (exists $args{'logging_kinesis_name'}) {
385 croak("Missing the required parameter 'logging_kinesis_name' when calling get_log_kinesis");
386 }
387  
388 # parse inputs
389 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/kinesis/{logging_kinesis_name}';
390  
391 my $_method = 'GET';
392 my $query_params = {};
393 my $header_params = {};
394 my $form_params = {};
395  
396 # 'Accept' and 'Content-Type' header
397 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
398 if ($_header_accept) {
399 $header_params->{'Accept'} = $_header_accept;
400 }
401 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
402  
403 # path params
404 if ( exists $args{'service_id'}) {
405 my $_base_variable = "{" . "service_id" . "}";
406 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
407 $_resource_path =~ s/$_base_variable/$_base_value/g;
408 }
409  
410 # path params
411 if ( exists $args{'version_id'}) {
412 my $_base_variable = "{" . "version_id" . "}";
413 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
414 $_resource_path =~ s/$_base_variable/$_base_value/g;
415 }
416  
417 # path params
418 if ( exists $args{'logging_kinesis_name'}) {
419 my $_base_variable = "{" . "logging_kinesis_name" . "}";
420 my $_base_value = $self->{api_client}->to_path_value($args{'logging_kinesis_name'});
421 $_resource_path =~ s/$_base_variable/$_base_value/g;
422 }
423  
424 my $_body_data;
425 # authentication setting, if any
426 my $auth_settings = [qw(token )];
427  
428 # make the API Call
429 my $response = $self->{api_client}->call_api($_resource_path, $_method,
430 $query_params, $form_params,
431 $header_params, $_body_data, $auth_settings);
432 if (!$response) {
433 return;
434 }
435 my $_response_object = $self->{api_client}->deserialize('LoggingKinesisResponse', $response);
436 return $_response_object;
437 }
438  
439 #
440 # list_log_kinesis
441 #
442 # List Amazon Kinesis log endpoints
443 #
444 # @param string $service_id Alphanumeric string identifying the service. (required)
445 # @param int $version_id Integer identifying a service version. (required)
446 {
447 my $params = {
448 'service_id' => {
449 data_type => 'string',
450 description => 'Alphanumeric string identifying the service.',
451 required => '1',
452 },
453 'version_id' => {
454 data_type => 'int',
455 description => 'Integer identifying a service version.',
456 required => '1',
457 },
458 };
459 __PACKAGE__->method_documentation->{ 'list_log_kinesis' } = {
460 summary => 'List Amazon Kinesis log endpoints',
461 params => $params,
462 returns => 'ARRAY[LoggingKinesisResponse]',
463 };
464 }
465 # @return ARRAY[LoggingKinesisResponse]
466 #
467 sub list_log_kinesis {
468 my ($self, %args) = @_;
469  
470 # verify the required parameter 'service_id' is set
471 unless (exists $args{'service_id'}) {
472 croak("Missing the required parameter 'service_id' when calling list_log_kinesis");
473 }
474  
475 # verify the required parameter 'version_id' is set
476 unless (exists $args{'version_id'}) {
477 croak("Missing the required parameter 'version_id' when calling list_log_kinesis");
478 }
479  
480 # parse inputs
481 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/kinesis';
482  
483 my $_method = 'GET';
484 my $query_params = {};
485 my $header_params = {};
486 my $form_params = {};
487  
488 # 'Accept' and 'Content-Type' header
489 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
490 if ($_header_accept) {
491 $header_params->{'Accept'} = $_header_accept;
492 }
493 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
494  
495 # path params
496 if ( exists $args{'service_id'}) {
497 my $_base_variable = "{" . "service_id" . "}";
498 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
499 $_resource_path =~ s/$_base_variable/$_base_value/g;
500 }
501  
502 # path params
503 if ( exists $args{'version_id'}) {
504 my $_base_variable = "{" . "version_id" . "}";
505 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
506 $_resource_path =~ s/$_base_variable/$_base_value/g;
507 }
508  
509 my $_body_data;
510 # authentication setting, if any
511 my $auth_settings = [qw(token )];
512  
513 # make the API Call
514 my $response = $self->{api_client}->call_api($_resource_path, $_method,
515 $query_params, $form_params,
516 $header_params, $_body_data, $auth_settings);
517 if (!$response) {
518 return;
519 }
520 my $_response_object = $self->{api_client}->deserialize('ARRAY[LoggingKinesisResponse]', $response);
521 return $_response_object;
522 }
523  
524 #
525 # update_log_kinesis
526 #
527 # Update the Amazon Kinesis log endpoint
528 #
529 # @param string $service_id Alphanumeric string identifying the service. (required)
530 # @param int $version_id Integer identifying a service version. (required)
531 # @param string $logging_kinesis_name The name for the real-time logging configuration. (required)
532 {
533 my $params = {
534 'service_id' => {
535 data_type => 'string',
536 description => 'Alphanumeric string identifying the service.',
537 required => '1',
538 },
539 'version_id' => {
540 data_type => 'int',
541 description => 'Integer identifying a service version.',
542 required => '1',
543 },
544 'logging_kinesis_name' => {
545 data_type => 'string',
546 description => 'The name for the real-time logging configuration.',
547 required => '1',
548 },
549 };
550 __PACKAGE__->method_documentation->{ 'update_log_kinesis' } = {
551 summary => 'Update the Amazon Kinesis log endpoint',
552 params => $params,
553 returns => 'LoggingKinesisResponse',
554 };
555 }
556 # @return LoggingKinesisResponse
557 #
558 sub update_log_kinesis {
559 my ($self, %args) = @_;
560  
561 # verify the required parameter 'service_id' is set
562 unless (exists $args{'service_id'}) {
563 croak("Missing the required parameter 'service_id' when calling update_log_kinesis");
564 }
565  
566 # verify the required parameter 'version_id' is set
567 unless (exists $args{'version_id'}) {
568 croak("Missing the required parameter 'version_id' when calling update_log_kinesis");
569 }
570  
571 # verify the required parameter 'logging_kinesis_name' is set
572 unless (exists $args{'logging_kinesis_name'}) {
573 croak("Missing the required parameter 'logging_kinesis_name' when calling update_log_kinesis");
574 }
575  
576 # parse inputs
577 my $_resource_path = '/service/{service_id}/version/{version_id}/logging/kinesis/{logging_kinesis_name}';
578  
579 my $_method = 'PUT';
580 my $query_params = {};
581 my $header_params = {};
582 my $form_params = {};
583  
584 # 'Accept' and 'Content-Type' header
585 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
586 if ($_header_accept) {
587 $header_params->{'Accept'} = $_header_accept;
588 }
589 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded');
590  
591 # path params
592 if ( exists $args{'service_id'}) {
593 my $_base_variable = "{" . "service_id" . "}";
594 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
595 $_resource_path =~ s/$_base_variable/$_base_value/g;
596 }
597  
598 # path params
599 if ( exists $args{'version_id'}) {
600 my $_base_variable = "{" . "version_id" . "}";
601 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
602 $_resource_path =~ s/$_base_variable/$_base_value/g;
603 }
604  
605 # path params
606 if ( exists $args{'logging_kinesis_name'}) {
607 my $_base_variable = "{" . "logging_kinesis_name" . "}";
608 my $_base_value = $self->{api_client}->to_path_value($args{'logging_kinesis_name'});
609 $_resource_path =~ s/$_base_variable/$_base_value/g;
610 }
611  
612 my $_body_data;
613 # authentication setting, if any
614 my $auth_settings = [qw(token )];
615  
616 # make the API Call
617 my $response = $self->{api_client}->call_api($_resource_path, $_method,
618 $query_params, $form_params,
619 $header_params, $_body_data, $auth_settings);
620 if (!$response) {
621 return;
622 }
623 my $_response_object = $self->{api_client}->deserialize('LoggingKinesisResponse', $response);
624 return $_response_object;
625 }
626  
627 1;