Class: CloudflareClient::Zone::Firewall::WAFPackage
- Inherits:
-
CloudflareClient::Zone::Firewall
- Object
- CloudflareClient
- CloudflareClient::Zone
- Base
- CloudflareClient::Zone::Firewall
- CloudflareClient::Zone::Firewall::WAFPackage
- Defined in:
- lib/cloudflare_client/zone/firewall/waf_package.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Base, Rule, RuleGroup
Constant Summary collapse
- VALID_ORDERS =
%w[status name].freeze
- VALID_SENSITIVITIES =
%w[high low off].freeze
- VALID_ACTION_MODES =
%w[simulate block challenge].freeze
Constants inherited from CloudflareClient::Zone
Constants inherited from CloudflareClient
API_BASE, POSSIBLE_API_SETTINGS, VALID_BUNDLE_METHODS, VALID_DIRECTIONS, VALID_MATCHES, VERSION
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#list(name: nil, page: 1, per_page: 50, order: 'status', direction: 'desc', match: 'all') ⇒ Object
lists waf_rule_packages.
-
#show(id:) ⇒ Object
shows details of a single package.
-
#update(id:, sensitivity: 'high', action_mode: 'challange') ⇒ Object
changes the sensitivity and action for an anomaly detection type WAF rule package.
Methods inherited from Base
Methods inherited from CloudflareClient::Zone
#create_zone, #delete_zone, #edit_zone, #purge_zone_cache, #update_zone_settings, #zone, #zone_activation_check, #zone_setting, #zone_settings, #zones
Methods inherited from CloudflareClient
Constructor Details
This class inherits a constructor from CloudflareClient::Zone::Base
Instance Method Details
#list(name: nil, page: 1, per_page: 50, order: 'status', direction: 'desc', match: 'all') ⇒ Object
lists waf_rule_packages
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cloudflare_client/zone/firewall/waf_package.rb', line 11 def list(name: nil, page: 1, per_page: 50, order: 'status', direction: 'desc', match: 'all') params = {page: page, per_page: per_page} params[:name] = name unless name.nil? valid_value_check(:order, order, VALID_ORDERS) params[:order] = order valid_value_check(:direction, direction, VALID_DIRECTIONS) params[:direction] = direction valid_value_check(:match, match, VALID_MATCHES) params[:match] = match cf_get(path: "/zones/#{zone_id}/firewall/waf/packages", params: params) end |
#show(id:) ⇒ Object
shows details of a single package
29 30 31 32 33 |
# File 'lib/cloudflare_client/zone/firewall/waf_package.rb', line 29 def show(id:) id_check('id', id) cf_get(path: "/zones/#{zone_id}/firewall/waf/packages/#{id}") end |
#update(id:, sensitivity: 'high', action_mode: 'challange') ⇒ Object
changes the sensitivity and action for an anomaly detection type WAF rule package
37 38 39 40 41 42 43 44 45 |
# File 'lib/cloudflare_client/zone/firewall/waf_package.rb', line 37 def update(id:, sensitivity: 'high', action_mode: 'challange') id_check('id', id) valid_value_check(:sensitivity, sensitivity, VALID_SENSITIVITIES) valid_value_check(:action_mode, action_mode, VALID_ACTION_MODES) data = {sensitivity: sensitivity, action_mode: action_mode} cf_patch(path: "/zones/#{zone_id}/firewall/waf/packages/#{id}", data: data) end |