Class: Moonshot::StackLister

Inherits:
Object
  • Object
show all
Includes:
CredsHelper
Defined in:
lib/moonshot/stack_lister.rb

Overview

The StackLister is world renoun for it’s ability to list stacks.

Instance Method Summary collapse

Methods included from CredsHelper

#as_client, #cd_client, #cf_client, #ec2_client, #iam_client, #s3_client

Constructor Details

#initialize(app_name, log:) ⇒ StackLister

Returns a new instance of StackLister.



6
7
8
9
# File 'lib/moonshot/stack_lister.rb', line 6

def initialize(app_name, log:)
  @app_name = app_name
  @log = log
end

Instance Method Details

#listObject



11
12
13
14
15
16
17
18
# File 'lib/moonshot/stack_lister.rb', line 11

def list
  all_stacks = cf_client.describe_stacks.stacks
  app_stacks = all_stacks.reject { |s| s.stack_name !~ /^#{@app_name}/ }

  app_stacks.each do |stack|
    puts stack.stack_name
  end
end