Sha256: 4345bc8596891b5587471e91539126aa915d13771b209b546596f7d04f624c4d

Contents?: true

Size: 1.11 KB

Versions: 48

Compression:

Stored size: 1.11 KB

Contents

module Fog
  module Rackspace
    module Servers
      class Real

        # List private server addresses
        #
        # ==== Parameters
        # * server_id<~Integer> - Id of server to list addresses for
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'private'<~Array> - Public ip addresses
        def list_private_addresses(server_id)
          request(
            :expects  => [200, 203],
            :method   => 'GET',
            :path     => "servers/#{server_id}/ips/private.json"
          )
        end

      end

      class Mock

        def list_private_addresses(server_id)
          response = Excon::Response.new
          if server = list_servers_detail.body['servers'].detect { |server| server['id'] == server_id }
            response.status = [200, 203][rand(1)]
            response.body = { 'private' => server['addresses']['private'] }
          else
            response.status = 404
            raise(Excon::Errors.status_error({:expects => 202}, response))
          end
          response
        end

      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
fog-0.1.5 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.1.4 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.1.3 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.1.2 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.1.1 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.1.0 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.100 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.99 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.98 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.97 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.96 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.95 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.94 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.93 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.92 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.91 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.90 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.89 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.88 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.87 lib/fog/rackspace/requests/servers/list_private_addresses.rb