Sha256: 5784ff392df01a147aaa171fa78e6d32dcca8d51dfabdb6eab0e1f7f622f5f7d

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

Contents

module Fog
  module Compute
    class Clodo
      class Real

        # Delete IP-address from specified server
        # ==== Paramaters
        # * server_id<~Integer> - Id of server to delete IP from
        # * ip<~String> - IP-address to delete
        #
        # ==== Returns
        # * response<~Excon::Response>
        #

        def delete_ip_address(server_id, ip)
          data = {'ip' => ip}

          request(
                  :expects  => [204],
                  :method   => 'DELETE',
                  :path     => "servers/#{server_id}/ips",
                  :body     => MultiJson.encode(data)
                  )
        end
      end

      class Mock
        def delete_ip_address(server_id, ip)

          server = self.data[:servers][server_id]

          raise Excon::Errors::BadRequest.new "Server not found" unless server

          pa = server['addresses']['public']

          raise Excon::Errors::BadRequest.new "Address not found" unless pa && pa.reject! {|addr|
            addr['ip'] == ip
          }
          
          response = Excon::Response.new
          response.status = 204
          response
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 5 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/clodo/requests/compute/delete_ip_address.rb
michiels-fog-1.3.1 lib/fog/clodo/requests/compute/delete_ip_address.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/clodo/requests/compute/delete_ip_address.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/clodo/requests/compute/delete_ip_address.rb
fog-1.3.1 lib/fog/clodo/requests/compute/delete_ip_address.rb
fog-1.3.0 lib/fog/clodo/requests/compute/delete_ip_address.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/clodo/requests/compute/delete_ip_address.rb
fog-1.2.0 lib/fog/clodo/requests/compute/delete_ip_address.rb
ktheory-fog-1.1.2 lib/fog/clodo/requests/compute/delete_ip_address.rb
fog-1.1.2 lib/fog/clodo/requests/compute/delete_ip_address.rb