Class: Fog::Compute::ProfitBricks::Volume
- Inherits:
-
Model
- Object
- Model
- 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
Constructor Details
#initialize(attributes = {}) ⇒ Volume
Returns a new instance of Volume.
19 20 21 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 19 def initialize(attributes={}) super end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
17 18 19 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 17 def end |
Instance Method Details
#attach(server_id, options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 39 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
58 59 60 61 62 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 58 def destroy requires :id service.delete_storage(id) true end |
#detach(server_id) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 51 def detach(server_id) requires :id data = service.disconnect_storage_from_server(id, server_id) reload end |
#failed? ⇒ Boolean
68 69 70 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 68 def failed? self.state == 'ERROR' end |
#ready? ⇒ Boolean
64 65 66 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 64 def ready? self.state == 'AVAILABLE' end |
#save ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 23 def save requires :data_center_id, :size data = service.create_storage(data_center_id, size, ) merge_attributes(data.body['createStorageResponse']) true end |
#update ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/fog/profitbricks/models/compute/volume.rb', line 31 def update requires :id data = service.update_storage(id, ) merge_attributes(data.body['updateStorageResponse']) true end |