Sha256: 155176e59afc4915031e7e559ac7cd679b496956e32c430bb862adf5cc093148

Contents?: true

Size: 921 Bytes

Versions: 43

Compression:

Stored size: 921 Bytes

Contents

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

module Fog
  module Compute
    class Cloudstack

      class Servers < Fog::Collection

        model Fog::Compute::Cloudstack::Server

        def all(attributes={})
          response = service.list_virtual_machines(attributes)
          data = response["listvirtualmachinesresponse"]["virtualmachine"] || []
          load(data)
        end

        def bootstrap(new_attributes = {})
          server = create(new_attributes)
          server.wait_for { ready? }
          server
        end

        def get(server_id)
          servers = service.list_virtual_machines('id' => server_id)["listvirtualmachinesresponse"]["virtualmachine"]
          unless servers.nil? || servers.empty?
            new(servers.first)
          end
        rescue Fog::Compute::Cloudstack::BadRequest
          nil
        end
      end

    end
  end
end

Version data entries

43 entries across 43 versions & 3 rubygems

Version Path
fog-1.21.0 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/cloudstack/models/compute/servers.rb
fog-1.20.0 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/cloudstack/models/compute/servers.rb
fog-1.19.0 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/cloudstack/models/compute/servers.rb