Class: Fog::Compute::Serverlove::Image
- Defined in:
- lib/fog/serverlove/models/compute/image.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #allowed_attributes ⇒ Object
- #destroy ⇒ Object
- #load_standard_image(standard_image_uuid) ⇒ Object
- #ready? ⇒ Boolean
- #save ⇒ Object
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#allowed_attributes ⇒ Object
49 50 51 52 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 49 def allowed_attributes allowed = [:name, :size] attributes.select {|k,v| allowed.include? k} end |
#destroy ⇒ Object
43 44 45 46 47 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 43 def destroy requires :identity service.destroy_image(identity) self end |
#load_standard_image(standard_image_uuid) ⇒ Object
34 35 36 37 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 34 def load_standard_image(standard_image_uuid) requires :identity service.load_standard_image(identity, standard_image_uuid) end |
#ready? ⇒ Boolean
39 40 41 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 39 def ready? status.upcase == 'ACTIVE' end |
#save ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/serverlove/models/compute/image.rb', line 19 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 |