Class: Fog::Compute::CloudSigma::Volume
Instance Method Summary
collapse
model_attribute, model_attribute_array
Instance Method Details
#clone(clone_params = {}) ⇒ Object
60
61
62
63
64
65
|
# File 'lib/fog/cloudsigma/models/volume.rb', line 60
def clone(clone_params={})
requires :identity
response = service.clone_volume(identity, clone_params)
self.class.new(response.body['objects'].first)
end
|
#create ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'lib/fog/cloudsigma/models/volume.rb', line 31
def create
requires :name, :size, :media
data = attributes
response = service.create_volume(data)
new_attributes = response.body['objects'].first
merge_attributes(new_attributes)
end
|
#destroy ⇒ Object
Also known as:
delete
50
51
52
53
54
55
56
|
# File 'lib/fog/cloudsigma/models/volume.rb', line 50
def destroy
requires :identity
service.delete_volume(identity)
true
end
|
#save ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/fog/cloudsigma/models/volume.rb', line 23
def save
if persisted?
update
else
create
end
end
|
#update ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'lib/fog/cloudsigma/models/volume.rb', line 40
def update
requires :identity, :name, :size, :media
data = attributes()
response = service.update_volume(identity, data)
new_attributes = response.body
merge_attributes(new_attributes)
end
|