Class: Fog::Image::OpenStack::Image
- Inherits:
-
Model
- Object
- Model
- Fog::Image::OpenStack::Image
show all
- Defined in:
- lib/fog/openstack/models/image/image.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#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
#initialize(attributes) ⇒ Image
Returns a new instance of Image.
34
35
36
37
|
# File 'lib/fog/openstack/models/image/image.rb', line 34
def initialize(attributes)
@connection = attributes[:connection]
super
end
|
Instance Method Details
#add_member(member_id) ⇒ Object
62
63
64
65
|
# File 'lib/fog/openstack/models/image/image.rb', line 62
def add_member(member_id)
requires :id
connection.add_member_to_image(self.id, member_id)
end
|
#create ⇒ Object
44
45
46
47
48
|
# File 'lib/fog/openstack/models/image/image.rb', line 44
def create
requires :name
merge_attributes(connection.create_image(self.attributes).body['image'])
self
end
|
#destroy ⇒ Object
56
57
58
59
60
|
# File 'lib/fog/openstack/models/image/image.rb', line 56
def destroy
requires :id
connection.delete_image(self.id)
true
end
|
#members ⇒ Object
77
78
79
80
|
# File 'lib/fog/openstack/models/image/image.rb', line 77
def members
requires :id
connection.get_image_members(self.id).body['members']
end
|
82
83
84
85
|
# File 'lib/fog/openstack/models/image/image.rb', line 82
def metadata
requires :id
connection.get_image(self.id).
end
|
#remove_member(member_id) ⇒ Object
67
68
69
70
|
# File 'lib/fog/openstack/models/image/image.rb', line 67
def remove_member(member_id)
requires :id
connection.remove_member_from_image(self.id, member_id)
end
|
#save ⇒ Object
39
40
41
42
|
# File 'lib/fog/openstack/models/image/image.rb', line 39
def save
requires :name
identity ? update : create
end
|
#update ⇒ Object
50
51
52
53
54
|
# File 'lib/fog/openstack/models/image/image.rb', line 50
def update
requires :name
merge_attributes(connection.update_image(self.attributes).body['image'])
self
end
|
#update_members(members) ⇒ Object
72
73
74
75
|
# File 'lib/fog/openstack/models/image/image.rb', line 72
def update_members(members)
requires :id
connection.update_image_members(self.id, members)
end
|