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'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(underlying_stack) ⇒ StackStatus

Returns a new instance of StackStatus.



8
9
10
11
# File 'lib/bora/cfn/stack_status.rb', line 8

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

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/bora/cfn/stack_status.rb', line 13

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

#success?Boolean

Returns:

  • (Boolean)


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

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

#to_sObject



21
22
23
24
25
26
27
28
# File 'lib/bora/cfn/stack_status.rb', line 21

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