Sha256: 19e91e9afc7e36515f0bcdce97a2aee72acb596fce5139b8c05364fb6d91a09c

Contents?: true

Size: 1.17 KB

Versions: 27

Compression:

Stored size: 1.17 KB

Contents

unless Fog.mocking?

  module Fog
    module Rackspace
      class Servers

        # 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
    end
  end

else

  module Fog
    module Rackspace
      class Servers

        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

27 entries across 27 versions & 1 rubygems

Version Path
fog-0.0.58 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.57 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.56 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.55 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.54 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.53 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.52 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.51 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.50 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.49 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.48 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.47 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.46 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.45 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.44 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.43 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.42 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.41 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.40 lib/fog/rackspace/requests/servers/list_private_addresses.rb
fog-0.0.39 lib/fog/rackspace/requests/servers/list_private_addresses.rb