Class: AWS::EC2::ElasticIpCollection

Inherits:
Collection
  • Object
show all
Defined in:
lib/aws/ec2/elastic_ip_collection.rb

Instance Method Summary collapse

Instance Method Details

#[](public_ip) ⇒ ElasticIp

Returns The elastic IP with the given address.

Parameters:

  • public_ip (String)

    The public IP address of an elastic ip.

Returns:

  • (ElasticIp)

    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

#createObject 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.

Yields:

  • (elastic_ip)

Yield Parameters:



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|

    options = {}
    options[:config] = config
    options[:instance_id] = address.instance_id

    elastic_ip = ElasticIp.new(address.public_ip, options)

    yield(elastic_ip)

  end
end