Class: Fog::Compute::OpenStack::Volume
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::OpenStack::Volume
- Defined in:
- lib/fog/openstack/models/compute/volume.rb
Instance Method Summary collapse
- #attach(server_id, name) ⇒ Object
- #destroy ⇒ Object
- #detach(server_id, attachment_id) ⇒ Object
-
#initialize(attributes) ⇒ Volume
constructor
A new instance of Volume.
- #ready? ⇒ Boolean
- #save ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Volume
Returns a new instance of Volume.
20 21 22 23 24 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 20 def initialize(attributes) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end |
Instance Method Details
#attach(server_id, name) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 39 def attach(server_id, name) requires :id data = service.attach_volume(id, server_id, name) merge_attributes(:attachments => << data.body['volumeAttachment']) true end |
#destroy ⇒ Object
33 34 35 36 37 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 33 def destroy requires :id service.delete_volume(id) true end |
#detach(server_id, attachment_id) ⇒ Object
46 47 48 49 50 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 46 def detach(server_id, ) requires :id service.detach_volume(server_id, ) true end |
#ready? ⇒ Boolean
52 53 54 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 52 def ready? self.status == "available" end |
#save ⇒ Object
26 27 28 29 30 31 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 26 def save requires :name, :description, :size data = service.create_volume(name, description, size, attributes) merge_attributes(data.body['volume']) true end |