Class: Fog::GoGrid::Compute::Server
- Defined in:
- lib/fog/compute/models/go_grid/server.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #destroy ⇒ Object
- #image ⇒ Object
-
#initialize(attributes = {}) ⇒ Server
constructor
A new instance of Server.
- #ready? ⇒ Boolean
- #save ⇒ Object
Methods inherited from Model
#inspect, #reload, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires
Constructor Details
#initialize(attributes = {}) ⇒ Server
Returns a new instance of Server.
21 22 23 |
# File 'lib/fog/compute/models/go_grid/server.rb', line 21 def initialize(attributes={}) super end |
Instance Method Details
#destroy ⇒ Object
25 26 27 28 29 |
# File 'lib/fog/compute/models/go_grid/server.rb', line 25 def destroy requires :id connection.grid_server_destroy(id) true end |
#image ⇒ Object
31 32 33 34 |
# File 'lib/fog/compute/models/go_grid/server.rb', line 31 def image requires :image_id connection.grid_image_get(image_id) end |
#ready? ⇒ Boolean
36 37 38 |
# File 'lib/fog/compute/models/go_grid/server.rb', line 36 def ready? @state == 'On' end |
#save ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fog/compute/models/go_grid/server.rb', line 40 def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity requires :name, :image_id, :ip, :memory ['isSandbox'] = sandbox if sandbox ['server.ram'] = memory ['image'] = image_id data = connection.grid_server_add(name, image, ip, ) merge_attributes(data.body) true end |