Module: Opssh::Api
- Included in:
- Choice
- Defined in:
- lib/opssh/api.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.reset_cache(verbose = false) ⇒ Object
35 36 37 |
# File 'lib/opssh/api.rb', line 35 def self.reset_cache(verbose=false) File.unlink(cache_file) rescue "" end |
Instance Method Details
#instances(stack_id) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/opssh/api.rb', line 18 def instances(stack_id) get_cache("stack-#{stack_id}---instances") do instances_list = api("describe_instances",{:stack_id => stack_id}) instances_list = instances_list[:instances].select{|instance| instance[:status] == 'online'} instances_list.map! do |instance| { :name => instance[:hostname], :public_dns => instance[:public_dns], :availability_zone => instance[:availability_zone] } end end end |
#reset_cache(verbose = false) ⇒ Object
31 32 33 |
# File 'lib/opssh/api.rb', line 31 def reset_cache(verbose=false) Opssh::Api.reset_cache(verbose) end |
#stacks ⇒ Object
12 13 14 15 16 |
# File 'lib/opssh/api.rb', line 12 def stacks get_cache('all_stacks') do api("describe_stacks")[:stacks].map{|s| {:name => s[:name], :id => s[:stack_id]}} end end |