Class: Fog::Compute::Serverlove::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Serverlove::Image
- Defined in:
- lib/fog/serverlove/models/compute/image.rb
Instance Method Summary collapse
- #allowed_attributes ⇒ Object
- #destroy ⇒ Object
- #load_standard_image(standard_image_uuid) ⇒ Object
- #ready? ⇒ Boolean
- #save ⇒ Object
Instance Method Details
#allowed_attributes ⇒ Object
47 48 49 50 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 47 def allowed_attributes allowed = [:name, :size] attributes.select {|k,v| allowed.include? k} end |
#destroy ⇒ Object
41 42 43 44 45 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 41 def destroy requires :identity service.destroy_image(identity) self end |
#load_standard_image(standard_image_uuid) ⇒ Object
32 33 34 35 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 32 def load_standard_image(standard_image_uuid) requires :identity service.load_standard_image(identity, standard_image_uuid) end |
#ready? ⇒ Boolean
37 38 39 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 37 def ready? status.upcase == 'ACTIVE' end |
#save ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 17 def save attributes = {} if(identity) attributes = service.update_image(identity, allowed_attributes).body else requires :name requires :size attributes = service.create_image(allowed_attributes).body end merge_attributes(attributes) self end |