Class: Fog::Compute::OpenStack::Volume
- Defined in:
- lib/fog/openstack/models/compute/volume.rb
Instance Attribute Summary
Attributes inherited from Model
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.
- #save ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ Volume
Returns a new instance of Volume.
23 24 25 26 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 23 def initialize(attributes) @connection = attributes[:connection] super end |
Instance Method Details
#attach(server_id, name) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 41 def attach(server_id, name) requires :id data = connection.attach_volume(id, server_id, name) merge_attributes(:attachments => << data.body['volumeAttachment']) true end |
#destroy ⇒ Object
35 36 37 38 39 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 35 def destroy requires :id connection.delete_volume(id) true end |
#detach(server_id, attachment_id) ⇒ Object
48 49 50 51 52 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 48 def detach(server_id, ) requires :id connection.detach_volume(server_id, ) true end |
#save ⇒ Object
28 29 30 31 32 33 |
# File 'lib/fog/openstack/models/compute/volume.rb', line 28 def save requires :name, :description, :size data = connection.create_volume(name, description, size, attributes) merge_attributes(data.body['volume']) true end |