Class: Cliaws::Cli::Ec2
- Inherits:
-
Thor
- Object
- Thor
- Cliaws::Cli::Ec2
- Defined in:
- lib/cliaws/cli/ec2.rb
Instance Method Summary collapse
- #allocate_address ⇒ Object
- #associate_address ⇒ Object
- #deallocate_address(address) ⇒ Object
- #describe_addresses ⇒ Object
- #disassociate_address(address) ⇒ Object
- #list ⇒ Object
- #run(ami) ⇒ Object
- #terminate(*instance_ids) ⇒ Object
Instance Method Details
#allocate_address ⇒ Object
52 53 54 55 |
# File 'lib/cliaws/cli/ec2.rb', line 52 def allocate_address address = Cliaws.ec2.allocate_address puts "Allocated: #{address}" end |
#associate_address ⇒ Object
71 72 73 74 75 76 |
# File 'lib/cliaws/cli/ec2.rb', line 71 def associate_address address = [:address] instance = [:instance] Cliaws.ec2.associate_address(:address => address, :instance => instance) puts "Associated:\n #{instance}: #{address.inspect}" end |
#deallocate_address(address) ⇒ Object
61 62 63 64 |
# File 'lib/cliaws/cli/ec2.rb', line 61 def deallocate_address(address) Cliaws.ec2.deallocate_address(address) puts "Deallocated: #{address}" end |
#describe_addresses ⇒ Object
92 93 94 |
# File 'lib/cliaws/cli/ec2.rb', line 92 def describe_addresses puts Cliaws.ec2.describe_addresses.to_yaml end |
#disassociate_address(address) ⇒ Object
82 83 84 85 86 |
# File 'lib/cliaws/cli/ec2.rb', line 82 def disassociate_address(address) address = [:address] Cliaws.ec2.disassociate_address(address) puts "Disassociated: #{address}" end |
#list ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cliaws/cli/ec2.rb', line 14 def list instances = Cliaws.ec2.list if [:yaml] then puts instances.map {|i| i.raw_data}.to_yaml else printf "%-10s %-50s %-12s %s\n", "ID", "DNS Name", "State", "Groups" printf "-"*120 print "\n" instances.each do |instance| printf "%-10s %-50s %-12s %s\n", instance.instance_id, instance.public_dns_name, instance.state, instance.groups.join(", ") end end end |