Class: Fog::Bluebox::Server
- Defined in:
- lib/fog/bluebox/models/server.rb
Instance Attribute Summary collapse
-
#image_id ⇒ Object
attribute :image_id.
-
#password ⇒ Object
Not reported by the API, but used at create time.
-
#ssh_key ⇒ Object
Not reported by the API, but used at create time.
-
#user ⇒ Object
Not reported by the API, but used at create time.
Attributes inherited from Model
Instance Method Summary collapse
- #destroy ⇒ Object
- #flavor ⇒ Object
- #image ⇒ Object
- #ready? ⇒ Boolean
- #reboot(type = 'SOFT') ⇒ Object
- #save ⇒ Object
Methods inherited from Model
#collection, #initialize, #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
This class inherits a constructor from Fog::Model
Instance Attribute Details
#image_id ⇒ Object
attribute :image_id
21 22 23 |
# File 'lib/fog/bluebox/models/server.rb', line 21 def image_id @image_id end |
#password ⇒ Object
Not reported by the API, but used at create time
25 26 27 |
# File 'lib/fog/bluebox/models/server.rb', line 25 def password @password end |
#ssh_key ⇒ Object
Not reported by the API, but used at create time
25 26 27 |
# File 'lib/fog/bluebox/models/server.rb', line 25 def ssh_key @ssh_key end |
#user ⇒ Object
Not reported by the API, but used at create time
25 26 27 |
# File 'lib/fog/bluebox/models/server.rb', line 25 def user @user end |
Instance Method Details
#destroy ⇒ Object
27 28 29 30 31 |
# File 'lib/fog/bluebox/models/server.rb', line 27 def destroy requires :id connection.destroy_block(@id) true end |
#flavor ⇒ Object
33 34 35 36 |
# File 'lib/fog/bluebox/models/server.rb', line 33 def flavor requires :flavor_id connection.flavors.get(@flavor_id) end |
#image ⇒ Object
38 39 40 41 |
# File 'lib/fog/bluebox/models/server.rb', line 38 def image requires :image_id connection.images.get(@image_id) end |
#ready? ⇒ Boolean
43 44 45 |
# File 'lib/fog/bluebox/models/server.rb', line 43 def ready? @status == 'running' end |
#reboot(type = 'SOFT') ⇒ Object
47 48 49 50 51 |
# File 'lib/fog/bluebox/models/server.rb', line 47 def reboot(type = 'SOFT') requires :id connection.reboot_block(@id, type) true end |
#save ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fog/bluebox/models/server.rb', line 53 def save requires :flavor_id, :image_id = if !@password && !@ssh_key raise(ArgumentError, "password or ssh_key is required for this operation") elsif @ssh_key {'ssh_key' => @ssh_key} elsif @password {'password' => @password} end if @user ['user'] = @user end data = connection.create_block(@flavor_id, @image_id, ) merge_attributes(data.body) true end |