Class: WAFV2
Overview
Collect WAFv2 resources
Constant Summary
Constants inherited from Mapper
Mapper::SINGLE_REGION_SERVICES
Instance Method Summary collapse
-
#collect ⇒ Object
Returns an array of resources.
Methods inherited from Mapper
Constructor Details
This class inherits a constructor from Mapper
Instance Method Details
#collect ⇒ Object
Returns an array of resources.
TODO: test live TODO: resolve scope (e.g. CLOUDFRONT supported?) TODO: confirm paging behavior
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/aws_recon/collectors/wafv2.rb', line 14 def collect resources = [] # # list_web_acls # # %w[CLOUDFRONT REGIONAL].each do |scope| %w[REGIONAL].each do |scope| @client.list_web_acls({ scope: scope }).each_with_index do |response, page| log(response.context.operation_name, page) response.web_acls.each do |acl| struct = OpenStruct.new(acl.to_h) struct.type = 'web_acl' # struct.arn = "arn:aws:#{@service}:#{@region}::web_acl/#{acl.id}" params = { name: acl.name, scope: scope, id: acl.id } # get_web_acl @client.get_web_acl(params).each do |r| struct.arn = r.web_acl.arn struct.details = r.web_acl end # list_resources_for_web_acl @client.list_resources_for_web_acl({ web_acl_arn: 'ResourceArn' }).each do |r| struct.resources = r.resource_arns.map(&:to_h) end resources.push(struct.to_h) end end end resources end |