Class: Fog::Compute::OpenStack::Image

Inherits:
Model
  • Object
show all
Defined in:
lib/rackspace-fog/openstack/models/compute/image.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

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

#destroyObject



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

#metadataObject



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 metadata=(={})
  metas = []
  .each_pair {|k,v| metas << {"key" => k, "value" => v} }
  .load(metas)
end

#ready?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/rackspace-fog/openstack/models/compute/image.rb', line 49

def ready?
  status == 'ACTIVE'
end