Class: Fog::Compute::Serverlove::Server
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Serverlove::Server
- Defined in:
- lib/fog/compute/serverlove/models/server.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.defaults ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/fog/compute/serverlove/models/server.rb', line 56 def self.defaults # TODO: Document default settings. # Note that VNC password standards are strict (need explaining) { "nic:0:model" => "e1000", "nic:0:dhcp" => "auto", "smp" => "auto", "vnc" => "auto", "vnc:password" => Fog::Compute::Serverlove::PasswordGenerator.generate } end |
Instance Method Details
#allowed_attributes ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/fog/compute/serverlove/models/server.rb', line 46 def allowed_attributes allowed = [ :name, :cpu, :smp, :mem, :persistent, :vnc_password, :vnc, :ide_0_0, :ide_0_1, :ide_1_0, :ide_1_1, :boot, :nic_0_model, :nic_0_dhcp ] attributes.select {|k,v| allowed.include? k} end |
#destroy ⇒ Object
40 41 42 43 44 |
# File 'lib/fog/compute/serverlove/models/server.rb', line 40 def destroy requires :identity service.destroy_server(identity) self end |
#save ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fog/compute/serverlove/models/server.rb', line 25 def save attributes = {} if(identity) attributes = service.update_server(identity, allowed_attributes).body else requires :name requires :cpu attributes = service.create_server(self.class.defaults.merge(allowed_attributes)).body end merge_attributes(attributes) self end |