Class: AWS::EC2::Attachment
- Inherits:
-
Resource
- Object
- Core::Resource
- Resource
- AWS::EC2::Attachment
- Defined in:
- lib/aws/ec2/attachment.rb
Overview
Represents an attachment of an Amazon EBS volume to an instance.
Instance Attribute Summary collapse
-
#device ⇒ String
readonly
Returns how the device is exposed to the instance (e.g. ‘/dev/sdh’).
-
#instance ⇒ Instance
readonly
Returns the EC2 instance the volume is attached to.
-
#volume ⇒ Volume
readonly
Returns the volume that is attached.
Attributes included from Core::Model
Instance Method Summary collapse
-
#attach_time ⇒ Time
Returns the time at which this attachment was created.
-
#delete(options = {}) ⇒ Object
Detaches the volume from its instance.
-
#delete_on_termination? ⇒ Boolean
Returns
true
if the volume will be deleted on instance termination. -
#exists? ⇒ Boolean
Returns true if the attachment exists.
-
#initialize(volume, instance, device, options = {}) ⇒ Attachment
constructor
A new instance of Attachment.
-
#status ⇒ Symbol
Returns the attachment status.
Methods inherited from Core::Resource
attribute_providers, attribute_providers_for, attributes, #attributes_from_response, define_attribute_type, #eql?, #inspect, new_from
Methods included from Core::Cacheable
Methods included from Core::Model
#client, #config_prefix, #inspect
Constructor Details
#initialize(volume, instance, device, options = {}) ⇒ Attachment
Returns a new instance of Attachment.
34 35 36 37 38 39 |
# File 'lib/aws/ec2/attachment.rb', line 34 def initialize volume, instance, device, = {} @volume = volume @instance = instance @device = device super end |
Instance Attribute Details
#device ⇒ String (readonly)
Returns how the device is exposed to the instance (e.g. ‘/dev/sdh’)
49 50 51 |
# File 'lib/aws/ec2/attachment.rb', line 49 def device @device end |
#instance ⇒ Instance (readonly)
Returns the EC2 instance the volume is attached to.
45 46 47 |
# File 'lib/aws/ec2/attachment.rb', line 45 def instance @instance end |
#volume ⇒ Volume (readonly)
Returns the volume that is attached.
42 43 44 |
# File 'lib/aws/ec2/attachment.rb', line 42 def volume @volume end |
Instance Method Details
#attach_time ⇒ Time
Returns the time at which this attachment was created.
62 |
# File 'lib/aws/ec2/attachment.rb', line 62 attribute :attach_time |
#delete(options = {}) ⇒ Object
Detaches the volume from its instance.
107 108 109 |
# File 'lib/aws/ec2/attachment.rb', line 107 def delete = {} client.detach_volume(.merge()) end |
#delete_on_termination? ⇒ Boolean
Returns true
if the volume will be deleted on instance termination.
67 |
# File 'lib/aws/ec2/attachment.rb', line 67 attribute :delete_on_termination, :boolean => true |
#exists? ⇒ Boolean
Returns true if the attachment exists.
93 94 95 |
# File 'lib/aws/ec2/attachment.rb', line 93 def exists? !.nil? end |
#status ⇒ Symbol
Returns the attachment status. Possible values are:
-
:attaching
-
:attached
-
:detaching
-
:detached
58 |
# File 'lib/aws/ec2/attachment.rb', line 58 attribute :status, :to_sym => true |