Sha256: 856648afb9d8fe9263e008ef5a4f27b15ab7cb9613c20c8ecca97e9c6204e2c1

Contents?: true

Size: 928 Bytes

Versions: 4

Compression:

Stored size: 928 Bytes

Contents

require 'fog/core/collection'
require 'fog/glesys/models/compute/server'

module Fog
  module Compute
    class Glesys

        class Servers < Fog::Collection

        model Fog::Compute::Glesys::Server

        def all
          data = service.list_servers.body['response']['servers']
          load(data)
        end

        def get(identifier)
          return nil if identifier.nil? || identifier == ""

          begin
            details = service.server_details(identifier).body['response']
            status  = service.server_status(identifier).body['response']

            if details.empty? || status.empty?
              nil
            else
              status['server'].merge!({ :serverid => identifier})
              details['server'].merge!(status['server'])
              new(details['server'])
            end
          rescue
            return nil
          end
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fog-1.9.0 lib/fog/glesys/models/compute/servers.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/glesys/models/compute/servers.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/glesys/models/compute/servers.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/glesys/models/compute/servers.rb