Class: CloudflareClient::Zone::Firewall::WAFPackage::Rule
- Inherits:
-
Base
- Object
- CloudflareClient
- CloudflareClient::Zone
- Base
- CloudflareClient::Zone::Firewall
- CloudflareClient::Zone::Firewall::WAFPackage
- Base
- CloudflareClient::Zone::Firewall::WAFPackage::Rule
- Defined in:
- lib/cloudflare_client/zone/firewall/waf_package/rule.rb
Constant Summary collapse
- VALID_ORDERS =
%w[priority group_id description].freeze
- VALID_MODES =
%w[default disable simulate block challenge on off].freeze
Constants inherited from CloudflareClient::Zone::Firewall::WAFPackage
VALID_ACTION_MODES, VALID_SENSITIVITIES
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
Attributes inherited from Base
Instance Method Summary collapse
-
#list(mode: {}, priority: nil, match: 'all', order: 'priority', page: 1, per_page: 50, group_id: nil, description: nil, direction: 'desc') ⇒ Object
list waf rules.
-
#show(id:) ⇒ Object
get a single waf rule.
-
#update(id:, mode: 'on') ⇒ Object
update a waf rule.
Methods inherited from Base
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::Firewall::WAFPackage::Base
Instance Method Details
#list(mode: {}, priority: nil, match: 'all', order: 'priority', page: 1, per_page: 50, group_id: nil, description: nil, direction: 'desc') ⇒ Object
list waf rules
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cloudflare_client/zone/firewall/waf_package/rule.rb', line 10 def list(mode: {}, priority: nil, match: 'all', order: 'priority', page: 1, per_page: 50, group_id: nil, description: nil, direction: 'desc') #FIXME: mode isn't documented in api, ask CF #FIXME: priority is read only?, ask CF params = {page: page, per_page: per_page} valid_value_check(:match, match, VALID_MATCHES) params[:match] = match valid_value_check(:order, order, VALID_ORDERS) params[:order] = order valid_value_check(:direction, direction, VALID_DIRECTIONS) params[:direction] = direction params[:group_id] unless group_id.nil? params[:description] unless description.nil? cf_get(path: "/zones/#{zone_id}/firewall/waf/packages/#{package_id}/rules", params: params) end |
#show(id:) ⇒ Object
get a single waf rule
32 33 34 35 36 |
# File 'lib/cloudflare_client/zone/firewall/waf_package/rule.rb', line 32 def show(id:) id_check('id', id) cf_get(path: "/zones/#{zone_id}/firewall/waf/packages/#{package_id}/rules/#{id}") end |
#update(id:, mode: 'on') ⇒ Object
update a waf rule
40 41 42 43 44 45 |
# File 'lib/cloudflare_client/zone/firewall/waf_package/rule.rb', line 40 def update(id:, mode: 'on') id_check('id', id) valid_value_check(:mode, mode, VALID_MODES) cf_patch(path: "/zones/#{zone_id}/firewall/waf/packages/#{package_id}/rules/#{id}", data: {mode: mode}) end |