Sha256: f0bc66dec4996b8e9d2810aec55e78d7962cb85b2e9e29602e8bfbc75c70a471

Contents?: true

Size: 823 Bytes

Versions: 13

Compression:

Stored size: 823 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
          data = connection.list_virtual_machines["listvirtualmachinesresponse"]["virtualmachine"] || []
          load(data)
        end

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

        def get(server_id)
          if server = connection.list_virtual_machines('id' => server_id)["listvirtualmachinesresponse"]["virtualmachine"].first
            new(server)
          end
        rescue Fog::Compute::Cloudstack::BadRequest
          nil
        end
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/cloudstack/models/compute/servers.rb
fog-nirvanix-1.8.1 lib/fog/cloudstack/models/compute/servers.rb
fog-parser-fix-1.6.1 lib/fog/cloudstack/models/compute/servers.rb
fog-test-again-1.6.0 lib/fog/cloudstack/models/compute/servers.rb
fog-parser-fix-1.6.0 lib/fog/cloudstack/models/compute/servers.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/cloudstack/models/compute/servers.rb
fog-sgonyea-1.8.1 lib/fog/cloudstack/models/compute/servers.rb
fog-1.8.0 lib/fog/cloudstack/models/compute/servers.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/cloudstack/models/compute/servers.rb
fog-1.7.0 lib/fog/cloudstack/models/compute/servers.rb
fog-1.6.0 lib/fog/cloudstack/models/compute/servers.rb
fog-1.5.0 lib/fog/cloudstack/models/compute/servers.rb
fog-1.4.0 lib/fog/cloudstack/models/compute/servers.rb