Sha256: f23d17c93cf279e5bf73069ff9e2867bef177d063f0cb3ff84914500a2138e30

Contents?: true

Size: 1.62 KB

Versions: 48

Compression:

Stored size: 1.62 KB

Contents

module Fog
  module Rackspace
    module Servers
      class Real

        # Get details about a server
        #
        # ==== Parameters
        # * server_id<~Integer> - Id of server to get details for
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #   * 'server'<~Hash>:
        #     * 'addresses'<~Hash>:
        #       * 'public'<~Array> - public address strings
        #       * 'private'<~Array> - private address strings
        #     * 'flavorId'<~Integer> - Id of servers current flavor
        #     * 'hostId'<~String>
        #     * 'id'<~Integer> - Id of server
        #     * 'imageId'<~Integer> - Id of image used to boot server
        #     * 'metadata'<~Hash> - metadata
        #     * 'name<~String> - Name of server
        #     * 'progress'<~Integer> - Progress through current status
        #     * 'status'<~String> - Current server status
        def get_server_details(server_id)
          request(
            :expects  => [200, 203],
            :method   => 'GET',
            :path     => "servers/#{server_id}.json"
          )
        end

      end

      class Mock

        def get_server_details(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 = { 'server' => server }
          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/get_server_details.rb
fog-0.1.4 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.1.3 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.1.2 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.1.1 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.1.0 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.100 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.99 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.98 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.97 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.96 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.95 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.94 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.93 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.92 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.91 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.90 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.89 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.88 lib/fog/rackspace/requests/servers/get_server_details.rb
fog-0.0.87 lib/fog/rackspace/requests/servers/get_server_details.rb