Sha256: a62bea15ed1af9ac4e7b76d6fb3e16530258d4f18ffa5a20afef0b5a0564c710

Contents?: true

Size: 729 Bytes

Versions: 8

Compression:

Stored size: 729 Bytes

Contents

module Fog
  module Rackspace
    class Servers

      def servers
        Fog::Rackspace::Servers::Servers.new(:connection => self)
      end

      class Servers < Fog::Collection

        model Fog::Rackspace::Servers::Server

        def all
          if @loaded
            clear
          end
          @loaded = true
          data = connection.list_servers_detail.body
          for server in data['servers']
            self << new(server)
          end
          self
        end

        def get(server_id)
          if server = connection.get_server_details(server_id).body['server']
            new(server)
          end
        rescue Excon::Errors::NotFound
          nil
        end

      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-0.0.47 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.46 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.45 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.44 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.43 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.42 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.41 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.40 lib/fog/rackspace/models/servers/servers.rb