Fastly/RealtimeApi.pm untested

filter: Statementstmt 0.0% 0 / 130 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 / 190 CC 18 SCAR 34.7
CC
18
Cov
0%
get_stats_last120_seconds_limit_entries
56.0
get_stats_last_second
56.0
get_stats_last120_seconds
30.0
CRAP 32.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::RealtimeApi;
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_stats_last120_seconds
51 #
52 # Get real-time data for the last 120 seconds
53 #
54 # @param string $service_id Alphanumeric string identifying the service. (required)
55 {
56 my $params = {
57 'service_id' => {
58 data_type => 'string',
59 description => 'Alphanumeric string identifying the service.',
60 required => '1',
61 },
62 };
63 __PACKAGE__->method_documentation->{ 'get_stats_last120_seconds' } = {
64 summary => 'Get real-time data for the last 120 seconds',
65 params => $params,
66 returns => 'Realtime',
67 };
68 }
69 # @return Realtime
70 #
71 sub get_stats_last120_seconds {
72 my ($self, %args) = @_;
73  
74 # verify the required parameter 'service_id' is set
75 unless (exists $args{'service_id'}) {
76 croak("Missing the required parameter 'service_id' when calling get_stats_last120_seconds");
77 }
78  
79 # parse inputs
80 my $_resource_path = '/v1/channel/{service_id}/ts/h';
81  
82 my $_method = 'GET';
83 my $query_params = {};
84 my $header_params = {};
85 my $form_params = {};
86  
87 # 'Accept' and 'Content-Type' header
88 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
89 if ($_header_accept) {
90 $header_params->{'Accept'} = $_header_accept;
91 }
92 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
93  
94 # path params
95 if ( exists $args{'service_id'}) {
96 my $_base_variable = "{" . "service_id" . "}";
97 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
98 $_resource_path =~ s/$_base_variable/$_base_value/g;
99 }
100  
101 my $_body_data;
102 # authentication setting, if any
103 my $auth_settings = [qw(token )];
104  
105 # make the API Call
106 my $response = $self->{api_client}->call_api($_resource_path, $_method,
107 $query_params, $form_params,
108 $header_params, $_body_data, $auth_settings);
109 if (!$response) {
110 return;
111 }
112 my $_response_object = $self->{api_client}->deserialize('Realtime', $response);
113 return $_response_object;
114 }
115  
116 #
117 # get_stats_last120_seconds_limit_entries
118 #
119 # Get a limited number of real-time data entries
120 #
121 # @param string $service_id Alphanumeric string identifying the service. (required)
122 # @param int $max_entries Maximum number of results to show. (required)
123 {
124 my $params = {
125 'service_id' => {
126 data_type => 'string',
127 description => 'Alphanumeric string identifying the service.',
128 required => '1',
129 },
130 'max_entries' => {
131 data_type => 'int',
132 description => 'Maximum number of results to show.',
133 required => '1',
134 },
135 };
136 __PACKAGE__->method_documentation->{ 'get_stats_last120_seconds_limit_entries' } = {
137 summary => 'Get a limited number of real-time data entries',
138 params => $params,
139 returns => 'Realtime',
140 };
141 }
142 # @return Realtime
143 #
144 sub get_stats_last120_seconds_limit_entries {
145 my ($self, %args) = @_;
146  
147 # verify the required parameter 'service_id' is set
148 unless (exists $args{'service_id'}) {
149 croak("Missing the required parameter 'service_id' when calling get_stats_last120_seconds_limit_entries");
150 }
151  
152 # verify the required parameter 'max_entries' is set
153 unless (exists $args{'max_entries'}) {
154 croak("Missing the required parameter 'max_entries' when calling get_stats_last120_seconds_limit_entries");
155 }
156  
157 # parse inputs
158 my $_resource_path = '/v1/channel/{service_id}/ts/h/limit/{max_entries}';
159  
160 my $_method = 'GET';
161 my $query_params = {};
162 my $header_params = {};
163 my $form_params = {};
164  
165 # 'Accept' and 'Content-Type' header
166 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
167 if ($_header_accept) {
168 $header_params->{'Accept'} = $_header_accept;
169 }
170 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
171  
172 # path params
173 if ( exists $args{'service_id'}) {
174 my $_base_variable = "{" . "service_id" . "}";
175 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
176 $_resource_path =~ s/$_base_variable/$_base_value/g;
177 }
178  
179 # path params
180 if ( exists $args{'max_entries'}) {
181 my $_base_variable = "{" . "max_entries" . "}";
182 my $_base_value = $self->{api_client}->to_path_value($args{'max_entries'});
183 $_resource_path =~ s/$_base_variable/$_base_value/g;
184 }
185  
186 my $_body_data;
187 # authentication setting, if any
188 my $auth_settings = [qw(token )];
189  
190 # make the API Call
191 my $response = $self->{api_client}->call_api($_resource_path, $_method,
192 $query_params, $form_params,
193 $header_params, $_body_data, $auth_settings);
194 if (!$response) {
195 return;
196 }
197 my $_response_object = $self->{api_client}->deserialize('Realtime', $response);
198 return $_response_object;
199 }
200  
201 #
202 # get_stats_last_second
203 #
204 # Get real-time data from specified time
205 #
206 # @param string $service_id Alphanumeric string identifying the service. (required)
207 # @param int $timestamp_in_seconds Timestamp in seconds (Unix epoch time). (required)
208 {
209 my $params = {
210 'service_id' => {
211 data_type => 'string',
212 description => 'Alphanumeric string identifying the service.',
213 required => '1',
214 },
215 'timestamp_in_seconds' => {
216 data_type => 'int',
217 description => 'Timestamp in seconds (Unix epoch time).',
218 required => '1',
219 },
220 };
221 __PACKAGE__->method_documentation->{ 'get_stats_last_second' } = {
222 summary => 'Get real-time data from specified time',
223 params => $params,
224 returns => 'Realtime',
225 };
226 }
227 # @return Realtime
228 #
229 sub get_stats_last_second {
230 my ($self, %args) = @_;
231  
232 # verify the required parameter 'service_id' is set
233 unless (exists $args{'service_id'}) {
234 croak("Missing the required parameter 'service_id' when calling get_stats_last_second");
235 }
236  
237 # verify the required parameter 'timestamp_in_seconds' is set
238 unless (exists $args{'timestamp_in_seconds'}) {
239 croak("Missing the required parameter 'timestamp_in_seconds' when calling get_stats_last_second");
240 }
241  
242 # parse inputs
243 my $_resource_path = '/v1/channel/{service_id}/ts/{timestamp_in_seconds}';
244  
245 my $_method = 'GET';
246 my $query_params = {};
247 my $header_params = {};
248 my $form_params = {};
249  
250 # 'Accept' and 'Content-Type' header
251 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
252 if ($_header_accept) {
253 $header_params->{'Accept'} = $_header_accept;
254 }
255 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
256  
257 # path params
258 if ( exists $args{'service_id'}) {
259 my $_base_variable = "{" . "service_id" . "}";
260 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
261 $_resource_path =~ s/$_base_variable/$_base_value/g;
262 }
263  
264 # path params
265 if ( exists $args{'timestamp_in_seconds'}) {
266 my $_base_variable = "{" . "timestamp_in_seconds" . "}";
267 my $_base_value = $self->{api_client}->to_path_value($args{'timestamp_in_seconds'});
268 $_resource_path =~ s/$_base_variable/$_base_value/g;
269 }
270  
271 my $_body_data;
272 # authentication setting, if any
273 my $auth_settings = [qw(token )];
274  
275 # make the API Call
276 my $response = $self->{api_client}->call_api($_resource_path, $_method,
277 $query_params, $form_params,
278 $header_params, $_body_data, $auth_settings);
279 if (!$response) {
280 return;
281 }
282 my $_response_object = $self->{api_client}->deserialize('Realtime', $response);
283 return $_response_object;
284 }
285  
286 1;