Class: Fog::Compute::Serverlove::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Serverlove::Image
- Defined in:
- lib/fog/compute/serverlove/models/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
45 46 47 48 |
# File 'lib/fog/compute/serverlove/models/image.rb', line 45 def allowed_attributes allowed = [:name, :size] attributes.select {|k,v| allowed.include? k} end |
#destroy ⇒ Object
39 40 41 42 43 |
# File 'lib/fog/compute/serverlove/models/image.rb', line 39 def destroy requires :identity service.destroy_image(identity) self end |
#load_standard_image(standard_image_uuid) ⇒ Object
30 31 32 33 |
# File 'lib/fog/compute/serverlove/models/image.rb', line 30 def load_standard_image(standard_image_uuid) requires :identity service.load_standard_image(identity, standard_image_uuid) end |
#ready? ⇒ Boolean
35 36 37 |
# File 'lib/fog/compute/serverlove/models/image.rb', line 35 def ready? status.upcase == "ACTIVE" end |
#save ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/compute/serverlove/models/image.rb', line 15 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 |