Class: Fog::Compute::Serverlove::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Serverlove::Image
show all
- Defined in:
- lib/fog/serverlove/models/compute/image.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
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
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#allowed_attributes ⇒ Object
49
50
51
52
|
# File 'lib/fog/serverlove/models/compute/image.rb', line 49
def allowed_attributes
allowed = [:name, :size]
attributes.select {|k,v| allowed.include? k}
end
|
#destroy ⇒ Object
43
44
45
46
47
|
# File 'lib/fog/serverlove/models/compute/image.rb', line 43
def destroy
requires :identity
connection.destroy_image(identity)
self
end
|
#load_standard_image(standard_image_uuid) ⇒ Object
34
35
36
37
|
# File 'lib/fog/serverlove/models/compute/image.rb', line 34
def load_standard_image(standard_image_uuid)
requires :identity
connection.load_standard_image(identity, standard_image_uuid)
end
|
#ready? ⇒ Boolean
39
40
41
|
# File 'lib/fog/serverlove/models/compute/image.rb', line 39
def ready?
status.upcase == 'ACTIVE'
end
|
#save ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/fog/serverlove/models/compute/image.rb', line 19
def save
attributes = {}
if(identity)
attributes = connection.update_image(identity, allowed_attributes).body
else
requires :name
requires :size
attributes = connection.create_image(allowed_attributes).body
end
merge_attributes(attributes)
self
end
|