Sha256: a41483e0a26667712fb07e6b2516d1ee5d4fe9c3040123e3ea5367a43f70a538

Contents?: true

Size: 1.51 KB

Versions: 36

Compression:

Stored size: 1.51 KB

Contents

module Awspec::Helper
  module Finder
    module WafRegional
      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

      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

      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
    end
  end
end

Version data entries

36 entries across 36 versions & 3 rubygems

Version Path
cthiesfork-awspec-1.2.2 lib/awspec/helper/finder/wafregional.rb
cthiesfork-awspec-1.2.1 lib/awspec/helper/finder/wafregional.rb
awspec-1.18.5 lib/awspec/helper/finder/wafregional.rb
cthiesfork-awspec-1.2.0 lib/awspec/helper/finder/wafregional.rb
cthiesfork-awspec-1.1.0 lib/awspec/helper/finder/wafregional.rb
cthiesfork-awspec-1.0.0 lib/awspec/helper/finder/wafregional.rb
awspec-1.18.4 lib/awspec/helper/finder/wafregional.rb
awspec-1.18.3 lib/awspec/helper/finder/wafregional.rb
awspec-1.18.2 lib/awspec/helper/finder/wafregional.rb
awspec-1.18.1 lib/awspec/helper/finder/wafregional.rb
awspec-1.18.0 lib/awspec/helper/finder/wafregional.rb
awspec-1.17.4 lib/awspec/helper/finder/wafregional.rb
awspec-1.17.3 lib/awspec/helper/finder/wafregional.rb
awspec-1.17.2 lib/awspec/helper/finder/wafregional.rb
awspec-1.17.1 lib/awspec/helper/finder/wafregional.rb
awspec-1.17.0 lib/awspec/helper/finder/wafregional.rb