Class: Fog::AWS::EC2::Volumes
- Inherits:
-
Collection
- Object
- Array
- Collection
- Fog::AWS::EC2::Volumes
- Defined in:
- lib/fog/aws/models/ec2/volumes.rb
Instance Attribute Summary
Attributes inherited from Collection
Instance Method Summary collapse
- #all(volume_id = @volume_id) ⇒ Object
- #get(volume_id) ⇒ Object
-
#initialize(attributes) ⇒ Volumes
constructor
A new instance of Volumes.
- #new(attributes = {}) ⇒ Object
Methods inherited from Collection
#create, #inspect, #load, model, #model, #reload, #table, #to_json
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires
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 Fog::Errors::NotFound 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 |