module Vcloud module EdgeGateway class EdgeGatewayConfiguration def initialize(local_config, remote_config, edge_gateway_interfaces) @local_config = local_config @remote_config = remote_config @edge_gateway_interfaces = edge_gateway_interfaces @config = { } @update_required = nil end def update_required? @update_required = false firewall_service_config = EdgeGateway::ConfigurationGenerator::FirewallService.new.generate_fog_config(@local_config[:firewall_service]) unless firewall_service_config.nil? differ = EdgeGateway::FirewallConfigurationDiffer.new(firewall_service_config, @remote_config[:FirewallService]) unless differ.diff.empty? @config[:FirewallService] = firewall_service_config @update_required = true end end nat_service_config = EdgeGateway::ConfigurationGenerator::NatService.new( @local_config[:nat_service], @edge_gateway_interfaces ).generate_fog_config unless nat_service_config.nil? differ = EdgeGateway::NatConfigurationDiffer.new(nat_service_config, @remote_config[:NatService]) unless differ.diff.empty? @config[:NatService] = nat_service_config @update_required = true end end load_balancer_service_config = EdgeGateway::ConfigurationGenerator::LoadBalancerService.new( @edge_gateway_interfaces ).generate_fog_config(@local_config[:load_balancer_service]) unless load_balancer_service_config.nil? differ = EdgeGateway::LoadBalancerConfigurationDiffer.new( load_balancer_service_config, @remote_config[:LoadBalancerService] ) unless differ.diff.empty? @config[:LoadBalancerService] = load_balancer_service_config @update_required = true end end @update_required end def config if @update_required.nil? update_required? end @config end end end end