Fastly/NgwafReportsApi.pm untested

filter: Statementstmt 0.0% 0 / 92 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 140 CC 13 SCAR 33.4
CC
13
Cov
0%
get_signals_report
56.0
get_attacks_report
42.0
new
6.0
CRAP 28.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::NgwafReportsApi;
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_attacks_report
51 #
52 # Get attacks report
53 #
54 # @param DateTime $from The start of a time range in RFC 3339 format. (required)
55 # @param DateTime $to The end of a time range in RFC 3339 format. Defaults to the current time. (optional)
56 {
57 my $params = {
58 'from' => {
59 data_type => 'DateTime',
60 description => 'The start of a time range in RFC 3339 format.',
61 required => '1',
62 },
63 'to' => {
64 data_type => 'DateTime',
65 description => 'The end of a time range in RFC 3339 format. Defaults to the current time.',
66 required => '0',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'get_attacks_report' } = {
70 summary => 'Get attacks report',
71 params => $params,
72 returns => 'ListAttackReport',
73 };
74 }
75 # @return ListAttackReport
76 #
77 sub get_attacks_report {
78 my ($self, %args) = @_;
79  
80 # verify the required parameter 'from' is set
81 unless (exists $args{'from'}) {
82 croak("Missing the required parameter 'from' when calling get_attacks_report");
83 }
84  
85 # parse inputs
86 my $_resource_path = '/ngwaf/v1/reports/attacks';
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/json', 'application/problem+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{'from'}) {
102 $query_params->{'from'} = $self->{api_client}->to_query_value($args{'from'});
103 }
104  
105 # query params
106 if ( exists $args{'to'}) {
107 $query_params->{'to'} = $self->{api_client}->to_query_value($args{'to'});
108 }
109  
110 my $_body_data;
111 # authentication setting, if any
112 my $auth_settings = [qw(token )];
113  
114 # make the API Call
115 my $response = $self->{api_client}->call_api($_resource_path, $_method,
116 $query_params, $form_params,
117 $header_params, $_body_data, $auth_settings);
118 if (!$response) {
119 return;
120 }
121 my $_response_object = $self->{api_client}->deserialize('ListAttackReport', $response);
122 return $_response_object;
123 }
124  
125 #
126 # get_signals_report
127 #
128 # Get signals report
129 #
130 # @param DateTime $from The start of a time range in RFC 3339 format. (required)
131 # @param DateTime $to The end of a time range in RFC 3339 format. Defaults to the current time. (optional)
132 # @param string $signal_type The type of signal (optional)
133 {
134 my $params = {
135 'from' => {
136 data_type => 'DateTime',
137 description => 'The start of a time range in RFC 3339 format.',
138 required => '1',
139 },
140 'to' => {
141 data_type => 'DateTime',
142 description => 'The end of a time range in RFC 3339 format. Defaults to the current time.',
143 required => '0',
144 },
145 'signal_type' => {
146 data_type => 'string',
147 description => 'The type of signal',
148 required => '0',
149 },
150 };
151 __PACKAGE__->method_documentation->{ 'get_signals_report' } = {
152 summary => 'Get signals report',
153 params => $params,
154 returns => 'ListSignalReport',
155 };
156 }
157 # @return ListSignalReport
158 #
159 sub get_signals_report {
160 my ($self, %args) = @_;
161  
162 # verify the required parameter 'from' is set
163 unless (exists $args{'from'}) {
164 croak("Missing the required parameter 'from' when calling get_signals_report");
165 }
166  
167 # parse inputs
168 my $_resource_path = '/ngwaf/v1/reports/signals';
169  
170 my $_method = 'GET';
171 my $query_params = {};
172 my $header_params = {};
173 my $form_params = {};
174  
175 # 'Accept' and 'Content-Type' header
176 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
177 if ($_header_accept) {
178 $header_params->{'Accept'} = $_header_accept;
179 }
180 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
181  
182 # query params
183 if ( exists $args{'from'}) {
184 $query_params->{'from'} = $self->{api_client}->to_query_value($args{'from'});
185 }
186  
187 # query params
188 if ( exists $args{'to'}) {
189 $query_params->{'to'} = $self->{api_client}->to_query_value($args{'to'});
190 }
191  
192 # query params
193 if ( exists $args{'signal_type'}) {
194 $query_params->{'signal_type'} = $self->{api_client}->to_query_value($args{'signal_type'});
195 }
196  
197 my $_body_data;
198 # authentication setting, if any
199 my $auth_settings = [qw(token )];
200  
201 # make the API Call
202 my $response = $self->{api_client}->call_api($_resource_path, $_method,
203 $query_params, $form_params,
204 $header_params, $_body_data, $auth_settings);
205 if (!$response) {
206 return;
207 }
208 my $_response_object = $self->{api_client}->deserialize('ListSignalReport', $response);
209 return $_response_object;
210 }
211  
212 1;