Sha256: ddf54bc8d21fc28f50e4e1eaef2220748634a41b2940d0726a499183c5653959
Contents?: true
Size: 853 Bytes
Versions: 3
Compression:
Stored size: 853 Bytes
Contents
require 'aws-sdk' require 'terminal-table' require_relative 'client' module Opsicle class List attr_reader :client def initialize(environment) @client = Client.new(environment) end def execute stack_ids = get_stacks apps = get_apps(stack_ids) print(apps) end def get_stacks client.api_call('describe_stacks')[:stacks].map{|s| s[:stack_id] } end def get_apps(stack_ids) stack_ids.map{ |stack_id| apps_for_stack(stack_id) }.flatten end def apps_for_stack(stack_id) client.api_call('describe_apps', stack_id: stack_id)[:apps] end def print(apps) puts Terminal::Table.new headings: ['Name', 'Stack Id', 'App Id'], rows: app_data(apps) end def app_data(apps) apps.map{|app| [app[:name], app[:stack_id], app[:app_id]] } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opsicle-0.0.4 | lib/opsicle/list.rb |
opsicle-0.0.3 | lib/opsicle/list.rb |
opsicle-0.0.2 | lib/opsicle/list.rb |