Sha256: 3843993b49157976cb3f63e2b2cc4a20dfc641be6bf9722073f4df2b3e894b93

Contents?: true

Size: 1.27 KB

Versions: 89

Compression:

Stored size: 1.27 KB

Contents

module Fog
  module Compute
    class Clodo
      class Real

        # Bye new IP-address for specified server
        # ==== Paramaters
        # * server_id<~Integer> - Id of server to bye IP for
        #
        # ==== Returns
        # * response<~Excon::Response>
        #

        def add_ip_address(server_id)
          request(
                  :expects  => [204],
                  :method   => 'PUT',
                  :path     => "servers/#{server_id}/ips"
                  )
        end
      end

      class Mock
        def add_ip_address(server_id)

          raise Excon::Errors::BadRequest.new(
                                              "Invalid image ID"
                                              ) unless server_id > 0

          data = {
            'primary_ip' => false,
            'isp' => false,
            'ip' => "66.6.#{rand(255)}.#{rand(255)}"
          }

          raise Excon::Errors::BadRequest unless self.data[:servers][server_id]

          raise Excon::Errors::BadRequest.new "No addresses" unless self.data[:servers][server_id]['addresses']

          self.data[:servers][server_id]['addresses']['public'] << data

          response = Excon::Response.new
          response.status = 204
          response
        end
      end
    end
  end
end

Version data entries

89 entries across 89 versions & 16 rubygems

Version Path
fog-1.10.1 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-parser-fix-1.6.1 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-test-again-1.6.0 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-test-me-1.10.0 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-parser-fix-1.6.0 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-1.10.0 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-1.9.0 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/clodo/requests/compute/add_ip_address.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/clodo/requests/compute/add_ip_address.rb
fog-sgonyea-1.8.1 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-1.8.0 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-1.7.0 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-1.6.0 lib/fog/clodo/requests/compute/add_ip_address.rb
fog-1.5.0 lib/fog/clodo/requests/compute/add_ip_address.rb
rackspace-fog-1.4.2 lib/rackspace-fog/clodo/requests/compute/add_ip_address.rb
fog-1.4.0 lib/fog/clodo/requests/compute/add_ip_address.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/clodo/requests/compute/add_ip_address.rb