Class: Fog::AWS::EC2::Volume
- Inherits:
-
Model
- Object
- Model
- Fog::AWS::EC2::Volume
show all
- Defined in:
- lib/fog/aws/models/ec2/volume.rb
Instance Method Summary
collapse
Methods inherited from Model
aliases, attribute, attributes, #attributes, #inspect, #merge_attributes
Constructor Details
#initialize(attributes = {}) ⇒ Volume
Returns a new instance of Volume.
17
18
19
20
21
22
|
# File 'lib/fog/aws/models/ec2/volume.rb', line 17
def initialize(attributes = {})
if attributes['attachmentSet']
attributes.merge!(attributes.delete('attachmentSet').first || {})
end
super
end
|
Instance Method Details
#destroy ⇒ Object
24
25
26
27
|
# File 'lib/fog/aws/models/ec2/volume.rb', line 24
def destroy
connection.delete_volume(@volume_id)
true
end
|
#reload ⇒ Object
29
30
31
32
|
# File 'lib/fog/aws/models/ec2/volume.rb', line 29
def reload
new_attributes = volumes.get(@volume_id).attributes
merge_attributes(new_attributes)
end
|
#save ⇒ Object
34
35
36
37
38
39
|
# File 'lib/fog/aws/models/ec2/volume.rb', line 34
def save
data = connection.create_volume(@availability_zone, @size, @snapshot_id).body
new_attributes = data.reject {|key,value| key == 'requestId'}
merge_attributes(new_attributes)
true
end
|
#snapshots ⇒ Object
41
42
43
|
# File 'lib/fog/aws/models/ec2/volume.rb', line 41
def snapshots
connection.snapshots(:volume_id => volume_id)
end
|
#volumes ⇒ Object
45
46
47
|
# File 'lib/fog/aws/models/ec2/volume.rb', line 45
def volumes
@volumes
end
|