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
awspec-1.25.1 lib/awspec/helper/finder/wafregional.rb
awspec-1.25.0 lib/awspec/helper/finder/wafregional.rb
awspec-1.24.4 lib/awspec/helper/finder/wafregional.rb
awspec-1.24.3 lib/awspec/helper/finder/wafregional.rb
awspec-1.24.2 lib/awspec/helper/finder/wafregional.rb
awspec-1.24.1 lib/awspec/helper/finder/wafregional.rb
awspec-1.24.0 lib/awspec/helper/finder/wafregional.rb
awspec-1.23.0 lib/awspec/helper/finder/wafregional.rb
awspec-1.22.1 lib/awspec/helper/finder/wafregional.rb
awspec-1.22.0 lib/awspec/helper/finder/wafregional.rb
awspec-1.21.1 lib/awspec/helper/finder/wafregional.rb
awspec-1.21.0 lib/awspec/helper/finder/wafregional.rb
awspec-1.20.0 lib/awspec/helper/finder/wafregional.rb
awspec-1.19.2 lib/awspec/helper/finder/wafregional.rb
awspec-1.19.1 lib/awspec/helper/finder/wafregional.rb
awspec-1.19.0 lib/awspec/helper/finder/wafregional.rb
cthiesfork-awspec-1.2.4 lib/awspec/helper/finder/wafregional.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/helper/finder/wafregional.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/helper/finder/wafregional.rb
awspec-1.18.6 lib/awspec/helper/finder/wafregional.rb