@@ 18-81 (lines=64) @@ | ||
15 | * |
|
16 | * @version 1 |
|
17 | */ |
|
18 | class Groups extends Api |
|
19 | { |
|
20 | /** |
|
21 | * List rule groups (permission needed: #zone:read) |
|
22 | * Search, list, and sort rule groups contained within a package |
|
23 | * |
|
24 | * @param string $zone_identifier |
|
25 | * @param string $package_identifier |
|
26 | * @param string|null $name Name of the firewall rule group |
|
27 | * @param string|null $mode Whether or not the rules contained within this group are configurable/usable |
|
28 | * @param int|null $rules_count How many rules are contained within this group |
|
29 | * @param int|null $page Page number of paginated results |
|
30 | * @param int|null $per_page Number of groups per page |
|
31 | * @param string|null $order Field to order groups by |
|
32 | * @param string|null $direction Direction to order groups |
|
33 | * @param string|null $match Whether to match all search requirements or at least one (any) |
|
34 | */ |
|
35 | public function groups($zone_identifier, $package_identifier, $name = null, $mode = null, $rules_count = null, $page = null, $per_page = null, $order = null, $direction = null, $match = null) |
|
36 | { |
|
37 | $data = [ |
|
38 | 'name' => $name, |
|
39 | 'mode' => $mode, |
|
40 | 'rules_count' => $rules_count, |
|
41 | 'page' => $page, |
|
42 | 'per_page' => $per_page, |
|
43 | 'order' => $order, |
|
44 | 'direction' => $direction, |
|
45 | 'match' => $match, |
|
46 | ]; |
|
47 | ||
48 | return $this->get('/zones/'.$zone_identifier.'/firewall/waf/packages/'.$package_identifier.'/groups', $data); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Rule group info (permission needed: #zone:read) |
|
53 | * Get a single rule group |
|
54 | * |
|
55 | * @param string $zone_identifier |
|
56 | * @param string $package_identifier |
|
57 | * @param string $identifier |
|
58 | */ |
|
59 | public function info($zone_identifier, $package_identifier, $identifier) |
|
60 | { |
|
61 | return $this->get('/zones/'.$zone_identifier.'/firewall/waf/packages/'.$package_identifier.'/groups/'.$identifier); |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * Update Rule group (permission needed: #zone:edit) |
|
66 | * Update the state of a rule group |
|
67 | * |
|
68 | * @param string $zone_identifier |
|
69 | * @param string $package_identifier |
|
70 | * @param string $identifier |
|
71 | * @param string|null $mode Whether or not the rules contained within this group are configurable/usable |
|
72 | */ |
|
73 | public function update($zone_identifier, $package_identifier, $identifier, $mode = null) |
|
74 | { |
|
75 | $data = [ |
|
76 | 'mode' => $mode, |
|
77 | ]; |
|
78 | ||
79 | return $this->patch('/zones/'.$zone_identifier.'/firewall/waf/packages/'.$package_identifier.'/groups/'.$identifier, $data); |
|
80 | } |
|
81 | } |
|
82 |
@@ 18-83 (lines=66) @@ | ||
15 | * |
|
16 | * @version 1 |
|
17 | */ |
|
18 | class Rules extends Api |
|
19 | { |
|
20 | /** |
|
21 | * List rule (permission needed: #zone:read) |
|
22 | * Search, list, and filter rules within a package |
|
23 | * |
|
24 | * @param string $zone_id |
|
25 | * @param string $package_id |
|
26 | * @param string|null $description Public description of the rule |
|
27 | * @param object|null $mode The rule mode |
|
28 | * @param int|null $priority The order in which the individual rule is executed within the related group |
|
29 | * @param string|null $group_id WAF group identifier tag |
|
30 | * @param int|null $page Page number of paginated results |
|
31 | * @param int|null $per_page Number of rules per page |
|
32 | * @param string|null $order Field to order rules by |
|
33 | * @param string|null $direction Direction to order rules |
|
34 | * @param string|null $match Whether to match all search requirements or at least one (any) |
|
35 | */ |
|
36 | public function rules($zone_id, $package_id, $description = null, $mode = null, $priority = null, $group_id = null, $page = null, $per_page = null, $order = null, $direction = null, $match = null) |
|
37 | { |
|
38 | $data = [ |
|
39 | 'description' => $description, |
|
40 | 'mode' => $mode, |
|
41 | 'priority' => $priority, |
|
42 | 'group_id' => $group_id, |
|
43 | 'page' => $page, |
|
44 | 'per_page' => $per_page, |
|
45 | 'order' => $order, |
|
46 | 'direction' => $direction, |
|
47 | 'match' => $match, |
|
48 | ]; |
|
49 | ||
50 | return $this->get('/zones/'.$zone_id.'/firewall/waf/packages/'.$package_id.'/rules', $data); |
|
51 | } |
|
52 | ||
53 | /** |
|
54 | * Rule info (permission needed: #zone:read) |
|
55 | * Individual information about a rule |
|
56 | * |
|
57 | * @param string $zone_id |
|
58 | * @param string $package_id |
|
59 | * @param string $identifier |
|
60 | */ |
|
61 | public function info($zone_id, $package_id, $identifier) |
|
62 | { |
|
63 | return $this->get('/zones/'.$zone_id.'/firewall/waf/packages/'.$package_id.'/rules/'.$identifier); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * Update Rule group (permission needed: #zone:edit) |
|
68 | * Update the state of a rule group |
|
69 | * |
|
70 | * @param string $zone_id |
|
71 | * @param string $package_id |
|
72 | * @param string $identifier |
|
73 | * @param string|null $mode The mode to use when the rule is triggered. Value is restricted based on the allowed_modes of the rule |
|
74 | */ |
|
75 | public function update($zone_id, $package_id, $identifier, $mode = null) |
|
76 | { |
|
77 | $data = [ |
|
78 | 'mode' => $mode, |
|
79 | ]; |
|
80 | ||
81 | return $this->patch('/zones/'.$zone_id.'/firewall/waf/packages/'.$package_id.'/rules/'.$identifier, $data); |
|
82 | } |
|
83 | } |
|
84 |