Class: Fog::Compute::OpenStack::Image
- Defined in:
- lib/fog/openstack/models/compute/image.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Image
constructor
A new instance of Image.
- #metadata ⇒ Object
- #metadata=(new_metadata = {}) ⇒ Object
- #ready? ⇒ Boolean
Methods inherited from Model
#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
#initialize(attributes) ⇒ Image
Returns a new instance of Image.
23 24 25 26 27 |
# File 'lib/fog/openstack/models/compute/image.rb', line 23 def initialize(attributes) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end |
Instance Method Details
#destroy ⇒ Object
44 45 46 47 48 |
# File 'lib/fog/openstack/models/compute/image.rb', line 44 def destroy requires :id service.delete_image(id) true end |
#metadata ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/fog/openstack/models/compute/image.rb', line 29 def @metadata ||= begin Fog::Compute::OpenStack::Metadata.new({ :service => service, :parent => self }) end end |
#metadata=(new_metadata = {}) ⇒ Object
38 39 40 41 42 |
# File 'lib/fog/openstack/models/compute/image.rb', line 38 def (={}) = [] .each_pair {|k,v| << {"key" => k, "value" => v} } .load() end |
#ready? ⇒ Boolean
50 51 52 |
# File 'lib/fog/openstack/models/compute/image.rb', line 50 def ready? status == 'ACTIVE' end |