Sha256: 60c7a412a062c18b791e33b95ff9e2351babda891746391900627885a0b6dd86

Contents?: true

Size: 1.34 KB

Versions: 39

Compression:

Stored size: 1.34 KB

Contents

module Fog
  module Network
    class OpenStack

      class Real
        def create_floating_ip(floating_network_id, options = {})
          data = {
            'floatingip' => {
              'floating_network_id' => floating_network_id
            }
          }

          vanilla_options = [:port_id, :tenant_id, :fixed_ip_address ]
          vanilla_options.reject{ |o| options[o].nil? }.each do |key|
            data['floatingip'][key] = options[key]
          end

          request(
            :body     => Fog::JSON.encode(data),
            :expects  => [201],
            :method   => 'POST',
            :path     => 'floatingips'
          )
        end
      end

      class Mock
        def create_floating_ip(floating_network_id, options = {})
          response = Excon::Response.new
          response.status = 201
          data = {
            'id'                  => floating_network_id,
            'floating_network_id' => floating_network_id,
            'port_id'             => options[:port_id],
            'tenant_id'           => options[:tenant_id],
            'fixed_ip_address'    => options[:fixed_ip_address],
            'router_id'           => nil,
          }
          self.data[:floating_ips][data['id']] = data
          response.body = { 'floatingip' => data }
          response
        end
      end

    end
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
fog-maestrodev-1.18.0.20131209090811 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-1.18.0 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-1.17.0 lib/fog/openstack/requests/network/create_floating_ip.rb
fog-1.16.0 lib/fog/openstack/requests/network/create_floating_ip.rb