Fastly/NgwafSimulateApi.pm untested

filter: Statementstmt 0.0% 0 / 66 Branchbran 0.0% 0 / 14 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 / 102 CC 8 SCAR 31.5
CC
8
Cov
0%
ngwaf_simulate_waf_request
56.0
new
6.0
BEGIN
2.0
CRAP 23.4
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::NgwafSimulateApi;
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 # ngwaf_simulate_waf_request
51 #
52 # Simulate a WAF request
53 #
54 # @param string $workspace_id The ID of the workspace. (required)
55 # @param WafSimulateRequest $waf_simulate_request (required)
56 {
57 my $params = {
58 'workspace_id' => {
59 data_type => 'string',
60 description => 'The ID of the workspace.',
61 required => '1',
62 },
63 'waf_simulate_request' => {
64 data_type => 'WafSimulateRequest',
65 description => '',
66 required => '1',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'ngwaf_simulate_waf_request' } = {
70 summary => 'Simulate a WAF request',
71 params => $params,
72 returns => 'WafSimulateResponse',
73 };
74 }
75 # @return WafSimulateResponse
76 #
77 sub ngwaf_simulate_waf_request {
78 my ($self, %args) = @_;
79  
80 # verify the required parameter 'workspace_id' is set
81 unless (exists $args{'workspace_id'}) {
82 croak("Missing the required parameter 'workspace_id' when calling ngwaf_simulate_waf_request");
83 }
84  
85 # verify the required parameter 'waf_simulate_request' is set
86 unless (exists $args{'waf_simulate_request'}) {
87 croak("Missing the required parameter 'waf_simulate_request' when calling ngwaf_simulate_waf_request");
88 }
89  
90 # parse inputs
91 my $_resource_path = '/ngwaf/v1/workspaces/{workspace_id}/simulate';
92  
93 my $_method = 'POST';
94 my $query_params = {};
95 my $header_params = {};
96 my $form_params = {};
97  
98 # 'Accept' and 'Content-Type' header
99 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
100 if ($_header_accept) {
101 $header_params->{'Accept'} = $_header_accept;
102 }
103 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
104  
105 # path params
106 if ( exists $args{'workspace_id'}) {
107 my $_base_variable = "{" . "workspace_id" . "}";
108 my $_base_value = $self->{api_client}->to_path_value($args{'workspace_id'});
109 $_resource_path =~ s/$_base_variable/$_base_value/g;
110 }
111  
112 my $_body_data;
113 # body params
114 if ( exists $args{'waf_simulate_request'}) {
115 $_body_data = $args{'waf_simulate_request'};
116 }
117  
118 # authentication setting, if any
119 my $auth_settings = [qw(token )];
120  
121 # make the API Call
122 my $response = $self->{api_client}->call_api($_resource_path, $_method,
123 $query_params, $form_params,
124 $header_params, $_body_data, $auth_settings);
125 if (!$response) {
126 return;
127 }
128 my $_response_object = $self->{api_client}->deserialize('WafSimulateResponse', $response);
129 return $_response_object;
130 }
131  
132 1;