Class: Fog::Compute::HPV2::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::HPV2::Image
show all
- Defined in:
- lib/fog/hp/models/compute_v2/image.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #service
Instance Method Summary
collapse
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#connection, #connection=, #prepare_service_value
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#architecture ⇒ Object
77
78
79
80
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 77
def architecture
m = @metadata.detect {|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
47
48
49
50
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 47
def bootable_volume?
m = @metadata.detect {|md| md.key == 'com.hp__1__bootable_volume'}
m.value unless m.nil?
end
|
#destroy ⇒ Object
36
37
38
39
40
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 36
def destroy
requires :id
service.delete_image(id)
true
end
|
#license ⇒ Object
67
68
69
70
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 67
def license
m = @metadata.detect {|md| md.key == 'hp_image_license'}
m.value unless m.nil?
end
|
attribute :metadata # lazy load metadata as needed per model
21
22
23
24
25
26
27
28
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 21
def metadata
@metadata ||= begin
Fog::Compute::HPV2::Metadata.new({
:service => service,
:parent => self
})
end
end
|
30
31
32
33
34
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 30
def metadata=(new_metadata={})
metas = []
new_metadata.each_pair {|k,v| metas << {'key' => k, 'value' => v} }
metadata.load(metas)
end
|
#os_distro ⇒ Object
57
58
59
60
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 57
def os_distro
m = @metadata.detect {|md| md.key == 'com.hp__1__os_distro'}
m.value unless m.nil?
end
|
#os_version ⇒ Object
62
63
64
65
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 62
def os_version
m = @metadata.detect {|md| md.key == 'com.hp__1__os_version'}
m.value unless m.nil?
end
|
#provider ⇒ Object
52
53
54
55
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 52
def provider
m = @metadata.detect {|md| md.key == 'com.hp__1__provider'}
m.value unless m.nil?
end
|
#ready? ⇒ Boolean
42
43
44
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 42
def ready?
status == 'ACTIVE'
end
|
#type ⇒ Object
72
73
74
75
|
# File 'lib/fog/hp/models/compute_v2/image.rb', line 72
def type
m = @metadata.detect {|md| md.key == 'com.hp__1__image_type'}
m.value unless m.nil?
end
|