Class: Fog::Compute::OpenStack::Image
- Defined in:
- lib/rackspace-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 Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ Image
Returns a new instance of Image.
23 24 25 26 |
# File 'lib/rackspace-fog/openstack/models/compute/image.rb', line 23 def initialize(attributes) @connection = attributes[:connection] super end |
Instance Method Details
#destroy ⇒ Object
43 44 45 46 47 |
# File 'lib/rackspace-fog/openstack/models/compute/image.rb', line 43 def destroy requires :id connection.delete_image(id) true end |
#metadata ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/rackspace-fog/openstack/models/compute/image.rb', line 28 def @metadata ||= begin Fog::Compute::OpenStack::Metadata.new({ :connection => connection, :parent => self }) end end |
#metadata=(new_metadata = {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/rackspace-fog/openstack/models/compute/image.rb', line 37 def (={}) = [] .each_pair {|k,v| << {"key" => k, "value" => v} } .load() end |
#ready? ⇒ Boolean
49 50 51 |
# File 'lib/rackspace-fog/openstack/models/compute/image.rb', line 49 def ready? status == 'ACTIVE' end |