Class: AWS::EC2::VolumeCollection
- Inherits:
-
Collection
- Object
- Collection
- AWS::EC2::VolumeCollection
- Includes:
- TaggedCollection
- 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(options = {}) ⇒ Volume
Creates a new Amazon EBS volume that any Amazon EC2 instance in the same Availability Zone can attach to.
- #each {|Instance| ... } ⇒ nil
Methods included from TaggedCollection
Methods inherited from Collection
Methods included from FilteredCollection
Instance Method Details
#create(options = {}) ⇒ 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.
84 85 86 87 88 89 90 |
# File 'lib/aws/ec2/volume_collection.rb', line 84 def create = {} if snapshot = .delete(:snapshot) [:snapshot_id] = snapshot.id end resp = client.create_volume() Volume.new_from(:create_volume, resp, resp.volume_id, :config => config) end |
#each {|Instance| ... } ⇒ nil
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/aws/ec2/volume_collection.rb', line 37 def each(&block) resp = filtered_request(:describe_volumes) resp.volume_set.each do |v| volume = Volume.new_from(:describe_volumes, v, v.volume_id, :config => config) yield(volume) end nil end |