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

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

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Image

Returns a new instance of Image.



21
22
23
24
25
# File 'lib/fog/openstack/models/compute/image.rb', line 21

def initialize(attributes)
  # Old 'connection' is renamed as service and should be used instead
  prepare_service_value(attributes)
  super
end

Instance Method Details

#destroyObject



42
43
44
45
46
# File 'lib/fog/openstack/models/compute/image.rb', line 42

def destroy
  requires :id
  service.delete_image(id)
  true
end

#metadataObject



27
28
29
30
31
32
33
34
# File 'lib/fog/openstack/models/compute/image.rb', line 27

def 
  @metadata ||= begin
    Fog::Compute::OpenStack::Metadata.new({
      :service => service,
      :parent => self
    })
  end
end

#metadata=(new_metadata = {}) ⇒ Object



36
37
38
39
40
# File 'lib/fog/openstack/models/compute/image.rb', line 36

def metadata=(={})
  metas = []
  .each_pair {|k,v| metas << {"key" => k, "value" => v} }
  .load(metas)
end

#ready?Boolean

Returns:

  • (Boolean)


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

def ready?
  status == 'ACTIVE'
end