Class: Fog::Compute::ProfitBricks::Volume
- Inherits:
-
Models::ProfitBricks::Base
- Object
- Model
- Models::ProfitBricks::Base
- Fog::Compute::ProfitBricks::Volume
- Defined in:
- lib/fog/profitbricks/models/compute/volume.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #attach(server_id, options = {}) ⇒ Object
- #destroy ⇒ Object
- #detach(server_id) ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Volume
constructor
A new instance of Volume.
- #ready? ⇒ Boolean
- #save ⇒ Object
- #update ⇒ Object
Methods inherited from Models::ProfitBricks::Base
Constructor Details
#initialize(attributes = {}) ⇒ Volume
Returns a new instance of Volume.
22 23 24 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 22 def initialize(attributes = {}) super end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
20 21 22 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 20 def @options end |
Instance Method Details
#attach(server_id, options = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 42 def attach(server_id, = {}) requires :id = { "busType" => [:bus_type], "deviceNumber" => [:device_number] } data = service.connect_storage_to_server(id, server_id, ) reload end |
#destroy ⇒ Object
61 62 63 64 65 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 61 def destroy requires :id service.delete_storage(id) true end |
#detach(server_id) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 54 def detach(server_id) requires :id data = service.disconnect_storage_from_server(id, server_id) reload end |
#failed? ⇒ Boolean
71 72 73 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 71 def failed? state == "ERROR" end |
#ready? ⇒ Boolean
67 68 69 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 67 def ready? state == "AVAILABLE" end |
#save ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 26 def save requires :data_center_id, :size data = service.create_storage(data_center_id, size, ) merge_attributes(data.body["createStorageResponse"]) true end |
#update ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 34 def update requires :id data = service.update_storage(id, ) merge_attributes(data.body["updateStorageResponse"]) true end |