Class: Fog::Compute::RackspaceV2::Attachment
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::RackspaceV2::Attachment
- Defined in:
- lib/fog/rackspace/models/compute_v2/attachment.rb
Instance Attribute Summary collapse
-
#device ⇒ String
readonly
Device name of the device /dev/xvd.
-
#server_id ⇒ String
readonly
The server id.
-
#volume_id ⇒ String
readonly
The volume id.
Instance Method Summary collapse
-
#destroy ⇒ Boolean
(also: #detach)
Detaches volume from server.
-
#initialize(new_attributes = {}) ⇒ Attachment
constructor
A new instance of Attachment.
-
#save ⇒ Boolean
Attaches volume to volume to server.
Constructor Details
#initialize(new_attributes = {}) ⇒ Attachment
Returns a new instance of Attachment.
19 20 21 22 23 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 19 def initialize(new_attributes = {}) super(new_attributes) server_id = server.id if server #server id should come from collection self end |
Instance Attribute Details
#device ⇒ String (readonly)
Returns device name of the device /dev/xvd.
17 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 17 attribute :device |
#server_id ⇒ String (readonly)
Returns The server id.
9 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 9 attribute :server_id, :aliases => 'serverId' |
#volume_id ⇒ String (readonly)
Returns The volume id.
13 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 13 attribute :volume_id, :aliases => 'volumeId' |
Instance Method Details
#destroy ⇒ Boolean Also known as: detach
Detaches volume from server
47 48 49 50 51 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 47 def destroy requires :server_id, :volume_id service.(server_id, volume_id) true end |
#save ⇒ Boolean
Attaches volume to volume to server. Requires :server_id, :volume_id, and device to be populated
33 34 35 36 37 38 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 33 def save requires :server_id, :volume_id, :device data = service.attach_volume(server_id, volume_id, device) merge_attributes(data.body['volumeAttachment']) true end |