Class: Bora::Cfn::StackStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/bora/cfn/stack_status.rb

Constant Summary collapse

DOES_NOT_EXIST_MESSAGE =
"Stack does not exist"

Instance Method Summary collapse

Constructor Details

#initialize(underlying_stack) ⇒ StackStatus



9
10
11
12
13
14
# File 'lib/bora/cfn/stack_status.rb', line 9

def initialize(underlying_stack)
  @stack = underlying_stack
  if @stack
    @status = Status.new(@stack.stack_status)
  end
end

Instance Method Details

#exists?Boolean



16
17
18
# File 'lib/bora/cfn/stack_status.rb', line 16

def exists?
  @status && !@status.deleted?
end

#success?Boolean



20
21
22
# File 'lib/bora/cfn/stack_status.rb', line 20

def success?
  @status && @status.success?
end

#to_sObject



24
25
26
27
28
29
30
31
# File 'lib/bora/cfn/stack_status.rb', line 24

def to_s
  if @stack
    status_reason = @stack.stack_status_reason ? " - #{@stack.stack_status_reason}" : ""
    "#{@stack.stack_name} - #{@status}#{status_reason}"
  else
    DOES_NOT_EXIST_MESSAGE
  end
end