Class: Fog::Compute::HPV2::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::HPV2::Image
- Defined in:
- lib/fog/hp/models/compute_v2/image.rb
Instance Method Summary collapse
- #architecture ⇒ Object
-
#bootable_volume? ⇒ Boolean
The following are built-in metadata for each image, exposed as helpers.
- #destroy ⇒ Object
- #license ⇒ Object
-
#metadata ⇒ Object
attribute :metadata # lazy load metadata as needed per model.
- #metadata=(new_metadata = {}) ⇒ Object
- #os_distro ⇒ Object
- #os_version ⇒ Object
- #provider ⇒ Object
- #ready? ⇒ Boolean
- #type ⇒ Object
Instance Method Details
#architecture ⇒ Object
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
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 |
#destroy ⇒ Object
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 |
#license ⇒ Object
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 |
#metadata ⇒ Object
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 (={}) = [] .each_pair {|k,v| << {'key' => k, 'value' => v} } .load() end |
#os_distro ⇒ Object
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_version ⇒ Object
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 |
#provider ⇒ Object
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
40 41 42 |
# File 'lib/fog/hp/models/compute_v2/image.rb', line 40 def ready? status == 'ACTIVE' end |
#type ⇒ Object
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 |