Class: Fog::Compute::SakuraCloud::Servers
- Inherits:
-
Fog::Collection
- Object
- Fog::Collection
- Fog::Compute::SakuraCloud::Servers
- Defined in:
- lib/fog/sakuracloud/models/compute/servers.rb
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
10 11 12 |
# File 'lib/fog/sakuracloud/models/compute/servers.rb', line 10 def all load service.list_servers.body['Servers'] end |
#create(options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fog/sakuracloud/models/compute/servers.rb', line 20 def create( = {}) user = [:user] || 'root' Fog::Logger.warning("Create Server") data = service.create_server(Fog::UUID.uuid, [:serverplan]).body["Server"] server = service.servers.new server.merge_attributes(data) if [:volume] disk = create_and_attach_volume(server, ) server.reload end server.boot if [:boot] server end |
#get(id) ⇒ Object
14 15 16 17 18 |
# File 'lib/fog/sakuracloud/models/compute/servers.rb', line 14 def get(id) all.find { |f| f.id == id } rescue Fog::Errors::NotFound nil end |