class AWS::EC2::VolumeCollection
# => { “vol-12345678” => :available, “vol-87654321” => :in_use }
ec2.volumes.inject({}) { |m, v| m = v.status; m }
@example Get a map of volume IDs to volume status
volume.exists?
volume = ec2.volumes[“vol-123”]
@example Get a volume by ID
:availability_zone => “us-east-1a”)
ec2.volumes.create(:size => 15,
@example Create an empty 15GiB volume
should get an instance of this class by calling {EC2#volumes}.
Represents a collection of Amazon EBS volumes. Typically you
def create options = {}
-
(Volume)
- -
(Volume)
- An object representing the new volume.
Options Hash:
(**options)
-
:availability_zone
(String, AvailabilityZone
) -- -
:snapshot_id
(String
) -- The ID of the snapshot -
:snapshot
(Snapshot
) -- The snapshot from which to -
:size
(Integer
) -- The size of the volume, in
Parameters:
-
options
(Hash
) -- Options for creating the volume.
def create options = {} if snapshot = options.delete(:snapshot) options[:snapshot_id] = snapshot.id end resp = client.create_volume(options) Volume.new_from(:create_volume, resp, resp.volume_id, :config => config) end
def each(&block)
-
(nil)
-
Other tags:
- Yield: - Yields each volume in the collection.
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
def member_class
def member_class Volume end