From c7a8076182b1c8f7e261b0cf1f0d2bf58bf08935 Mon Sep 17 00:00:00 2001 From: Ladislav Smola Date: Fri, 3 Mar 2017 15:32:59 +0100 Subject: [PATCH] Parse all targets from AWS Config Parse all targets from AWS Config --- .../amazon/cloud_manager/event_parser.rb | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/models/manageiq/providers/amazon/cloud_manager/event_parser.rb b/app/models/manageiq/providers/amazon/cloud_manager/event_parser.rb index 62f00caa3..043f22628 100644 --- a/app/models/manageiq/providers/amazon/cloud_manager/event_parser.rb +++ b/app/models/manageiq/providers/amazon/cloud_manager/event_parser.rb @@ -119,7 +119,26 @@ def self.collect_cloudwatch_ec2_references!(available_targets, event) end def self.collect_config_references!(available_targets, event) - add_ref(available_targets, Vm, parse_vm_ref(event.full_data)) if parse_vm_ref(event.full_data) + resource_type = event.fetch_path("configurationItem", "resourceType") + resource_id = event.fetch_path("configurationItem", "resourceId") + target_class = case resource_type + when "AWS::EC2::Instance" + Vm + when "AWS::EC2::SecurityGroup" + SecurityGroup + when "AWS::EC2::Volume" + CloudVolume + when "AWS::EC2::NetworkInterface" + NetworkPort + when "AWS::EC2::VPC" + CloudNetwork + when "AWS::EC2::Subnet" + CloudSubnet + when "AWS::EC2::EIP" + FloatingIp + end + + add_ref(available_targets, target_class, resource_id) if target_class && resource_id end def self.collect_cloudwatch_api_references!(available_targets, hash, depth = 0)