Fastly/WholePlatformDdosHistoricalApi.pm untested

filter: Statementstmt 0.0% 0 / 62 Branchbran 0.0% 0 / 12 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 / 96 CC 7 SCAR 28.1
CC
7
Cov
0%
get_platform_ddos_historical
42.0
new
6.0
BEGIN
2.0
CRAP 16.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::WholePlatformDdosHistoricalApi;
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_platform_ddos_historical
51 #
52 # Get historical DDoS metrics for the entire Fastly platform
53 #
54 # @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)
55 # @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)
56 # @param string $downsample Duration of sample windows. (optional, default to 'hour')
57 {
58 my $params = {
59 'start' => {
60 data_type => 'string',
61 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.',
62 required => '0',
63 },
64 'end' => {
65 data_type => 'string',
66 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.',
67 required => '0',
68 },
69 'downsample' => {
70 data_type => 'string',
71 description => 'Duration of sample windows.',
72 required => '0',
73 },
74 };
75 __PACKAGE__->method_documentation->{ 'get_platform_ddos_historical' } = {
76 summary => 'Get historical DDoS metrics for the entire Fastly platform',
77 params => $params,
78 returns => 'PlatformDdosResponse',
79 };
80 }
81 # @return PlatformDdosResponse
82 #
83 sub get_platform_ddos_historical {
84 my ($self, %args) = @_;
85  
86 # parse inputs
87 my $_resource_path = '/metrics/platform/ddos';
88  
89 my $_method = 'GET';
90 my $query_params = {};
91 my $header_params = {};
92 my $form_params = {};
93  
94 # 'Accept' and 'Content-Type' header
95 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
96 if ($_header_accept) {
97 $header_params->{'Accept'} = $_header_accept;
98 }
99 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
100  
101 # query params
102 if ( exists $args{'start'}) {
103 $query_params->{'start'} = $self->{api_client}->to_query_value($args{'start'});
104 }
105  
106 # query params
107 if ( exists $args{'end'}) {
108 $query_params->{'end'} = $self->{api_client}->to_query_value($args{'end'});
109 }
110  
111 # query params
112 if ( exists $args{'downsample'}) {
113 $query_params->{'downsample'} = $self->{api_client}->to_query_value($args{'downsample'});
114 }
115  
116 my $_body_data;
117 # authentication setting, if any
118 my $auth_settings = [qw(token )];
119  
120 # make the API Call
121 my $response = $self->{api_client}->call_api($_resource_path, $_method,
122 $query_params, $form_params,
123 $header_params, $_body_data, $auth_settings);
124 if (!$response) {
125 return;
126 }
127 my $_response_object = $self->{api_client}->deserialize('PlatformDdosResponse', $response);
128 return $_response_object;
129 }
130  
131 1;