Fastly/DomainInspectorHistoricalApi.pm untested

filter: Statementstmt 0.0% 0 / 82 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 134 CC 16 SCAR 49.4
CC
16
Cov
0%
get_domain_inspector_historical
240.0
new
6.0
BEGIN
2.0
CRAP 139.6
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::DomainInspectorHistoricalApi;
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_domain_inspector_historical
51 #
52 # Get historical domain data for a service
53 #
54 # @param string $service_id Alphanumeric string identifying the service. (required)
55 # @param string $start A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the inclusive start of the query time range. If not provided, a default is chosen based on the provided `downsample` value. (optional)
56 # @param string $end A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the exclusive end of the query time range. If not provided, a default is chosen based on the provided `downsample` value. (optional)
57 # @param string $downsample Duration of sample windows. (optional, default to 'hour')
58 # @param string $metric The metrics to retrieve. Multiple values should be comma-separated. (optional, default to 'edge_requests')
59 # @param string $group_by Dimensions to return in the query. Multiple dimensions may be separated by commas. For example, `group_by=domain` will return one timeseries for every domain, as a total across all datacenters (POPs). (optional)
60 # @param string $limit Number of results per page. The maximum is 200. (optional, default to '100')
61 # @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)
62 # @param string $region Limit query to one or more specific geographic regions. Values should be comma-separated. (optional)
63 # @param string $datacenter Limit query to one or more specific POPs. Values should be comma-separated. (optional)
64 # @param string $domain Limit query to one or more specific domains. Values should be comma-separated. (optional)
65 {
66 my $params = {
67 'service_id' => {
68 data_type => 'string',
69 description => 'Alphanumeric string identifying the service.',
70 required => '1',
71 },
72 'start' => {
73 data_type => 'string',
74 description => 'A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the inclusive start of the query time range. If not provided, a default is chosen based on the provided `downsample` value.',
75 required => '0',
76 },
77 'end' => {
78 data_type => 'string',
79 description => 'A valid ISO-8601-formatted date and time, or UNIX timestamp, indicating the exclusive end of the query time range. If not provided, a default is chosen based on the provided `downsample` value.',
80 required => '0',
81 },
82 'downsample' => {
83 data_type => 'string',
84 description => 'Duration of sample windows.',
85 required => '0',
86 },
87 'metric' => {
88 data_type => 'string',
89 description => 'The metrics to retrieve. Multiple values should be comma-separated.',
90 required => '0',
91 },
92 'group_by' => {
93 data_type => 'string',
94 description => 'Dimensions to return in the query. Multiple dimensions may be separated by commas. For example, `group_by=domain` will return one timeseries for every domain, as a total across all datacenters (POPs). ',
95 required => '0',
96 },
97 'limit' => {
98 data_type => 'string',
99 description => 'Number of results per page. The maximum is 200.',
100 required => '0',
101 },
102 'cursor' => {
103 data_type => 'string',
104 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.',
105 required => '0',
106 },
107 'region' => {
108 data_type => 'string',
109 description => 'Limit query to one or more specific geographic regions. Values should be comma-separated. ',
110 required => '0',
111 },
112 'datacenter' => {
113 data_type => 'string',
114 description => 'Limit query to one or more specific POPs. Values should be comma-separated.',
115 required => '0',
116 },
117 'domain' => {
118 data_type => 'string',
119 description => 'Limit query to one or more specific domains. Values should be comma-separated.',
120 required => '0',
121 },
122 };
123 __PACKAGE__->method_documentation->{ 'get_domain_inspector_historical' } = {
124 summary => 'Get historical domain data for a service',
125 params => $params,
126 returns => 'HistoricalDomainsResponse',
127 };
128 }
129 # @return HistoricalDomainsResponse
130 #
131 sub get_domain_inspector_historical {
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 get_domain_inspector_historical");
137 }
138  
139 # parse inputs
140 my $_resource_path = '/metrics/domains/services/{service_id}';
141  
142 my $_method = 'GET';
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('application/json');
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 # query params
155 if ( exists $args{'start'}) {
156 $query_params->{'start'} = $self->{api_client}->to_query_value($args{'start'});
157 }
158  
159 # query params
160 if ( exists $args{'end'}) {
161 $query_params->{'end'} = $self->{api_client}->to_query_value($args{'end'});
162 }
163  
164 # query params
165 if ( exists $args{'downsample'}) {
166 $query_params->{'downsample'} = $self->{api_client}->to_query_value($args{'downsample'});
167 }
168  
169 # query params
170 if ( exists $args{'metric'}) {
171 $query_params->{'metric'} = $self->{api_client}->to_query_value($args{'metric'});
172 }
173  
174 # query params
175 if ( exists $args{'group_by'}) {
176 $query_params->{'group_by'} = $self->{api_client}->to_query_value($args{'group_by'});
177 }
178  
179 # query params
180 if ( exists $args{'limit'}) {
181 $query_params->{'limit'} = $self->{api_client}->to_query_value($args{'limit'});
182 }
183  
184 # query params
185 if ( exists $args{'cursor'}) {
186 $query_params->{'cursor'} = $self->{api_client}->to_query_value($args{'cursor'});
187 }
188  
189 # query params
190 if ( exists $args{'region'}) {
191 $query_params->{'region'} = $self->{api_client}->to_query_value($args{'region'});
192 }
193  
194 # query params
195 if ( exists $args{'datacenter'}) {
196 $query_params->{'datacenter'} = $self->{api_client}->to_query_value($args{'datacenter'});
197 }
198  
199 # query params
200 if ( exists $args{'domain'}) {
201 $query_params->{'domain'} = $self->{api_client}->to_query_value($args{'domain'});
202 }
203  
204 # path params
205 if ( exists $args{'service_id'}) {
206 my $_base_variable = "{" . "service_id" . "}";
207 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
208 $_resource_path =~ s/$_base_variable/$_base_value/g;
209 }
210  
211 my $_body_data;
212 # authentication setting, if any
213 my $auth_settings = [qw(token )];
214  
215 # make the API Call
216 my $response = $self->{api_client}->call_api($_resource_path, $_method,
217 $query_params, $form_params,
218 $header_params, $_body_data, $auth_settings);
219 if (!$response) {
220 return;
221 }
222 my $_response_object = $self->{api_client}->deserialize('HistoricalDomainsResponse', $response);
223 return $_response_object;
224 }
225  
226 1;