Class: Fog::AWS::Compute::Volumes
- Inherits:
-
Collection
- Object
- Array
- Collection
- Fog::AWS::Compute::Volumes
- Defined in:
- lib/fog/aws/models/compute/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
#clear, #create, #inspect, #load, model, #model, #reload, #table, #to_json
Methods included from Fog::Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Attributes::InstanceMethods
#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires
Constructor Details
#initialize(attributes) ⇒ Volumes
Returns a new instance of Volumes.
15 16 17 18 |
# File 'lib/fog/aws/models/compute/volumes.rb', line 15 def initialize(attributes) @volume_id ||= [] super end |
Instance Method Details
#all(volume_id = @volume_id) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/aws/models/compute/volumes.rb', line 20 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
30 31 32 33 34 35 36 |
# File 'lib/fog/aws/models/compute/volumes.rb', line 30 def get(volume_id) if volume_id all(volume_id).first end rescue Fog::Errors::NotFound nil end |
#new(attributes = {}) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/fog/aws/models/compute/volumes.rb', line 38 def new(attributes = {}) if server super({ :server => server }.merge!(attributes)) else super end end |