Sha256: c9771ee1fcd21a959328ec73e54e9848c06b411cbd1008c5130708f37e25974e

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

module Vcloud
  module EdgeGateway
    class EdgeGatewayConfiguration

      def initialize(local_config)
        @local_config = local_config
        @config = { }
      end

      def update_required?(remote_config)
        update_required = false

        firewall_service_config = EdgeGateway::ConfigurationGenerator::FirewallService.new.generate_fog_config(@local_config[:firewall_service])
        unless firewall_service_config.nil?
          differ = EdgeGateway::ConfigurationDiffer.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[:gateway], @local_config[:nat_service]).generate_fog_config

        unless nat_service_config.nil?
          differ = EdgeGateway::ConfigurationDiffer.new(nat_service_config, remote_config[:NatService])
          unless differ.diff.empty?
            @config[:NatService] = nat_service_config
            update_required = true
          end
        end

        update_required
      end

      def config
        @config
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vcloud-edge_gateway-0.0.2 lib/vcloud/edge_gateway/edge_gateway_configuration.rb
vcloud-edge_gateway-0.0.1 lib/vcloud/edge_gateway/edge_gateway_configuration.rb