Class: AWS::EC2::ElasticIpCollection
- Inherits:
-
Collection
- Object
- Collection
- AWS::EC2::ElasticIpCollection
- Defined in:
- lib/aws/ec2/elastic_ip_collection.rb
Instance Method Summary collapse
-
#[](public_ip) ⇒ ElasticIp
The elastic IP with the given address.
- #create ⇒ Object (also: #allocate)
-
#each {|elastic_ip| ... } ⇒ Object
Yields once for each elastic IP address.
Instance Method Details
#[](public_ip) ⇒ ElasticIp
Returns The elastic IP with the given address.
27 28 29 |
# File 'lib/aws/ec2/elastic_ip_collection.rb', line 27 def [] public_ip super end |
#create ⇒ Object Also known as: allocate
18 19 20 21 |
# File 'lib/aws/ec2/elastic_ip_collection.rb', line 18 def create response = client.allocate_address ElasticIp.new(response.public_ip, :config => config) end |
#each {|elastic_ip| ... } ⇒ Object
Yields once for each elastic IP address.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/aws/ec2/elastic_ip_collection.rb', line 62 def each &block response = filtered_request(:describe_addresses) response.addresses_set.each do |address| = {} [:config] = config [:instance_id] = address.instance_id elastic_ip = ElasticIp.new(address.public_ip, ) yield(elastic_ip) end end |