Module: Awspec::Helper::Finder::WafRegional
- Included in:
- Awspec::Helper::Finder
- Defined in:
- lib/awspec/helper/finder/wafregional.rb
Instance Method Summary collapse
- #find_wafregional_ip_set(id) ⇒ Object
- #find_wafregional_rule(id) ⇒ Object
- #find_wafregional_web_acl(id) ⇒ Object
Instance Method Details
#find_wafregional_ip_set(id) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/awspec/helper/finder/wafregional.rb', line 40 def find_wafregional_ip_set(id) finded = nil next_marker = nil loop do res = wafregional_client.list_ip_sets(next_marker: next_marker, limit: 1) finded = res.ip_sets.find do |set| set.ip_set_id == id || set.name == id end (finded.nil? && next_marker = res.next_marker) || break end return nil unless finded wafregional_client.get_ip_set(ip_set_id: finded.ip_set_id).ip_set end |
#find_wafregional_rule(id) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/awspec/helper/finder/wafregional.rb', line 23 def find_wafregional_rule(id) finded = nil next_marker = nil loop do res = wafregional_client.list_rules(next_marker: next_marker, limit: 1) finded = res.rules.find do |rule| rule.rule_id == id || rule.name == id end (finded.nil? && next_marker = res.next_marker) || break end return nil unless finded wafregional_client.get_rule(rule_id: finded.rule_id).rule end |
#find_wafregional_web_acl(id) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/awspec/helper/finder/wafregional.rb', line 6 def find_wafregional_web_acl(id) finded = nil next_marker = nil loop do res = wafregional_client.list_web_acls(next_marker: next_marker, limit: 100) finded = res.web_acls.find do |acl| acl.web_acl_id == id || acl.name == id end (finded.nil? && next_marker = res.next_marker) || break end return nil unless finded wafregional_client.get_web_acl(web_acl_id: finded.web_acl_id).web_acl end |