Class: 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.
Attributes inherited from Model
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.
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 Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
#initialize(new_attributes = {}) ⇒ Attachment
Returns a new instance of Attachment.
20 21 22 23 24 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 20 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.
18 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 18 attribute :device |
#server_id ⇒ String (readonly)
Returns The server id.
10 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 10 attribute :server_id, :aliases => 'serverId' |
#volume_id ⇒ String (readonly)
Returns The volume id.
14 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 14 attribute :volume_id, :aliases => 'volumeId' |
Instance Method Details
#destroy ⇒ Boolean Also known as: detach
Detaches volume from server
48 49 50 51 52 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 48 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
34 35 36 37 38 39 |
# File 'lib/fog/rackspace/models/compute_v2/attachment.rb', line 34 def save requires :server_id, :volume_id, :device data = service.attach_volume(server_id, volume_id, device) merge_attributes(data.body['volumeAttachment']) true end |