Sha256: 103e395e4cf86790603f3027384c3bc8a9c79b35980e5939cf8fb5fa9238088e

Contents?: true

Size: 831 Bytes

Versions: 15

Compression:

Stored size: 831 Bytes

Contents

module Ufo::TaskDefinition::Helpers
  module Waf
    include Ufo::Utils::CallLine
    include Ufo::Utils::Pretty

    # Waf names are uniq within their scope. Tested with AWS console
    # Only use regional since this is for ELB support
    # Returns waf arn
    def waf(name, options={})
      resp = waf_client.list_web_acls(
        scope: "REGIONAL", # required, accepts CLOUDFRONT, REGIONAL
        # next_marker: "NextMarker",
        # limit: 1,
      )
      web_acl = resp.web_acls.find do |acl|
        acl.name == name
      end
      if web_acl
        web_acl.arn
      else
        # Logger causes infinite loop when waf helper used in .ufo/
        logger.warn "WARN: Web ACL not found: #{name}".color(:yellow)
        call_line = ufo_call_line
        DslEvaluator.print_code(call_line)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ufo-6.3.13 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.12 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.11 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.10 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.9 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.8 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.7 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.6 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.5 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.4 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.3 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.2 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.1 lib/ufo/task_definition/helpers/waf.rb
ufo-6.3.0 lib/ufo/task_definition/helpers/waf.rb
ufo-6.2.5 lib/ufo/task_definition/helpers/waf.rb