Sha256: 7077e28fad302901f9f1eca0a36d19fc0668d8f0cd46ffc2623dff7c6da6c13e

Contents?: true

Size: 1.08 KB

Versions: 10

Compression:

Stored size: 1.08 KB

Contents

module Fog
  module Compute
    class OpenStack
      class Real
        def allocate_address(pool = nil)
          request(
            :body    => Fog::JSON.encode('pool' => pool),
            :expects => [200, 202],
            :method  => 'POST',
            :path    => 'os-floating-ips.json'
          )
        end
      end

      class Mock
        def allocate_address(_pool = nil)
          response = Excon::Response.new
          response.status = 200
          response.headers = {
            "X-Compute-Request-Id" => "req-d4a21158-a86c-44a6-983a-e25645907f26",
            "Content-Type"         => "application/json",
            "Content-Length"       => "105",
            "Date"                 => Date.new
          }
          response.body = {
            "floating_ip" => {
              "instance_id" => nil,
              "ip"          => "192.168.27.132",
              "fixed_ip"    => nil,
              "id"          => 4,
              "pool"        => "nova"
            }
          }
          response
        end
      end # mock
    end # openstack
  end # compute
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fog-openstack-0.1.21 lib/fog/compute/openstack/requests/allocate_address.rb
fog-openstack-0.1.20 lib/fog/compute/openstack/requests/allocate_address.rb
fog-openstack-0.1.19 lib/fog/compute/openstack/requests/allocate_address.rb
fog-openstack-0.1.18 lib/fog/compute/openstack/requests/allocate_address.rb
fog-openstack-0.1.17 lib/fog/compute/openstack/requests/allocate_address.rb
fog-openstack-0.1.15 lib/fog/compute/openstack/requests/allocate_address.rb
fog-openstack-0.1.14 lib/fog/compute/openstack/requests/allocate_address.rb
fog-openstack-0.1.13 lib/fog/compute/openstack/requests/allocate_address.rb
fog-openstack-0.1.12 lib/fog/compute/openstack/requests/allocate_address.rb
fog-openstack-0.1.11 lib/fog/compute/openstack/requests/allocate_address.rb