Class: Fog::Volume::OpenStack::Volume
- Inherits:
-
Model
- Object
- Model
- Fog::Volume::OpenStack::Volume
- Defined in:
- lib/fog/openstack/models/volume/volume.rb
Instance Method Summary collapse
- #destroy ⇒ 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.
21 22 23 24 25 |
# File 'lib/fog/openstack/models/volume/volume.rb', line 21 def initialize(attributes) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end |
Instance Method Details
#destroy ⇒ Object
34 35 36 37 38 |
# File 'lib/fog/openstack/models/volume/volume.rb', line 34 def destroy requires :id service.delete_volume(id) true end |
#ready? ⇒ Boolean
40 41 42 |
# File 'lib/fog/openstack/models/volume/volume.rb', line 40 def ready? status == 'available' end |
#save ⇒ Object
27 28 29 30 31 32 |
# File 'lib/fog/openstack/models/volume/volume.rb', line 27 def save requires :display_name, :size data = service.create_volume(display_name, display_description, size, attributes) merge_attributes(data.body['volume']) true end |