Class: Fog::Compute::Softlayer::Servers

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/softlayer/models/compute/servers.rb

Instance Method Summary collapse

Instance Method Details

#allObject



18
19
20
21
# File 'lib/fog/softlayer/models/compute/servers.rb', line 18

def all
  data = service.list_servers
  load(data)
end

#bootstrap(options = {}) ⇒ Object



37
38
39
40
41
# File 'lib/fog/softlayer/models/compute/servers.rb', line 37

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

#get(identifier) ⇒ Object

Get a SoftLayer server.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fog/softlayer/models/compute/servers.rb', line 25

def get(identifier)
  return nil if identifier.nil? || identifier == ""
  response = service.get_vm(identifier)
  if response.status == 404 # we didn't find it as a VM, look for a BMC server
    response = service.get_bare_metal_server(identifier)
  end
  data = response.body
  new.merge_attributes(data)
rescue Excon::Errors::NotFound
  nil
end