Class: Fog::AWS::EC2::Volumes
Instance Method Summary
collapse
Methods inherited from Collection
#_dump, _load, aliases, attribute, attributes, #attributes, #connection, #connection=, #create, #inspect, #load, #merge_attributes, model, #model, #reload, #table
Constructor Details
#initialize(attributes) ⇒ Volumes
Returns a new instance of Volumes.
31
32
33
34
|
# File 'lib/fog/aws/models/ec2/volumes.rb', line 31
def initialize(attributes)
@volume_id ||= []
super
end
|
Instance Method Details
#all(volume_id = @volume_id) ⇒ Object
36
37
38
39
40
41
42
43
44
|
# File 'lib/fog/aws/models/ec2/volumes.rb', line 36
def all(volume_id = @volume_id)
@volume_id = volume_id
data = connection.describe_volumes(volume_id).body
load(data['volumeSet'])
if server
self.replace(self.select {|volume| volume.server_id == server.id})
end
self
end
|
#get(volume_id) ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/fog/aws/models/ec2/volumes.rb', line 46
def get(volume_id)
if volume_id
all(volume_id).first
end
rescue Excon::Errors::BadRequest
nil
end
|
#new(attributes = {}) ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/fog/aws/models/ec2/volumes.rb', line 54
def new(attributes = {})
if server
super({ :server => server }.merge!(attributes))
else
super
end
end
|