Class: AWS::EC2::VolumeCollection
- Inherits:
-
Collection
- Object
- Collection
- AWS::EC2::VolumeCollection
- Defined in:
- lib/aws/ec2/volume_collection.rb
Overview
Represents a collection of Amazon EBS volumes. Typically you should get an instance of this class by calling #volumes.
Instance Method Summary collapse
-
#create(opts = {}) ⇒ Volume
Creates a new Amazon EBS volume that any Amazon EC2 instance in the same Availability Zone can attach to.
- #each {|Instance| ... } ⇒ nil
Instance Method Details
#create(opts = {}) ⇒ Volume
Creates a new Amazon EBS volume that any Amazon EC2 instance in the same Availability Zone can attach to. For more information about Amazon EBS, go to the Amazon Elastic Compute Cloud User Guide.
78 79 80 81 82 83 84 |
# File 'lib/aws/ec2/volume_collection.rb', line 78 def create(opts = {}) if snapshot = opts.delete(:snapshot) opts[:snapshot_id] = snapshot.id end resp = client.create_volume(opts) Volume.new(resp.volume_id, :config => config) end |
#each {|Instance| ... } ⇒ nil
41 42 43 44 45 46 47 48 |
# File 'lib/aws/ec2/volume_collection.rb', line 41 def each(&block) resp = filtered_request(:describe_volumes) resp.volume_set.each do |v| volume = Volume.new(v.volume_id, :config => config) yield(volume) end nil end |