Class: Shield
Overview
Collect Shield 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.
10 11 12 13 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 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/aws_recon/collectors/shield.rb', line 10 def collect resources = [] # # describe_subscription # @client.describe_subscription.each do |response| log(response.context.operation_name) struct = OpenStruct.new(response.subscription.to_h) struct.type = 'subscription' struct.arn = "arn:aws:shield:#{@region}:#{@account}:subscription" resources.push(struct.to_h) end # # describe_emergency_contact_settings # @client.describe_emergency_contact_settings.each do |response| log(response.context.operation_name) struct = OpenStruct.new struct.type = 'contact_list' struct.arn = "arn:aws:shield:#{@region}:#{@account}:contact_list" struct.contacts = response&.emergency_contact_list&.map(&:to_h) resources.push(struct.to_h) end # # list_protections # @client.list_protections.each_with_index do |response, page| log(response.context.operation_name, page) # describe_protection response.protections.each do |protection| struct = OpenStruct.new(@client.describe_protection({ protection_id: protection.id }).protection.to_h) struct.type = 'protection' struct.arn = protection.resource_arn resources.push(struct.to_h) end end resources rescue Aws::Shield::Errors::ServiceError => e log_error(e.code) raise e unless suppressed_errors.include?(e.code) && !@options.quit_on_exception [] # no access or service isn't enabled end |