Class: Fog::Compute::HP::Image

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

Instance Attribute Summary collapse

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

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 Attribute Details

#architectureObject (readonly)

Returns the value of attribute architecture.



25
26
27
# File 'lib/fog/hp/models/compute/image.rb', line 25

def architecture
  @architecture
end

#image_typeObject (readonly)

Returns the value of attribute image_type.



24
25
26
# File 'lib/fog/hp/models/compute/image.rb', line 24

def image_type
  @image_type
end

#min_diskObject (readonly)

these values are extracted from metadata



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

def min_disk
  @min_disk
end

#min_ramObject (readonly)

Returns the value of attribute min_ram.



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

def min_ram
  @min_ram
end

Instance Method Details

#destroyObject



62
63
64
65
66
# File 'lib/fog/hp/models/compute/image.rb', line 62

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

#metadataObject



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

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

#metadata=(new_metadata = {}) ⇒ Object



36
37
38
39
40
# File 'lib/fog/hp/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)


68
69
70
# File 'lib/fog/hp/models/compute/image.rb', line 68

def ready?
  status == 'ACTIVE'
end