File tree Expand file tree Collapse file tree
pfSense-pkg-API/files/etc/inc/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ class APIFirewallTrafficShaper extends APIEndpoint {
2020 $ this ->url = "/api/v1/firewall/traffic_shaper " ;
2121 }
2222
23+ protected function get () {
24+ return (new APIFirewallTrafficShaperRead ())->call ();
25+ }
26+
2327 protected function post () {
2428 return (new APIFirewallTrafficShaperCreate ())->call ();
2529 }
Original file line number Diff line number Diff line change 1+ <?php
2+ // Copyright 2021 Jared Hendrickson
3+ //
4+ // Licensed under the Apache License, Version 2.0 (the "License");
5+ // you may not use this file except in compliance with the License.
6+ // You may obtain a copy of the License at
7+ //
8+ // http://www.apache.org/licenses/LICENSE-2.0
9+ //
10+ // Unless required by applicable law or agreed to in writing, software
11+ // distributed under the License is distributed on an "AS IS" BASIS,
12+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ // See the License for the specific language governing permissions and
14+ // limitations under the License.
15+
16+ require_once ("api/framework/APIModel.inc " );
17+ require_once ("api/framework/APIResponse.inc " );
18+
19+
20+ class APIFirewallTrafficShaperRead extends APIModel {
21+ # Create our method constructor
22+ public function __construct () {
23+ parent ::__construct ();
24+ $ this ->privileges = ["page-all " , "page-firewall-trafficshaper " ];
25+ }
26+
27+ public function action () {
28+ # Check that we have a configuration
29+ if (!empty ($ this ->config ["shaper " ]["queue " ])) {
30+ $ shaper_array = $ this ->config ["shaper " ]["queue " ];
31+ } else {
32+ $ shaper_array = [];
33+ }
34+ return APIResponse \get (0 , $ shaper_array );
35+ }
36+ }
Original file line number Diff line number Diff line change 1616
1717class APIUnitTestFirewallRule (unit_test_framework .APIUnitTest ):
1818 url = "/api/v1/firewall/traffic_shaper"
19+ get_tests = [{"name" : "Read all traffic shapers" }]
1920 post_tests = [
2021 {
2122 "name" : "Create a traffic shaper" ,
You can’t perform that action at this time.
0 commit comments