Sha256: 867ade306d7e9af34319cf6bd7a254f21a6d800e090463071a4bea40dd43fa37

Contents?: true

Size: 1.44 KB

Versions: 12

Compression:

Stored size: 1.44 KB

Contents

module Fog
  module Compute
    class Google
      class Mock
        def insert_firewall(firewall_name, allowed, network = @default_network, options = {})
          Fog::Mock.not_implemented
        end
      end

      class Real
        def insert_firewall(firewall_name, allowed, network = @default_network, options = {})
          unless network.start_with? 'http'
            network = "#{@api_url}#{@project}/global/networks/#{network}"
          end

          api_method = @compute.firewalls.insert
          parameters = {
            'project' => @project,
          }
          body_object = {
            "name" => firewall_name,
            "network" => network,
            "allowed" => allowed,
          }
          unless options[:description].nil?
            body_object["description"] = options[:description]
          end
          unless options[:source_ranges].nil? || options[:source_ranges].empty?
            body_object["sourceRanges"] = options[:source_ranges]
          end
          unless options[:source_tags].nil? || options[:source_tags].empty?
            body_object["sourceTags"] = options[:source_tags]
          end
          unless options[:target_tags].nil? || options[:target_tags].empty?
            body_object["targetTags"] = options[:target_tags]
          end

          result = self.build_result(api_method, parameters, body_object)
          response = self.build_response(result)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/google/requests/compute/insert_firewall.rb
ns-fog-1.22.11 lib/fog/google/requests/compute/insert_firewall.rb
ns-fog-1.22.10 lib/fog/google/requests/compute/insert_firewall.rb
ns-fog-1.22.9 lib/fog/google/requests/compute/insert_firewall.rb
ns-fog-1.22.8 lib/fog/google/requests/compute/insert_firewall.rb
ns-fog-1.22.7 lib/fog/google/requests/compute/insert_firewall.rb
ns-fog-1.22.6 lib/fog/google/requests/compute/insert_firewall.rb
fog-1.23.0 lib/fog/google/requests/compute/insert_firewall.rb
ns-fog-1.22.4 lib/fog/google/requests/compute/insert_firewall.rb
ns-fog-1.22.3 lib/fog/google/requests/compute/insert_firewall.rb
ns-fog-1.22.2 lib/fog/google/requests/compute/insert_firewall.rb
fog-1.22.1 lib/fog/google/requests/compute/insert_firewall.rb