Class: Fog::Compute::HPV2::Image

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

Instance Method Summary collapse

Instance Method Details

#architectureObject



75
76
77
78
# File 'lib/fog/hp/models/compute_v2/image.rb', line 75

def architecture
  m = @metadata.find {|md| md.key == 'architecture'}
  m.value unless m.nil?
end

#bootable_volume?Boolean

The following are built-in metadata for each image, exposed as helpers

Returns:

  • (Boolean)


45
46
47
48
# File 'lib/fog/hp/models/compute_v2/image.rb', line 45

def bootable_volume?
  m = @metadata.find {|md| md.key == 'com.hp__1__bootable_volume'}
  m.value unless m.nil?
end

#destroyObject



34
35
36
37
38
# File 'lib/fog/hp/models/compute_v2/image.rb', line 34

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

#licenseObject



65
66
67
68
# File 'lib/fog/hp/models/compute_v2/image.rb', line 65

def license
  m = @metadata.find {|md| md.key == 'hp_image_license'}
  m.value unless m.nil?
end

#metadataObject

attribute :metadata # lazy load metadata as needed per model



19
20
21
22
23
24
25
26
# File 'lib/fog/hp/models/compute_v2/image.rb', line 19

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

#metadata=(new_metadata = {}) ⇒ Object



28
29
30
31
32
# File 'lib/fog/hp/models/compute_v2/image.rb', line 28

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

#os_distroObject



55
56
57
58
# File 'lib/fog/hp/models/compute_v2/image.rb', line 55

def os_distro
  m = @metadata.find {|md| md.key == 'com.hp__1__os_distro'}
  m.value unless m.nil?
end

#os_versionObject



60
61
62
63
# File 'lib/fog/hp/models/compute_v2/image.rb', line 60

def os_version
  m = @metadata.find {|md| md.key == 'com.hp__1__os_version'}
  m.value unless m.nil?
end

#providerObject



50
51
52
53
# File 'lib/fog/hp/models/compute_v2/image.rb', line 50

def provider
  m = @metadata.find {|md| md.key == 'com.hp__1__provider'}
  m.value unless m.nil?
end

#ready?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/fog/hp/models/compute_v2/image.rb', line 40

def ready?
  status == 'ACTIVE'
end

#typeObject



70
71
72
73
# File 'lib/fog/hp/models/compute_v2/image.rb', line 70

def type
  m = @metadata.find {|md| md.key == 'com.hp__1__image_type'}
  m.value unless m.nil?
end