Class: Awful::Eip
Instance Method Summary
collapse
Methods inherited from Cli
#initialize, #ll, #version
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
[View source]
35
36
37
38
39
|
# File 'lib/awful/eip.rb', line 35
def allocate
ec2.allocate_address(domain: options[:domain]).output do |eip|
puts eip.public_ip
end
end
|
#associate(id, instance) ⇒ Object
[View source]
55
56
57
58
59
60
|
# File 'lib/awful/eip.rb', line 55
def associate(id, instance)
ec2.associate_address(
allocation_id: find_eip(id).allocation_id,
instance_id: instance
).association_id.output(&method(:puts))
end
|
#disassociate(id) ⇒ Object
[View source]
63
64
65
|
# File 'lib/awful/eip.rb', line 63
def disassociate(id)
ec2.disassociate_address(association_id: find_eip(id).association_id)
end
|
[View source]
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/awful/eip.rb', line 21
def ls
ec2.describe_addresses.addresses.output do |eips|
if options[:long]
print_table eips.map { |i|
[i.public_ip, i.allocation_id, i.instance_id, i.private_ip_address, i.domain, i.association_id, i.network_interface_id, i.network_interface_owner_id]
}.sort
else
puts eips.map(&:public_ip).sort
end
end
end
|
#release(id) ⇒ Object
[View source]
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/awful/eip.rb', line 42
def release(id)
find_eip(id).tap do |eip|
unless eip.nil?
if eip.domain == 'vpc'
ec2.release_address(allocation_id: eip.allocation_id)
else
ec2.release_address(public_ip: eip.public_ip)
end
end
end
end
|